Compare commits

...

1447 Commits
dev ... 6.4.3

Author SHA1 Message Date
Marc Mutz
519d2d8f44 QVarLengthArray: fix memory leak in (qsizetype) ctor
Instead of duplicating the logic of resize() to avoid three stores to
(ptr, a, s), and getting the memory management wrong (malloc()ed ptr
leaked when a following default-construction failed), simply call the
QVLA default ctor followed by std::uninitialized_default_construct_n().

After we called the QVLA default ctor, the lifetime of this object has
begun, so if the following code throws, ~QVLA will be called to clean
up. This was not the case when we didn't delegate the ctor: if the
body of this ctor threw, ~QVLA would _not_ have been called, since the
lifetime of the object had never started.

Since the dtor may now run, we need to maintain the class invariants,
so we can't just set the size() before we have constructed all
elements. This is where std::uninitialized_default_construct_n() comes
in: it's strongly exception-safe, so if a constructor throws, it will
destroy all previously-constructed elements, so that either we fail
and size() == 0 is true or it doesn't, then we can set size() to
asize.

Change-Id: I03408d8a473e8a31fa0086ef5ac551ce46a758f8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 217f2ab3eb04b7489959e8e1134184e8071dbaf0)
2023-03-11 13:56:16 +00:00
Mårten Nordheim
5941296512 Fix overflow in SHA-3/Keccak
state->rate is always larger than or equal to state->bitsInQueue;
when bitsInQueue == rate the queue is consumed and bitsInQueue is set to
0 again.

Done-with: Marc Mutz <marc.mutz@qt.io>
Change-Id: I56d268a19fb3cd542cc027edc962253f09d97a14
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit fa4b7495b741c3e7943860c5ff15212afceda710)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-10 16:18:08 +00:00
Marc Mutz
eac394648c tst_QCryptographicHash: Extract Method ensureLargeData()
... to make large data usable from other test functions.

Change-Id: I302070121a8bb49f373c7711bc3ab9e6418874ef
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit f7ea9b36b7c56bb288f3ea55f587d2ccb8a9b7fa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-10 16:18:04 +00:00
Thiago Macieira
3f1ccea048 qsimd_p.h: remove LZCNT feature from the ARCH_HASWELL list
And for good measure, I'm also removing BMI2. The one we really care
about ensuring gets enabled instead of -mavx2 is FMA anyway.

Complements commit 29d3938aa56663f09666a0ac58b33e70e00abff2 (which in
turn complemented commit a98cf15ed1b57aee695de01b04a974637b2cd44a),
which removed BMI1 because AMD introduced it before AVX2. Looks like
they also introduced LZCNT in some earlier processor too (family 10h) or
GCC 12 began emitting __LZCNT__ for that family -- IIRC the AMD feature
list was bigger than just the lzcnt instruction.

Fixes: QTBUG-111698
Change-Id: I7f354474adce419ca6c2fffd1748f5b24f69a692
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 8413824ca00188fa36b6adf46d4a5bddb9515ec7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-07 18:17:05 +00:00
Allan Sandfeld Jensen
e6b53d5e4b Add special thread pool for Qt Gui
To avoid gui slowdowns due to global pool being blocked.

Fixes: QTBUG-109511
Change-Id: I4e8d91e8fb0bd2e395072a082e992a3c5d3464ad
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 93047c71e8e6dd4ac28e1e59dcb561df11c759eb)
2023-03-02 11:11:09 +00:00
Eskil Abrahamsen Blomfeldt
7f8020f1f7 Update Harfbuzz to 7.0.1
This is the 6.4-specific update of Harfbuzz, since Harfbuzz
was currently on an older version in 6.4 compared to other
branches.

This also backports the change to the qtextlayout test that
was done on other branches for the 6.0.0 update.

Fixes: QTBUG-111535
Change-Id: Ie8217f1541a02d3800142b88cf0007be0ed0d1e2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 13549fa7c2d27ba588471f97a640f4dbcf86b10c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-02 05:21:49 +00:00
Marc Mutz
474e2c9208 tst_QMutex: use constexpr variables instead of 'enum-trick'
C++20 doesn't like arithmetic with enums anymore. While this hasn't
caused immediate pain, yet, fix it pro-actively for an imminent patch.

As a drive-by, fix the missing space at start of comment.

Change-Id: Id08bb227c587bc7b900c593a7b6d2655ca32eefd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b8966021ffb2cfddc77aee6dbe145eb74ef22f9d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-02 05:21:43 +00:00
Marc Mutz
f77356c6e9 tst_qvarlengtharray: add test for QVLA(n) ctor
Also add one for types that are neither copy- nor move-constructible.
In contrast to resize(n), the QVLA(n) ctor worked for such types, so
make sure it stays that way.

Change-Id: If54fbc9dd6a4808175c4bcb0ffb492b33c879746
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit e7c792ba7179c4c81fb2e26f66031ec81234b0d7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-02 05:21:38 +00:00
Eskil Abrahamsen Blomfeldt
ecb118d45e Update to Freetype 2.13.0
Also adds a file to patches which is a required modification
to the update in order to make it compile.

Fixes: QTBUG-111536
Change-Id: Iaabc1b7736cfd98217a8aff2b7f9bc65402d0451
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 18aa3309a4e4b5a874298af1243095db9aa207d3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-02 05:21:32 +00:00
Oliver Wolff
7e4092d7cb Windows drag&drop: Use correct window for drag target processing
GetFocus will return the window that currently has keyboard focus. This
is not what we want for drag and drop handling though. Use the window
under mouse and process events for that window when doing the touch/pen
input workaround. If no window is found we fall back to the focus
window. Followup to 31e7790102b260344893eaa8bf8b7b1a0f95e3b7

Fixes: QTBUG-111149
Change-Id: Ib8233debc267df0cc19b21c1dc5c6881d018d84a
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit c912bde52a1b85a782db6aed8d6f9917d597f58b)
2023-03-02 05:21:26 +00:00
Andy Shaw
3e9ffad0c8 SQLite: Update SQLite to v3.41.0
[ChangeLog][QtSQL][SQLite] Updated SQLite to v3.41.0

Fixes: QTBUG-111539
Change-Id: Ia90939bf57222a290fe7bcb3741013c2576eec13
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 8f33a0424f5799a87d6d56691f3e47a09156c720)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2023-03-01 05:21:57 +00:00
Volker Hilsheimer
b1d95c6702 QAbtractItemView: deselect before click opens editor
A click on the selected item should deselect all other items before
editing starts.

Remove the part of the test case that assumes that we can have multiple
items selected in ExtendedSelection mode, and click on an item to start
editing while maintaining selection. That can never happen.

Fixes: QTBUG-111131
Change-Id: I0312eed4614502cfb77eca26d3f7615427493d7d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 3f2d02e2f4436ace5f0fbbf432878a963f5ee969)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-01 05:21:36 +00:00
Joerg Bornemann
550ee1d752 CMake: Fix position independent code linker flags not being set
We set CMAKE_POSITION_INDEPENDENT_CODE to ON and require CMake 3.16.
This sets CMP0083 to NEW and should pass -fPIE to linker calls as well.

However, the PIE-enabling flag is not passed to the linker unless we
call check_pie_supported(). This behavior is documented in CMake's
CMP0083 documentation page.

[ChangeLog][CMake] Qt tools are now built with position independent code
even with Unix toolchains where this is not the default, for example
clang.

Change-Id: I1d98e0ea7063a76e3fddc94d6555c6eaf14c7885
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 4183768d9bc6f80ac7b86c3dbf93e6b251369ae4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 6d301449fd36ccb3ea33dc58d41b44f5ba31ca3a)
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2023-02-27 08:35:58 +00:00
Tim Blechmann
aecaf09913 corelib: silence -Wcomma with clang-12
clang-12 warns with -Wcomma

warning: possible misuse of comma operator here [-Wcomma]
{ return Q_ASSERT(i >= 0), Q_ASSERT(i < size()), QLatin1Char(m_data[i]);
}

Change-Id: Ice8a809c8ac9069e55aedefa71faf06385e97789
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c24f4d2c32b475a24250ff4bed15837615f33ef0)
2023-02-22 09:05:24 +08:00
Marc Mutz
cdbec041e2 QVarLengthArray: fix UBs in emplace()/insert() ([basic.life], broken class invariant)
There are two problems in emplace_impl() (the same code exists as
rvalue insert() since 5.10):

First, the old code updated size() at the end of the function.

However, if, after constructing the new end element, one of the
subsequent move-assignments fail (throws), then the class invariant
that size() be the number of alive elements in the container is
broken, with the immediate consequence that the QVLA dtor would not
destroy this element, but surely other unpleasantness (UB) that the
C++ lifetime rules decide to throw our way.

Similarly, in the trivially-relocatable case, the memmove() starts the
life-time of the new end object, so if the following placement new
fails, we're in the same situation.

The latter case is worse, though, since here we leave *b in some weird
zombie state: the memmove() effectively ended its lifetime in the
sense that one mustn't call the destructor on the source object after
trivial relocation, but C++ doesn't agree and QVLA's dtor will happily
call b->~T() as part of its cleanup.

The other ugly thing is that we're using placement new into an object
that C++ says is still alive. QString is trivially relocatable, but
not trivially copyable, so we can't end a QString's lifetime by
placement-new'ing a new QString instance into it without first having
ended the old object's lifetime.

The fix for both of these is, fortunately, the same: It's a rotate!™

By using emplace_back() + std::rotate(), we always place the new
object in a spot that didn't contain an alive object (in the C++
sense) before, we always update the size() right after doing so,
maintaining that invariant, and we then rotate() it into place, which
doesn't leave zombie objects around.

std::rotate() is such a fundamental algorithm that we should trust the
STL implementors to have optimized it well:
https://stackoverflow.com/questions/21160875/why-is-stdrotate-so-fast

We know we can do better only for trivially-relocatable, but
non-trivially-copyable types (ex: QString), so in order to not lose
the memmove() optimization, we now fall back to std::rotate on raw
memory for that case.

Amends dd58ddd5d97f0663d5fafb7e81bff4fc7db13ba7.

Manual conflict resolutions:
 - no q20::construct_at() in 6.4

Change-Id: Iacce4488ca649502861e0ed4e084c9fad38cab47
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit e24df8bc726d12e80f3f1d14834f9305586fcc98)
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-02-21 15:16:50 +00:00
Fabian Kosmale
4822af4f41 QObjectBindableProperty: Avoid use-after-free in notifyObservers
We so far refetched the first observer after evaluating bindings, as
binding evaluating might change the list of observers.
However, that approach did not take into account that the 'this' pointer
might no longer be valid after binding evaluation: In case of a
QObjectBindableProperty (or a QObjectCompatProperty), binding evaluation
might cause a reallocation of the binding storage, and consequently the
invalidation of the QPropertyBindingData.
Fix this by refetching the QPropertyBindingData from the storage (if a
storage has been provided, which is always the case for the affected
classes).

Fixes: QTBUG-111268
Change-Id: Ie7e143a0bbb18f1c3f88a81dd9b31e6af463584f
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit b124171309b259d429bd064fe3bfdec148869ef4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-20 17:07:26 +00:00
Tor Arne Vestbø
de19738b23 Fix QString from ASCII warning in qoperatingsystemversion_darwin.mm
Introduced in d05f2fb2d567.

Change-Id: Ifa308be3be9c817c6304f634a53da62e631f54af
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9416012523e75b8b73bb9a8c02e5bbeb30aafac5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-20 12:03:05 +00:00
Tor Arne Vestbø
de310d34ce Resolve actual macOS version despite process running in compatibility mode
If the application executable was built against a pre-macOS 11 SDK, macOS
will report its version as 10.16 on every OS from macOS 11 and up, for
compatibility reasons.

From Qt 6.2 and up, we require at least Xcode 12 with the macOS 11 SDK
to build Qt applications, so normally this should not be an issue, but
in the case where the Qt 'app' is a plugin library hosted by a third
party host application, the host application determines the behavior,
and we might end up in the compatibility situation after all.

However, since the Qt app was built against at least the macOS 11 SDK,
we know that it can/should handle the new version number scheme, and
we can resolve the real version number for QOperatingSystemVersion.

We do that by launching the sysctl binary with the SYSTEM_VERSION_COMPAT
environment variable set to 0, which is the supported way of disabling
the compatibility mode.

Now that we have the real version number we can use that for the
deployment target check via qt_apple_check_os_version(), but we
still need to account for possible failures in reading the plist
file.

We can also simplify the QOperatingSystemVersion::MacOSBigSur
definition, now that we always know the app the should be able
to handle major versions above 10.

Task-number: QTBUG-111114
Change-Id: I2a2756381c31b195f7b8800c5008a87b37114080
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d05f2fb2d567617730d7d4757fff39ddc3e903ce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-18 19:10:04 +00:00
Volker Hilsheimer
072f1880df QScroller: use categorized logging
Replace local built-time enabled macro with a logging category.

As a drive-by, move QDebug streaming operator into the anonymous
namespace to prevent external linkage, break some excessively long
lines, and remove dead code.

Task-number: QTBUG-102010
Change-Id: I49d212ee4a66a3eabfa5567f6c8d9674ffbb8880
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 5edb1bed3fc360276aec3e678f8b46cb40dd5d26)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-18 12:20:14 +01:00
Volker Hilsheimer
3edc2cb543 QGesture: make sure we copy timestamp value for event clones
Otherwise, double-click recognition will fail.

Use QEvent::clone when possible, or set the timestamp explicitly when
not.

As a drive-by, remove some long-dead code in affected code lines.

Fixes: QTBUG-102010
Change-Id: I882bf6e8090bf6f182b7a0a3c62aa3a4c8db2e14
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit fb09c82a2c7c44d41a0a36d8fe6d6d22e792668a)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-02-18 12:20:07 +01:00
Tor Arne Vestbø
33eeba416f Darwin: Ensure encrypted library is loaded before parsing plugin metadata
Application delivered via the macOS or iOS App Store might have their
libraries encrypted, in which case we can not read any of the sections
of the binary until it has been dlopened.

This was causing issues for our plugin loading code, which assumed we
could read the .qtmetadata section of a yet to be loaded plugin to
determine its suitability, before loading it.

We now detect whether a library is encrypted during the Mach-O parsing,
and propagate this back to QLibraryPrivate::updatePluginState(),
which can handle the case by explicitly loading the library before
continuing with metadata validation. We still ensure that the library
has a .qtmetadata section, so that we don't need to dlopen any random
library in our path.

This does mean that we will potentially load more plugins than we
need, and since the Qt version validation happens as part of meta
data validation, we might dlopen() incompatible plugins, but it's
expected that in an App Store deployment scenario you control both
the versioning and set of shipped plugins, so this should not be
an issue in practice.

As encrypted libraries are only produced for apps that are fully
published to the App Store, and then deployed via MDM, VPP, or
Apple Configurator 2, we don't have an easy way to test this,
but the existing code paths should be unaffected, and hopefully
this patch improves the situation for the encrypted library case.

Change-Id: Iff733505f7067ce5571854ea978bc95e8376e347
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 667aec810f71ac378a618032846df4bb6d76c647)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-17 14:43:17 +00:00
Mårten Nordheim
376b33addf TLS[openssl]: Use optional<> for CA cert we are fetching
The QSslCertificate ctor is somewhat expensive, especially when we are
shutting down. By using optional<> we simply reset() it and no longer
need to create a new, valid, certificate.

Task-number: QTBUG-102474
Change-Id: I514433b0d380dd3ceabbed3a6164f7e3efc490c7
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
(cherry picked from commit 61bfe87a64ca322de0ebf9bf61a0a0a81ee5bf7d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-17 13:16:12 +00:00
Mårten Nordheim
66af62b2eb Delete references to deleted examples
The bearer code hasn't been in Qt for some years.

Change-Id: Id69ad1ce5035a0970f3507d4b6ba4a5549bf1d6c
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit d5e98cde1a1da17df1c82e697ce786878e71511c)
2023-02-16 15:59:35 +00:00
Volker Hilsheimer
d2ef5cd650 QAbstractItemView: don't start editing on Ctrl-Click
Amends 17c1ebf8bfd254ff75cc55e335d1c1fb01da547f, after which dragEnabled
item views toggled selection on click rather than on press. If the edit
trigger included SelectedClicked at the same time, then Ctrl-Clicking a
selected item would start editing the item, instead of toggling
selection.

Fix this by ignoring clicks with modifier when evaluating whether
editing should start.

Extend the mouseSelection test case by including a column for the
editTrigger, and cover the respective combinations.

Fixes: QTBUG-111131
Change-Id: I9605f9b3d5a49e292551a34c3c4c7a5f9ecb2a89
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 557dcd8a87c6c6c77ccc71a85b1ec349c69eb4c4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-16 14:28:27 +00:00
Marc Mutz
2fef5514d3 QVarLengthArray: protect against aliasing in resize(n, t)
Amends a00a1d8806cfbf17e04b88d1b4ff4a9cf5b6294a.

Change-Id: I3fa6183466715555530d4042006049e286897343
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 0cfaa6e8964a0458cca20ce686b6a399293ad4cc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-16 13:38:42 +00:00
Thorbjørn Lindeijer
25ece74bfe Fix QStatusBar::removeWidget to hide the right widget
`QStatusBar::removeWidget` was hiding the wrong widget (the next one),
since the `removeAt` call changed the item that the `item` variable
is referencing.

This fixes a regression in Qt 6.3.0 (7166a82844500238a4dad91857384479c7).

Change-Id: I9977b47e6208f8d451ff1037bcb9f4e8414cb431
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thorbjørn Lindeijer <bjorn@lindeijer.nl>
(cherry picked from commit 3e7226f10702828eaaf2fa939efc2ac476e8a2b4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-16 11:40:17 +00:00
Assam Boudjelthia
c450780358 Android: use test QFileInfo fileName() instead of completeBaseName()
using fileName is more correct in this case.

Task-number: QTBUG-98974
Change-Id: I7c547bfc1c2321d4817dc087d3e962dbc2a0b7fd
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit df47d7d1ff2ac45ab5c6cdade89e5e1857f12479)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-16 04:49:15 +00:00
Thiago Macieira
cffe6800d1 QFileSystemWatcher/Win: remove the pre-QFileInfo path normalization
It's completely unnecessary, since QFileInfo will query the file system
anyway and that has a much better view of what is normalized and what
isn't. More importantly, this fixes the mistake in failing to normalize
properly in removePaths(), which removed the ending slash of a root
directory such as "C:\\". That caused the path to become "C:", which
QFileInfo interprets as "current path on drive C:".

[ChangeLog][QtCore][QFileSystemWatcher] Fixed a bug that prevented
removePaths() from removing the root of a drive on Windows.

Fixes: QTBUG-110986
Change-Id: I9671dee8ceb64aa9b9cafffd17419b6d69670876
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 6d1769791348e9387e0c5f29d970131895888814)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-15 22:25:46 +00:00
Marc Mutz
8bb9290b72 QVarLengthArray: clear() is not resize(0)
The latter needs the value_type to be default-constructible, which
shouldn't be required to clear() a container.

Use std::destroy_n() instead.

[ChangeLog][QtCore][QVarLengthArray] clear() no longer requires the
value_type to be default-constructible.

Change-Id: I806de8f3826b50c0bd38156892c3afeb15f13ac9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit fbfee2d7c59a7c6cd17ae7a3f63f983b9f3316f5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-15 19:49:48 +00:00
Andreas Eliasson
16d67bcb3d Doc: Fix member name in code snippet
QstyleOption has no init() member, only initFrom().

Fixes: QTBUG-107770
Change-Id: I00ff0b980fbfac813f113a7052bd3df32c7912b6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d6bdc5e9b6bcc9324c506c194bc168cdb6ec1da7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-15 15:22:05 +00:00
Ivan Solovev
65b4031e7a QFuture: fix continuation cleanup
Not clearing the continuationData could lead to use-after-free when
there is an attempt to cancel an already finished future, which belongs
to an already-destroyed promise.

This patch fixes it be explicitly resetting continuationData to nullptr
in the clearContinuation() method, which is called from the QPromise
destructor.

Task-number: QTBUG-103514
Change-Id: I6418b3f5ad04f2fdc13a196ae208009eaa5de367
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit b34bea5e96370986ea5dfc499fc2ec6366fda627)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-15 14:12:24 +00:00
Timur Pocheptsov
86c9c914c2 QIosFileDialog - properly handle QUrl for assets-library
For QT_PLATFORM_UIKIT 'PicturesLocation' manually appended by "assets-library://".
When converted to QUrl, such a path becomes a valid url, having empty path
and scheme "assets-library". Later in QIOSFileDialog we convert this
path (options()->initialDirectory()) calling QUrl::toLocalPath, which
gives us an empty string and thus we erroneusly select document picker
dialog, not an image picker. So let's also check a scheme, not path
only.

Fixes: QTBUG-107844
Change-Id: If4dd453549b37933cba07b5d7af6e45f2504dd29
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 402a526b2a87cbf6b7466bacb9dd3d8b7c71d9b2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-15 09:50:56 +00:00
Assam Boudjelthia
19160fb46a Fix few QFileInfo and QDir calls
Return the file engine impl of QFileInfo::completeBaseName() and
QDir::absolutePath() and QFileInfo::fileName() (based on
QAbstractFileEngine::BaseName) if the file engine impl is valid.

Amends f77668ffec48d8aaad7c74069c6f3e770a305ae1.

Task-number: QTBUG-98974
Change-Id: I28a8c75a6f25e30012b0791c12dbde51bfe8f62c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 249d613a60aa6a1347ebc1c29902049247b93324)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-02-14 16:50:25 +00:00
Laszlo Agocs
7cf7fe93ef rhi: gl: Skip the vertex-fragment interface check with more stages
Once tessellation and geometry shader support is added, the check
makes no sense when there are additional stages between the vertex
and fragment stages.

Change-Id: I3d3c0a5b338f5fe191c072a13a8699924f7a6a1b
Reviewed-by: Kristoffer Skau <kristoffer.skau@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 5476973325288e399f99af004e53184e41892282)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-14 16:48:19 +00:00
Volker Hilsheimer
e3ceb846a2 QAbstractItemView: don't access invalid indexes on copy-key
When pressing the copy key the view tried to access the model's data for
the currentIndex() without checking whether the index is valid. This
resulted in debug output to the console, and might break models that
didn't check incoming indexes for validity (or asserted validity).

Fix this by checking whether the currentIndex() is valid before reading
the model's data for that index.

Fixes: QTBUG-106569
Change-Id: Ide75fbdfdbd1451ab6d48f07b22136553c5b2468
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 3a0c33da3d913431391c5b7f4f0e93ea9d2221dc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-13 21:53:17 +00:00
Edward Welbourne
68249352af Accept full-width parentheses in removeMnemonics()
QPlatformTheme::removeMnemonics() removes any match to /\s*\(&[^&]\)/
from the text it is given (a menu entry). It transpires that
translators are apt to use the full-width parentheses (compatible with
some far-eastern scripts) instead of the plain ASCII ones. This leads
to their translated mnemonics don't match the same pattern unless we
treat the full-width parentheses as a match for the ASCII ones;
consequently, they don't get removed, which this function exists to
do. So teach it to recognize the full-width versions, too.

In the process, break out the pattern-matching (aside from the leading
space) to a lambda to make it easier to read and document.

Fixes: QTBUG-110829
Change-Id: I7335d0bd8dbba66e1fe58fc3eec93caaaf6ec140
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 86b930f073b6b75790a6af8d021f4daa00f80aae)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-13 21:53:17 +00:00
Volker Hilsheimer
2800481b0d QMenu: guard for destruction when emitting action signals
If a slot connected to a QMenu-action destroys the QMenu, then
we must not touch data members in subsequent code, and instead return
immediately.

We cannot use QBoolBlocker here, as that would reset the data
member of QMenuPrivate even when trying to return early.

Fixes: QTBUG-106718
Change-Id: I6b5ea471b1bf1f9864e1384382100f8f6c01346f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 52ce4d2d29db8a44fa2fa817cab9ebe969db082e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-13 21:53:17 +00:00
Christian Ehrlicher
03542e413f ODBC/MySQL: fix compilation with MySQL < 5.7.9
MYSQL_TYPE_JSON was introduced in MySQL 5.7.9 but our documentation
states that we still support 5.6 so we have to define this value by
ourself for the older versions.

Fixes: QTBUG-109832
Change-Id: I935edb14495d162ed58109610946b2805d37bbc4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5bc61ec5d028d57640b9c4cd515ed7dfebac945c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-13 21:53:17 +00:00
Eirik Aavitsland
7dddb9df64 Update bundled libjpeg-turbo to version 2.1.5
[ChangeLog][Third-Party Code] libjpeg-turbo was updated to version 2.1.5

Task-number: QTBUG-110336
Change-Id: Ifc08ad7f1a3c5b3e66b11e5a51d523b091288790
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 94efcf9be4c5e46dff463806e278fcee90ff4d53)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-13 18:23:35 +00:00
Volker Hilsheimer
598022cdc8 macOS: map Qt::Key_Return to NSCarriageReturnCharacter in menus
On macOS, key combinations with the Return key do not get delivered
through NSView::keyDown, but they are seen by the
QCocoaNSMenu::menuHasKeyEquivalent override. We already use that
override to check whether any menu item uses a matching shortcut, and
give Qt's focus object a chance to override the shortcut. The key
mapper used the NSNewlineCharacter '\n' for Qt::Key_Return.

However, the character we get from macOS for the return key is the
NSCarriageReturnCharacter character, '\r'. This makes the lookup
fail, and shortcut overrides are not delivered for shortcuts using
Qt::Key_Return.

To fix this, map Qt::Key_Return to NSCarriageReturnCharacter. The
inverse mapping maps both NSCarriageReturnCharacter and
NSNewlineCharacter to Qt::Key_Return, and there are no other users
of this function in Qt.

Fixes: QTBUG-107526
Change-Id: I716190adf3cd94697e2b3ad1afc25b95d8ebde25
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 0835537c3c3a8b7991b7a6e4a877a13f165a66e7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-12 12:33:36 +00:00
Sebastian Beckmann
51464de4a0 QAbstractItemView: Don't unselect on click on empty area in SingleSelect
dfb4697e4a4828acd47292a89207b3975ec6766e made a change to selection
behavior that resulted in a regression where clicking on an item view
but not on an item would cause the current item to get unselected.
Changes the behavior to not update in this case.

Added a new test that specifially checks for this scenario and ensures
that the current item is still selected, even after the user clicks on
empty area.

Fixes: QTBUG-105870
Change-Id: I191c3878819b99897083039fba0ab43908da5429
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f11e5435c776deddf27f7759180c1d41f64b8cce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-11 22:13:28 +00:00
Eirik Aavitsland
15e0071753 Fix Qt 6 performance regression when painting outside device
Painting wide lines and filling would be clipped to cliprect (by
default, the device rect) only if the bounding rect coordinates
exceeded QT_RASTER_COORD_LIMIT. In Qt 6, that limit was raised from
2^15 to 2^23, so a lot of time could be spent on rasterizing elements
that would anyway be outside the rendering area.

Fix by instead clipping whenever the path to be painted overshoots the
cliprect by a significant margin. At this point, the path is already
flattened to straight lines, so clipping is quick and precise. Testing
indicates that this solution improves performance a lot when large
portions of the elements to be painted fall outside the cliprect,
while not causing significant performance hits otherwise.

As a side effect, it is then no longer necessary to test the bounding
rect explicitly against QT_RASTER_COORD_LIMIT, since we already make
sure that the clip rect we check against is within that limit.

Fixes: QTBUG-110595
Change-Id: Iaf1afbb481c2d7059405f334278796ad46f5bcb6
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit ce7b4c734b78d24b75ecb389cf799ce85d0cc3bf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-11 07:29:01 +00:00
Marc Mutz
310d868d12 tst_qvarlengtharray: fix MyBase trackers for swap()
I don't begin to understand the semantics of the trackers here, but
whatever they are, they break with the fallback std::swap() 3-moves
implementation and lose track of alive objects, so provide an ADL swap
that does the right thing.

Amends dd58ddd5d97f0663d5fafb7e81bff4fc7db13ba7 (I think).

Change-Id: I1cd49c95dca2d103a26c2c7ac0a896929135a6c8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 49fca96d88c308bc22cd898a8d202228d185654e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-10 22:31:48 +00:00
Christian Ehrlicher
598be12d4a SQL/MySQL: Fix retrieving a datetime for libmysql >= 8.0.27
Somewhere between libmysql 8.0.18 and 8.0.27, the MYSQL_TIME structure
gained an additional member which increased the struct size by 4 bytes.
This makes an internal check for the correct size of the structi go fail.
Since it can now happen that the plugin is linked against a new libmysql
and used with an old and the other way round, duplicate the old
MYSQL_TIME struct to use this in our code

Fixes: QTBUG-110967
Change-Id: I5bc631179a0a1be47a5966954e757f27a72f1592
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c67cc6d5706fa732ee78e286e0142f97f5b9d61f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-10 18:27:30 +00:00
Christian Ehrlicher
1988f3c685 SQL/ODBC: add handling for SQL_SS_TIME2
MSSql Server sometimes returns SQL_SS_TIME2 instead SQL_TIME. Since this
value is non-standard, we have to define it by ourself.

Fixes: QTBUG-109206
Change-Id: I40a4b32590d877ebfdc4b2f1d9080d8cdb2ae7a5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7ebac2081244bc1f075bc16da6ce59cbd5122c7d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-10 18:27:23 +00:00
Yuhang Zhao
5e1e9130fd Use qt_winrtbase_p.h workaround in more places
This patch addresses the following issues:
(1) some places are still using the original workaround, replace
them with the new qt_winrtbase_p.h workaround.
(2) add more comment to let people know how to workaround other
cppwinrt issues (it was a common issue for many years and may be
fixed upstream recently, but let's at least document it in case
the user is still using old version cppwinrt).

Amends commit b2c1237b4512480a17009afe1981af02c2a9869e

Change-Id: Ife676f41739bbe69d9fb23bf5758be4b1fab4855
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit ad7227ada177dec4e61e8bbc51dd70f00a6e3d15)
2023-02-09 15:28:22 +08:00
Marc Mutz
a28eca8eff savegame ex.: fix include order [2/2]: game.h
Includes should be ordered from most specific to most general. This
means that project-specific includes always come before Qt includes.

This example didn't follow that guideline. Fix.

Amends 88e8094f18e6581f2b652eb3d82f514ecf687046.

Task-number: QTBUG-108857
Change-Id: Iafdae9dd8e70ff99882c4344a023a21d15fa3c54
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit ac6e8b3b21c2ae25e7a4fe483b604ea6ddecd3ff)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-08 17:24:34 +00:00
Marc Mutz
fdb0112b86 savegame ex.: make Level ctor explicit
A QString is not a full representation of a Level, so the
Level(QString) ctor should be explicit.

Task-number: QTBUG-108857
Change-Id: I24b705139e61c4aaf59cb0aad3b536013e0d07df
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit fa55d46e1f09ddf45dbe5700d4637b003363c559)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-08 17:24:27 +00:00
Fabian Kosmale
e73514d6b9 Avoid accessing deleted binding data in grouped updates
This fixes a use-after-free in QPropertyDelayedNotifications::notify.

Before this patch, evaluateBindings or a notify from a property index
might have caused the originalBindingData to become reallocated.
However, at that point, we've already restored the original bindingData
in evaluateBindings, so we won't track updates, and thus won't adjust
originalBindingStatus, which will then point to already freed data.

To remedy this, we no longer do the notification with data fetched from
originalBindingData, but instead use the information we have in the
proxyData.
We also need to enure that referenced bindings do not get deleted; for
that we keep the PendingBindingObserverList alive for the whole duration
of the endPropertyUpdateGroup.

As we now have the PendingBindingObserverList, we use it for the
notification logic, and only notify change handlers in
QPropertyDelayedNotifications::notify. That will allow a follow-up
cleanup of QPropertyObserverPointer::notify, and aligns the logic for
grouped updates with the logic for "nornal", non-grouped updates.

Amends f1b1773d0ae636fa9afa36224ba17566484af3cc.

Task-number: QTBUG-110899
Change-Id: Iae826e620d9614b7df39d86d8a28c48c8a5c4881
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 7a415a051a464ee3145c11b4ff44dbb16010323e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-08 17:16:45 +00:00
Marc Mutz
eba4899100 savegame ex.: use ranged instead of indexed loops
Modernizes the code, and fixes qsizetype/int mismatch.

Task-number: QTBUG-108857
Change-Id: Id4262ee0bcb673d62135a81c30976903eef3e5e2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 44933343937d7a6d9f6afe1f8e0b0f93a387b100)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-08 13:51:32 +00:00
Marc Mutz
eb4d4c8f64 savegame ex.: use NSDMI, =default the default ctor
Modernizes the code.

Task-number: QTBUG-108857
Change-Id: I6ddf1de3699506ffc0fc4b1034ab48defafcf174
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 35b94f8b4349581c548b7aac2e858750072efa19)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-08 13:51:26 +00:00
Marc Mutz
b630442d20 savegame ex.: fix include order
Includes should be ordered from most specific to most general. This
means that project-specific includes always come before Qt includes.

This example didn't follow that guideline. Fix.

Task-number: QTBUG-108857
Change-Id: I42727ff8bdef5336368cde349cbcb8d10bb6289f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 88e8094f18e6581f2b652eb3d82f514ecf687046)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-08 13:51:16 +00:00
Santhosh Kumar
d14185d33e Avoid multiple transformation of the clip path
The painter saves existing paint engine state in the stack and restore
back to the previous state after performing required paint operation.

The clip path stored as part of paint engine state is getting
translated more than once during save and restore operation. This
multiple transformation of the same clip path causes incorrect
translation within the plane.

To fix this issue, during restore, remove translation of clip path
with redirection matrix.

Fixes: QTBUG-109518
Change-Id: I1509bc7fa4965f2802bce62c1ed27cdb90da617a
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 4e4d37f0472c58ff6c98e9852691b1ccda8beffb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-08 09:27:17 +00:00
Marc Mutz
e75229addc savegame ex.: fix extra ';' after Q_GADGET
Fixes compiler warnings.

Amends 1ff52e478bab33f3aaba5ec185295411a0e6867d.

Task-number: QTBUG-108857
Change-Id: Id8b81c67e55baf490aabd0483b5800b3e61965ee
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 06a9b85f8fec8d039aa0e63cea0e16037611bf79)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-08 07:37:32 +00:00
Thiago Macieira
bf39580a38 tst_qdbusxml2cpp: test the old-style QDBusReply interface output too
Change-Id: I9671dee8ceb64aa9b9cafffd17416487c07f148a
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 0128c3742e92cd38e6bb5fadddae57f31cd01690)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-08 03:47:41 +00:00
Tor Arne Vestbø
026fdda1c4 macOS: Skip deployment target runtime check when detecting compat version
When the main executable is built with a pre-macOS 11 SDK, the macOS
kernel and system libraries will enable a compatibility mode for
reporting the system version, reporting 10.16 instead of 11/12/13 etc.

This happens at at such a low level that even manually reading the
version from /System/Library/CoreServices/SystemVersion.plist is
intercepted.

Working around this by temporarily setting the SYSTEM_VERSION_COMPAT
environment variable is unfortunately not possible, as it's only read
on process creation/initialization.

The same goes for the kern.system_version_compat sysctl, as once it's
set it can not be changed back to its original value, and it's not
clear whether this sysctl should even be touched.

As long as we have no reliable way of reading the actual current
operating system version, we need to bail out of the deployment
target verification, to avoid false negatives where a plugin or
library, built with a deployment target of say 11.0, is loaded
into an application built with a pre-11.0 SDK, but running on
macOS 11+.

Change-Id: I9c757a276726175c5dda694ffc1b88f1681d00fb
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit bac93ce5eba10ae1e5d165b464a7a9e3b4dd6561)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-07 23:14:07 +00:00
Ahmad Samir
37fcf98d42 QStandardPaths/Unix: fix logic in xdgDataDirs() function
This method correctly ignores relative paths (as per the XDG basedir
spec), but checking the list of dirs is empty should be moved to after
splitting the env var, because even if the env var is not empty, if the
paths in it are all relative the resulting list will be empty.

Drive-by change: Split some code to a static helper, which will be
used in xdgConfigDirs() too.

Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Change-Id: If894751ba68b24ccc214f9a4bb2099be3f0e4349
(cherry picked from commit ee515dd842d79fa4543568ed82bd7c949923e438)
(cherry picked from commit 668560f8bd13bd1478c1837ef0dc0eb33f6445f9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-07 22:34:42 +00:00
Fabian Kosmale
7ddba3c23f Fix proxy-data handling
This addresses two different issues:
- Firstly, we were casting the resolved binding data pointer to
  QPropertyProxyBindingData, instead of the d_ptr of
  QPropertyBindingData. Fix this by introducing a helper function,
  and consistently using it to access the proxy data.
- Secondly, we were not resetting the originalBindingData when the
  pointed to object was destoyed. Fix that, too.

Task-number: QTBUG-110899
Change-Id: I7691c9df5cc26e761f6b0e5f16d152f7f2183208
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 55ca636180db2b7870b5b519c4163487b672a9f1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-07 21:27:51 +00:00
Albert Astals Cid
2230c13445 dbus: Register QDBusObjectPath
Fixes: QTBUG-108822
Change-Id: Ib6d1a9cfc449df80cb7e5ad6211b07bdfd556093
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d619a952cdcdf0a0ca163e8513f0843f8bc9c2dc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-07 21:15:29 +00:00
Ahmad Samir
be51d1fda3 QStandardPaths/Unix: minor cleanup
- Better readability by returning early
- Make a QRegularExpression static const so that the regex pattern is
  compiled only once

Change-Id: Ic0d6bd4b068624c4ff60c6e71d09f20393adaa64
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 482a75fef9643220366029862dbf636a88bccb82)
Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
(cherry picked from commit f4eacea72bd1e248faa40d15a77c8f49a6b4d81f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-07 20:24:02 +00:00
Topi Reinio
27fa5bfef4 Doc: Update copyright year in the template
Fixes: QTBUG-110271
Change-Id: I70ce5356941d2499a219ab9fb1875df23acda3dc
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
(cherry picked from commit 275d510ce322a2cbacaa7879bc3d90fdf785cef3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-07 20:24:02 +00:00
Giuseppe D'Angelo
a24b18ebcd XCB: do not use reserved identifiers
Any identifier starting with underscore followed by a capital letter is
reserved for the implementation in C++, so don't use them. Rename the
entries in the Atom enumeration by adding an "Atom" prefix to them.

Change-Id: I059e2093149f39cc9324cd1159c0d9e076eda93a
Reviewed-by: JiDe Zhang <zhangjide@uniontech.com>
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 3d72e8829fb9ebcd3b1179b54ad4053de05368ff)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-07 20:24:01 +00:00
Friedemann Kleint
dbb5c588b8 uic: Generate string-based connections for QLCDNumber::display()
There are still ambiguous overloads of display(), which cause PMF-syntax
to fail.

Task-number: QTBUG-110952
Change-Id: I0887a5a06b026e4d5a20ef732d5892c8ac7fb6db
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
(cherry picked from commit 94c16517b3f8f01309a89598e698931ef77d60db)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-07 17:49:53 +00:00
Marc Mutz
77b8b56680 Fix narrowing in Qt::endPropertyUpdateGroup()
decltype(QPropertyDelayedNotifications::used) is qsizetype, not int,
so don't use int to count from 0...used.  The notify() and
evaluateBinding() functions use their int argument only for pointer
arithmetic, so this is completely self-contained.

Amends fdedcb6ec650236bef4a8c8f005b5dd24ef7d77a.

Task-number: QTBUG-103532
Task-number: QTBUG-110710
Change-Id: I765a06628d330fbb57a2fbecc96d66690bb62f13
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit d257a56c93e58028031c41daf90d3d4e8f317846)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-06 01:26:21 +00:00
Christian Ehrlicher
00c4f12d4e SQL/ODBC: Pass correct length to SQLColAttribute()
This ensures the tst_QSqlQuery::record() test passes when checking the
tablename.

Change-Id: I146f9f627ea366c6813af61ce48b930ca1041b15
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9ea00c70fbbe61d4c2da98c3d9390bfbada157bd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-05 09:09:07 +00:00
Roland Pallai
322fba3a61 QXcbConnection::getTimestamp: do not return stale timestamp
The problem is `PropertyNotify` event generated by
`xcb_delete_property()` at return could be reported as an actual
timestamp at next call due to a missing `state` filter.

Because `PropertyNotify` is generated even if an unchanged property
value is set we can get rid of this delete event easily.

This issue causes observable problems in kwin_x11 (KDE project)
too.

Fixes: QTBUG-56595
Change-Id: Ice6cfa934e3769d86e9f7264e369dc5918c8542a
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: JiDe Zhang <zhangjide@uniontech.com>
(cherry picked from commit 03ac8c7397b9f070a8ef5f33b4675411293b0723)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-03 21:34:56 +00:00
Marc Mutz
c73833ab52 QCryptographicHash: fix UB (data race on concurrent result()) [2nd try]
The previous attempt at fixing QTBUG-110058,
ccad719d2e935306e601b0f6af5ff2acb7cd272e, was incomplete:

- the if (result.isEmpty()) check at the beginning of finalize() was
  not protected, so it raced against the assignment at the end of
  finalize(), which was protected

- because the mutex was not locked during the finalization of the hash
  algorithm, two threads could perform this operation simultaneously,
  which isn't such a bad idea in principle, as it can reduce latency,
  but for that to work, the losing thread needs to throw away its own
  work and adopt the work of the other thread, but that wasn't done:
  both threads would write their result to 'result', just one after
  the other, but that's still a data race, since the eventual _reader_
  of the result cannot be protected (is outside the class). Besides,
  we don't even know whether the algorithm-specific finalization
  functions are ok with being called from separate threads on the same
  context object

- in addition, the mutex wasn't necessary when finalize() was called
  from the static hash() function, as no sharing could possibly take
  place there (the state is function-local)

Fix all of the above by largely reverting the first attempt, dragging
the result.isEmpty() check out of finalize() and into resultView() and
instead simply holding the mutex over these two calls in
resultView(). To see why this is sufficient, consider that
resultView() is now idempotent again: the result is written once, the
next thread waits and then finds the work done. All following accesses
to the result are then reads, which happen-after the write at the end
of finalize().

The accesses to 'result' from reset() need no protection, as reset()
is a mutable function, and calling a mutable function on a shared
QCryptographicHash object is already UB. Only two const functions may
be called that way.

Manual conflict resolutions:
 - missing OpenSSLv3 code in 6.4
 - different order of Private member fields

Fixes: QTBUG-110058
Change-Id: Ia8ac095b785519682090801c1012e9dded6d60b2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b904de43a5acfc4067fc9e4146babd45c6ac1138)
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-02-03 20:14:28 +01:00
Edward Welbourne
7fe0f175d4 Use case-insensitive comparison to compare codec with UTF-8 and utf8
Given that the two candidate "counts as UTF 8" values for codec differ
in case, it seems prudent to use a case-insensitive comparison, in
case we hit UTF8 or utf-8.

Change-Id: I279f83eafa90dd2685c306144c99ec97177d1d3b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 75ae8869fb171493e4d5163910ef3a2034902c7d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-03 14:11:18 +00:00
Edward Welbourne
dc7efa92ad Remove QResourceGlobalData::resourceSearchPaths
The means to add entries to this QStringList were deprecated in 5.13
and removed in Qt 6, so the list is always empty and the one place
that still references it only needs to check the empty path it adds to
the list.

Change-Id: Ie1b3f13b33c04458bd03a4a1e3db0e33a76e89f6
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 21cb05bef7e852480975b92026e196c3fbf24228)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-03 11:06:47 +00:00
Tasuku Suzuki
5a1039c1c9 Fix android build with -no-feature-settings
Add QT_FEATURE_SETTINGS to the android deployment conditions.

Change-Id: I7721a06733becba65b6d1e8112fa8afb0b64e120
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit f54fab6125d79903ebabae1b52423ac984800d26)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-03 02:09:41 +00:00
Andreas Eliasson
58fc19b683 Doc: Only list qt core classes in qt core io group
The group page for Qt core classes related to I/O include classes from
other modules. Remove these classes from the group; it may confuse
the reader.

Fixes: QTBUG-110020
Change-Id: If7df85523ce6b3aa09605bd89d9899ce308d2671
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
(cherry picked from commit 76ecff6aebb35f4e39439aab8d18d828c3c8a1fd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 22:52:12 +00:00
Marc Mutz
bb35230991 Q_APPLICATION_STATIC: add missing std::launder()
Unlike Q_GLOBAL_STATIC, a Q_APPLICATION_STATIC can be destroyed and
re-created multiple times (if QCoreApplication is, too). This means
we're basically in the std::optional case and require std::launder()
to avoid UB when the payload type has either of the following:

- a const member
- a reference member
- a vtable and different derived classes might be occupying the same
  space at different times

While we can probably exclude the latter, because we always construct
the same type, PlainType, in the storage, the first two can easily
happen.

Fix by adding the missing std::launder().

As a drive-by, remove the uneeded casting (and now launder()ing) of
&storage when passing to innerFunction(), which anyway takes its
argument as void*.

Amends 81a31beeb25eaf14d5c5f42fe26aa49d6ef29bf8, which changed
Q_APPLICATION_STATIC to use inline aligned_union storage instead of
the original implementation's unique_ptr.

Change-Id: I065bd33812a40195109bf11d5bc79975f2f87cd5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c53fdcb5ee15c309ba68717fa6564dc1ff4b8618)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 22:45:40 +00:00
Thiago Macieira
02a03f28f5 QMimeDatabase: don't stat() something that isn't a local file
We must check that the path is an actual file on the filesystem before
using native APIs. This regression was introduced by commit
047d8f36de45ebb318726167f941b0dbc64754ba.

[ChangeLog][QtCore][QMimeDatabase] Fixed a regression from 6.4.0 that
made certain QMimeDatabase functions that inspected file contents to fail
on Unix systems, if the file was not a native file (e.g., a Qt resource).

Fixes: QTBUG-110707
Change-Id: I570832c9ac8b4e03bde8fffd173f7b4c6b164192
Reviewed-by: Igor Kushnir <igorkuo@gmail.com>
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 40dd38813cba4bc8425e846f220e358ffb0d19ac)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 20:17:36 +00:00
Sze Howe Koh
30786ef596 QAnyStringView: fix MSVC warning C4702
The previous fix attempt at 8ba8d1346a562347c398bdd0529d34f94f2ac698
does not work when C++20 mode is enabled.

MSVC optimizes away the "else" block but triggers warning C4702 on
"return true". Moving the return line into the "else" block ensures that
it is optimized away too.

Change-Id: I9ef02cd3631ff78091530b6fb2b91c2eddcbab5d
Fixes: QTBUG-104836
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Yuhang Zhao <yuhangzhao@deepin.org>
(cherry picked from commit 4bfdf6a3d156184579e9fc66224754a6e66159dd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 13:53:41 +00:00
Samuel Mira
9b8777d493 Android: fix height calculation
The application height calculation relied on the Display.getMetrics to
obtain the size of the current app window. It works properly on stock
android and Samsung devices, but not on some Huawei and it's unknown on
other vendors. This patch changes the way the height and weight are
calculated by using the provided values.

Task-number: QTBUG-107604
Task-number: QTBUG-109268
Task-number: QTBUG-97503
Task-number: QTBUG-107923
Task-number: QTBUG-109351
Task-number: QTBUG-110501
Change-Id: I0b0d1a0e4688f10530054afd26e34f55a92ea2da
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 48ebd4e318d5fb2d7ffe4b8215cd16cf5638215e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 11:40:05 +00:00
Marc Mutz
aaf1381eab SQL/ODBC: fix some users of toSQLTCHAR() to not assume identical UTF-8/16/32 string lengths
We already fixed the implementation of toSQLTCHAR() in
66767eea46bea0f19f8ae5ad6ebc641d86867701 to not assume that a UTF-8 or
UTF-32-encoded string has the same number of code points as the
equivalent UTF-16 string, but it turns out that users of the function,
as well as other code, also failed to account for this.

This patch fixes callers of toSQLTCHAR() to use

    const auto encoded = toSQLTCHAR(s);
    ~~~ use encoded.data(), encoded.size() ~~~

(except we can't make `encoded` const, because the SQL API isn't
const-correct and takes void* instead of const void*) instead of the
anti-pattern

   ~~~ use toSQLTCHAR(s).data(), s.size() ~~~

As a drive-by:
- Extract Method qt_string_SQLSetConnectAttr()
  - skipping an unneeded .utf16() call (a NUL-terminated string is not
    required for calling toSQLTCHAR())
- de-duplicate some code in exec()
  - and make a comment there slightly more informative
- replace
  - NULL with nullptr
  - size() == 0 with isEmpty()
  - C-style with constructor-style casts

Change-Id: I3696381d0a93af8861ce2b7915f212d9e5e9a243
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 46af1fe49f7f419dc1b3231de9860e2da0ea48f8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-02 08:05:39 +00:00
Friedemann Kleint
d4c76a683f Examples: Add missing include guards
Task-number: QTBUG-109394
Change-Id: I09a1b522d0faeb2346e1e075141f1e810c8155f7
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit ddb94dd7927126978fc2a620ebd91954e2f96862)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 20:52:02 +00:00
Axel Spoerl
379649dd8b Add right and middle mouse button to tst_QLabel::mouseEventPropagation
The test function used only the left button to test mouse event
propagation.

This patch adds the right and middle buttons to the test data.

Task-number: QTBUG-110055
Change-Id: I02683168216843919e889987a8b0e8a0f1592d3a
Reviewed-by: Doris Verria <doris.verria@qt.io>
(cherry picked from commit 593ffd3859b2c80c498baf5323906a348de22b80)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 18:11:42 +00:00
Allan Sandfeld Jensen
802dfb1879 Avoid unneccessarily long text scans
Limit the scans to the processed length.

Fixes: QTBUG-109838
Change-Id: If4b19bf6f97d788d0a227af3a80962bef26016fd
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 7c84550f3bfdf93cb8a071e6bb23d54d57109e84)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 18:11:42 +00:00
Ilya Fedin
a765c10436 Pass short time format to GetTimeFormat from GetLocaleInfo
TIME_NOSECONDS doesn't really switches to short time format,
just removes the seconds from long time format

Fixes: QTBUG-110627
Change-Id: Ie799958f3942c657f00bc8196588258661ddc1d9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 763884cfb7be0cadd353cfa3b9b760d521851718)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 18:11:42 +00:00
Tor Arne Vestbø
8eee5acfb2 rhi: Remove manual release of autoreleased NSString
The [NSString stringWithUTF8String:] function returns an autoreleased
object, so we don't need to manually release it. Doing so results in
a crash when the surrounding autorelease pool is drained.

Change-Id: I3dca01e2771d4010e582c2bf770f3d2281343dc3
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 780813d9b6bfc58aa45571c367071c3a44fb2b44)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 13:46:11 +00:00
Axel Spoerl
28c0af6dc3 Revert "Fix tst_QWidgetRepaintManager on XCB"
This reverts commit f20f1c6b7c65285a78ae7381bd7d2d1a4bdc3d30.

Reason for revert: Intended fix didn't work

Change-Id: I527307ad9c82d2d591e32bea172b6fe54a628008
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-02-01 13:46:11 +00:00
Marc Mutz
ef3e5f0f98 ODBC SQL driver: fix conversion of QByteArray to QVLA<SQLTCHAR>
The QByteArray is assumed to contain an SQLTCHAR string (so, either
UTF-8, UTF-16 or UTF-32-encoded). Only in the UTF-8 case would the
size of the byte array be the same as the size of the SQLTCHAR string
in codepoints, yet the size in bytes is what the code passed to the
QVLA<SQLTCHAR> append() call, causing it to read past the QByteArray
buffer in the UTF-16 and UTF-32 cases.

Fix by properly calculating the string size from the size-in-bytes and
then memcpy()ing into the QVLA. We use memcpy() and not
QVLA::append(T*, n) because the QByteArray buffer need not be aligned
on an alignof(SQLTCHAR) boundary (certainly not since it gained the
prepend "optimization").

Change-Id: If3838c3dee89e6aca65541242642315b8e1fa6b4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4c445ef0bae8b36ec4a742552f0ebd81a1a90723)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 13:46:11 +00:00
Nicholas Bennett
7253f6cac0 Docs:Android: Add docs notes about support for content Uris
Add some details about the support of Qt apis (QFile, QDir, QFileInfo)
for Android content uris.

Fixes: QTBUG-99664
Task-number: QTBUG-98974
Change-Id: I4b884623702ccad116d47049e34ccddfe21f83ca
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
(cherry picked from commit a0ca5f433fdc45e97e461ece2d9839eebd3c7ea0)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-02-01 13:46:11 +00:00
Tasuku Suzuki
481f1e1a75 Doc: remove {{ }} for an enum value
https://doc.qt.io/qt-6.4/qurlquery.html#encoding

Change-Id: I328274d37182d3884bc65b8bccfec5052c1dce8e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b33016a4927e0b7df2b4183583b0b57719060e6c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 10:20:54 +00:00
Mitch Curtis
041f440c6a Doc: explicitly mention C++ when discussing linking to C++ libraries
Fixes: QTBUG-108325
Change-Id: I7282c8a8df0bf8f403a4e7a9d4512e7bdf6c9979
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit f2b22a2945e19b191a2299bc7d0ebcf4b2bf2c69)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 10:20:54 +00:00
Vladimir Belyavsky
b75ab76624 Windows: fix warning on opening FileDialog after changing filters
Destroy native file dialog on Windows as soon as it closes.
Currently the instance of native file dialog on Windows may stay live
even when a FileDialog control was closed and won't be opened anymore
in the app session. At the same time, when the FileDialog is opened
again, the instance of native file dialog is recreated so we don't
need to keep previous instance, because this may lead to situation
when QQuickFileDialog configures old instance of the native dialog,
which is causing problems.

Fixes: QTBUG-61042
Fixes: QTBUG-77211
Change-Id: Ia537264e8494b83dec7d5139744838242b281f1f
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit de704b633d4f9469a868e86fc22b8d99ef61eacb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 07:51:02 +00:00
Inho Lee
ba259ef0f3 Free the GLX framebuffer configurations
Adds missing XFree for a glXChooseFBConfig

Change-Id: I4c30341f90666170dac5d90b0c65d1deff4e0818
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit da898fca026f629be0ed234f0a89a99bc662385d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 07:51:02 +00:00
Christian Ehrlicher
8be65ba913 QToolButton: Elide text when constraints prevent from showing whole text
Follow-up of b2a282d7c7b8f49819bbc86ed705980438ecb04b - elide the text
also when the QToolButton has no icon (=text only)

Fixes: QTBUG-64132
Change-Id: If4d3758452f37df411931a6628846988a3418d8e
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 021906f6c985b838461d28c7f121d4c3bc7e6499)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 07:51:02 +00:00
Shawn Rutledge
cf2f8235d5 Make tst_QFocusEvent::checkReason_ActiveWindow pass on macOS
It seems that on macOS 13.2 and newer, it requires explicit activation,
just as on the offscreen and minimal platforms.

Task-number: QTBUG-110703
Change-Id: I519eec872505ea3673111ae300c2494113f85c36
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 78ba5056e63c4fc6f61346807197920fb5049924)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 05:23:37 +00:00
Thiago Macieira
e9b42b8579 QRegularExpression: fix count() when the RE matches a surrogate
When the match finds a surrogate pair as the first true Unicode character,
then we need to skip both code units of the pair in order to restart the
search. PCRE2 does not allow us to search for individual UTF-16 code
units.

That actually means that counting "." gives us the count of Unicode
characters.

Fixes: QTBUG-110586
Change-Id: I194d0a32c94148f398e6fffd173d5b5be8137e19
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit b22ae069ac193cfa0479d0bc258a860ef00816b4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-01 03:38:15 +00:00
Yuhang Zhao
63fe358f99 Windows QPA: also consider window flags when judging frameless or not
It's possible that the window has the WS_THICKFRAME flag but the
Qt::FramelessWindowHint is enabled at the same time. That usually
indicates the user is customizing the window, but it will also
confuse QPA's current logic. We can make the logic more roboust
by reading the Qt window flags as well.

Change-Id: I9894e312a92ef7f5fc0aa93974f216b67fe2cf29
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 17ab11ce493477f891916351b6ac0f0a8ad28ca6)
2023-01-26 12:33:09 +00:00
Thiago Macieira
44854ab85c QUrl: restore empty-but-not-null for components that are present
This got lost during the QStringView port that happend in Qt 6.0
(commit 548dcef08976649c820054f3db1ad108c72439cd) because
QString::operator+=(QStringView) does not copy the nullness of the right
side, whereas QString::operator+=(const QString &) does.

Fixes: QTBUG-84315
Change-Id: Ide4dbd0777a44ed0870efffd17399b772d34fd55
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit a14a3a5487675a231b912e9a5ae575357d1c2cf8)
2023-01-25 09:20:25 +00:00
Marc Mutz
db1ba05320 ODBC SQL driver: deal with different sizes of SQLTCHAR correctly
Neither the UTF-32, nor the UTF-8 recoding of a UTF-16 string is
necessarily of the same length as the input. The UTF-32 version may
be shorter, if surrogate pairs were encountered. The UTF-8 version
will be longer whenever the string contains non-US-ASCII characters.

Split toSQLTCHAR() into three functions, templated on sizeof(SQLTCHAR),
and use QVLA's range-append instead of manual memcpy()s.

This patch specifically doesn't use constexpr-if, as that's not
available until C++17, which Qt 5 doesn't require.

Change-Id: I0bfcb66eb321598908ef00ac34c888fdbccf9316
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 66767eea46bea0f19f8ae5ad6ebc641d86867701)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-25 08:46:25 +00:00
Edward Welbourne
87a176a8b3 Restore Android-conditioning on nl_langinfo() definition
QCoreApplicationPrivate::initLocale()'s check that the selected locale
is UTF-8-based was added with an initial work-around for Android,
specific to NDK <= 15, which Qt 5.15 did not support.

Later the Android-specific #if-ery was changed to test for Qt taking
UTF-8 for granted, for a given reason having to do with QNX; and later
the #if-ery for that was removed. However, we still support versions
of Android that lack nl_langinfo(), so restore the Android #if-ery.
It presently seems that NDK 26 (Android 8) does contain nl_langinfo(),
so we should be able to drop the nl_langinfo() kludge for this and
later versions. That way we'll at least use the real nl_langinfo()
where we have it.

In the process, fix the indentation of #if-ery.

Change-Id: Ie9e83c3397955c24cea1e9a9ff6bb0187e47dda2
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 10117f78d72498e19683e69b439ca7c931532261)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-24 18:48:31 +00:00
Sze Howe Koh
86abefbf4b Doc: Fix usages of deleted QVariant constructors
Finish the job started at 879d30394a41b7b7124fc8139e787a9bdbe0dfee

Change-Id: I217a4830ac8e17d5d1f8900e2d3134fbabf8b9a2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit a97dbbd1a023fb4a0b7a518fad0ad9edbf1f23f4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-24 18:48:29 +00:00
Assam Boudjelthia
d4d46148b6 Android: add build dirs/files of Android templates to .gitignore
Those files/dirs are only build time generated by IDEs like Android
Studio or gradle builds, so ignore them.

Change-Id: Ib4785f9cc75412825d5be4cb5fe206587f37d193
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit b49e2bb0849ed423e68398d5a10a3cc079bff589)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-24 15:01:17 +00:00
Oliver Wolff
3ae0e8a021 Introduce qt_winrtbase_p.h
Due to a bug in earlier Windows SDKs developers have copy paste
a workaround whenever they are including winrt/base.h. In addition to
that our usage winrt API also forces them to include
qfactorycacheregistration_p.h whenever they include that file. To make
things easier all that magic can now be done with one single include of
qt_winrtbase_p.h.

Change-Id: Ic6a80d6d3723af381cf0ecc0f0ab43c2e6839a7d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit b2c1237b4512480a17009afe1981af02c2a9869e)
2023-01-24 11:28:53 +01:00
Eskil Abrahamsen Blomfeldt
f6e3ea4f73 Fix assert when resizing text table with percentage widths
Since Qt 6.3.x, qBound() has started asserting that max > min.
This caused a crash in the QTextDocumentLayout code for assigning
widths to table columns that were sized using percentages, which
depended on previous qBound() behavior of just snapping to the
minimum size if max < min.

There are some specific conditions for this to happen: First
of all, the available width in the table must be too small to
fit all minimum widths (which is calculated based on content).
In addition, the requested widths have to be given as
percentages of the table width, and these have to add to
something lower than 100%. With these conditions, you may get
a case where the calculated percentage width of a column is
larger than the minimum width, but lower than the remaining
width in the table, causing the assert in qBound().

We simply accept the minimum width as the rule in these cases,
which matches behavior without the assert and which looks
correct when resizing the window to be smaller than the table.

Fixes: QTBUG-108183
Change-Id: I16d18dd9b2e7a77fe86d1a353b426075b5050b8e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
(cherry picked from commit 84a68ef75ce8a8e5b90d799c90905cc998c7c2f6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-23 11:31:36 +00:00
Lorn Potter
43500a1e66 wasm: use uintptr_t for uint32_t
This helps get ready for wasm64

Change-Id: I6db5b93c7ca851cab7fc95701b27a20263c8c0bd
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit d3be345a368941cc8e6b13851168d85354cc3e3c)
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2023-01-23 10:33:35 +02:00
Axel Spoerl
c5479c9b2c QWidgetTextControl: Ignore unconsumed mouse release events
QWidgetTextControlPrivate::mouseReleaseEvent() has early returns
implemented, e.g. when link has been right clicked or no selection
anchor has been found. These early returns, however, still consume
the event.

This leads to events getting lost instead of getting propagated:
As an example, a QLabel with rich text uses QWidgetTextControl. While
it propagates mouse press events back to its parent, mouse release
events get lost. A QLabel with plain text propagates both events
back correctly.

This patch adds QEvent::ignore() to the early return.
Since no test class exists for QWidgetTextControl, it adds a test in
tst_QLabel.

Fixes: QTBUG-110055
Change-Id: I950f8c3f135793b01c59832835bb429db2282169
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7689d4ad2f673317af432aae498da74d13703126)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-21 16:04:31 +00:00
Christian Ehrlicher
2779ba3276 SQL tests: Fix for PostgreSQL 12 and above
The 'WITH OIDS' was deprecated some time ago and removed with
PostgreSQL 12 so we have to adjust our test table creations. Don't know
why it was used in the first place at all.

Change-Id: I6e18ac01e64368b1dd64e02bcb75fa70e05467a3
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 87662bcf107e65c04f933f212f4c8cad6692f948)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-20 15:31:53 +00:00
Marc Mutz
da6e6861c1 QVarLengthArray: fix off-by-size() bug in growBy()
The growBy() function takes the _increment_ of the size(), so needs to
add size() to increment for the call to realloc().

Add a test which hangs (vanilla build) or explodes (valgrind build)
without the fix.

Amends 26b227e128475da3f88a6b34921a08994bf71cf4.

Done-with: Eirik Aavitsland <eirik.aavitsland@qt.io>
Fixes: QTBUG-110412
Change-Id: I7ea91342fdcb779825c88013a3f86ba6d90ef530
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 51e5a2376a8a2956665ff4c3a0e86c8cd9d0847d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-20 15:31:53 +00:00
Thiago Macieira
81ed4430e4 QUrlQuery: fix operator== for emptied object case
If an object had elements and then was emptied, it will have a non-null
d pointer, which wasn't taken into account in the comparison.

Fixes: QTBUG-109840
Change-Id: I69ecc04064514f939896fffd17376aa18184653c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3d584b1093cdb6245b02eda996db2927ffaf09ea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-20 05:58:42 +00:00
Mate Barany
9e8dcaa1e3 [doc] Warn users about data races regarding qt_ntfs_permission_lookup
qt_ntfs_permission_lookup is a non-atomic global variable that is prone
to data races. Make a remark about this in the documentation.

Task-number: QTBUG-105804
Change-Id: If7c64f3ab7d2c3b1487fe56204a4e66c420b0604
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 696ad54e5d76dd063cbb02d0c288fdece6ee75d0)
2023-01-18 21:51:56 +00:00
Tor Arne Vestbø
c759af9981 Respect custom QWSI event handler when delivering synchronous events
Fixes: QTBUG-110268
Change-Id: I25195904cfc18d593db1be713b6e899e55eb922f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 2813e2814e185bf8d2426c5eb3d6b2c243ee72c3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-18 19:13:05 +00:00
Thiago Macieira
9f9d022916 CMake: make qt_config_compile_test verbosely indicate missing deps
This alone isn't enough:
  Feature "xcb": Forcing to "ON" breaks its condition:

      QT_FEATURE_thread AND TARGET XCB::XCB AND TEST_xcb_syslibs AND QT_FEATURE_xkbcommon_x11

  Condition values dump:

      QT_FEATURE_thread = "ON"
      TARGET XCB::XCB found
      TEST_xcb_syslibs = "FALSE"
      QT_FEATURE_xkbcommon_x11 not evaluated

But when it says:

-- Performing Test XCB (extensions) - Failed because XCB::CURSOR not found

The user can know what to do.

Change-Id: I810d70e579eb4e2c8e45fffd1719c0abf608ed30
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit caecb17248a88434faf533ceef81d3b5f5e79335)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-18 19:13:05 +00:00
Assam Boudjelthia
1fd8ad388d Android: delete dead code for tst_android under tests/auto/other/android
This amends 23780891a50ba678714f7e0a4cf43a0f8164b440 which moved the.txt
test to tets/auto/corelib/platform/android and kept the old location
mistakenly.

Change-Id: If58422f9a94cfe4d6a941cc5453d8f0506057dcb
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit c7b93d471d763b5e7986305deb4d0d83d7b69068)
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-01-18 16:16:17 +00:00
Assam Boudjelthia
627f0cb6e0 Android: use signature-less jni syntax for AndroidContentFileEngine
Task-number: QTBUG-98974
Change-Id: I1e8e102282af2877bbbe6e8018b7649fac66804e
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit ba3db0cacdea95ca91d0b3984b4e65c43a17a9bb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-18 16:16:17 +00:00
Marc Mutz
85e5ff806c QStringView: remove pointless Q_ASSERT in toString()
QString and QStringView have the same size_type these days.

Change-Id: I59ffe78f51e06ccc130562b1682fb4a672c3ec22
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 8ef22183d67e0e7a8ad00bc0ea48c41510eb84ce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-18 13:30:52 +00:00
Assam Boudjelthia
b59e89c907 Android: pass EXTRA_INITIAL_URI to native FileDialog
Allow setting the initial directory where the file dialog
will be opened.

Change-Id: I1395b367c74d28fb2890ac53a90456c3ac4c1b05
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit 609e14724edfd8d8cef23c5f30ad7812a359ed8d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-18 10:16:38 +00:00
Marc Mutz
17c6ee5a26 QVarLengthArray: cope with vector<unique_ptr>'s copyability
Despite being move-only, std::vector<unique_ptr> advertizes
is_copyable:
  https://quuxplusone.github.io/blog/2020/02/05/vector-is-copyable-except-when-its-not/

Our combined reallocation and resizing function, reallocate_impl(),
runs afoul of this when it uses std::is_copyable in a constexpr-if to
implement resize(n, v) without running into problems with move-only
types: the trait is true, but actual instantation runs into a
static_assert in the STL implementation.

To fix, move the problematic resize functionality out of
reallocate_impl() and into the resp. resize_impl overloads. The shrink
functionality remains in reallocate_impl(), because there are many
more users, and it only requires destructible<T>, which isn't
constraining at all.

Amends a00a1d8806cfbf17e04b88d1b4ff4a9cf5b6294a.

Fixes: QTBUG-109745
Change-Id: Ibc5b9cf5375108eb3d8f6c8a16d4fd02dadd73b1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 800ebd84f57092ccba24984f3888f97bb5433d8e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-17 01:12:38 +00:00
Tor Arne Vestbø
283d5c96ec macdeployqt: Don't remove rpaths more than once
In a universal build the tool will find multiple duplicated rpaths,
but the install_name tool doesn't like it if we try to remove it
more than once.

Fixes: QTBUG-109738
Change-Id: I4a8bea0ad3e47b28e6384ceead551edc83e30d26
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 9a2198f9cdd5df482c64a52cb5d1e372ac24610c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-16 11:46:34 +00:00
Amir Masoud Abdol
073bc79b50 Use the Windows path separator in a Batch file
Patching inconsistent path separator in Batch file. This at some point
may lead to something similar to the mentioned task.

Task-number: QTBUG-109857
Change-Id: I36c05dc7a0b7daf3dc5dced61f3c3f7d90eb59e3
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 07a978c756cba6953bf81497fa3a386793652242)
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2023-01-16 08:29:45 +00:00
Timur Pocheptsov
5da2292bff QWidgetTextControl: deal with empty formats list properly
Do not call first on it. A regression was introduced by
56f0ebfe860e440dcbba8997f44836debc901119.

Fixes: QTBUG-110070
Change-Id: I7c969da889b6c7ad3a67149fe99ca47830683073
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 0cd153b2681437b91f07315a27238446cc24363f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-13 16:21:11 +00:00
Volker Hilsheimer
9bbf761373 QFormLayout: don't access out-of-bounds layout data
When rows are hidden (implicitly or explicitly), then their layout data
does not get fully updated. If rows get hidden after the layout data has
been calculated once, then we must make sure that their indices are
reset. Otherwise we might access array indices that are out of bounds
when the layout data structure gets resized to fit only visible rows.

For good measure, skip entirely over hidden rows when accessing the
layout data when arranging the widget.

Fixes: QTBUG-109237
Change-Id: I4d6943b6a110edb61f60ce78d31f0fc64b5cc03d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit c3a5fe2fd7a1b8a6b6133c938ffe6b3f30181bf0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-13 13:50:11 +00:00
Alexey Edelev
934735822a Set GenerateDebugInformation to true in vcproj if at least /DEBUG is set
If the command line option contains /DEBUG without the following
argument, GenerateDebugInformation remained 'false' because the
DebugInfoOption contained the initial value.

Set GenerateDebugInformation to 'true' if the /DEBUG option is found and
reset to 'false' only if option is set to 'none'.

Amends commit 6a6b27940d497b29672ff65ff242fe0211603f22.

Fixes: QTBUG-110068
Change-Id: I792d7335d8b9536d4beed54cabfd70dcf54f09ac
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 0e3ef4111271761ede6cbbeb3b0fa075a483085e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-13 13:50:11 +00:00
Kai Köhne
818ce40e10 Doc: Fix qt_attribution.json files using Path for files
Since qttools commit 39fdcb8e7a, qtattributionsscanner fails
if 'Path' is not a directory. Use the 'Files' attribute instead.

Fixes: QTBUG-110002
Change-Id: I65fecdcb852ce9abea55f168cd939804bae9ae80
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 2c78c5d4569d89c204857ab007f9e260b219d624)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-13 10:50:06 +00:00
Friedemann Kleint
bd99d02123 QtSql: Disambiguate typedefs
They cause clashes in CMake Unity (Jumbo) builds.

Task-number: QTBUG-109394
Change-Id: I3f94044671cdbd0a1bb0964bf291e36508223b50
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit d9d74723cc4b369f41530aff5b500d93779d5e32)
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2023-01-13 07:58:29 +01:00
Marc Mutz
938712a996 QVarLengthArray: Extract Method growBy()
Separates the actual reallocation use-cases from the resizing ones
when calling reallocate_impl, in preparation for fixing QTBUG-109745.

Task-number: QTBUG-109745
Change-Id: Iee0c3e56569ec7877beda8db3a645e2bbb6b4d4a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 26b227e128475da3f88a6b34921a08994bf71cf4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-12 20:57:40 +00:00
Marc Mutz
5e3940dbd8 QVarLengthArray::resize_impl: don't default argument, overload
Separates the resize(n) and resize(n, v) code paths in preparation for
fixing QTBUG-109745.

Task-number: QTBUG-109745
Change-Id: I49808ce4dc2f1de0de6af120990b2e00edb47728
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7c5ff43ea322422f03f6b87768d825f2df6f1652)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-12 20:57:39 +00:00
Thiago Macieira
7ad34e714d QCryptographicHash: add a mutex to writing to the results
QCryptographicHash::result() and resultView() are const, therefore two
threads can call them on the same object. Given that the finalization of
the hash is not a trivial operation but doesn't modify the state, let's
do it without a locked mutex, onto a temporary stack buffer. Then we lock
the mutex to copy said result to our cached value.

Fixes: QTBUG-110058
Change-Id: Ide4dbd0777a44ed0870efffd17394bf72785eabb
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit ccad719d2e935306e601b0f6af5ff2acb7cd272e)
2023-01-12 12:57:39 -08:00
Friedemann Kleint
d3596c07e1 Add missing header guards
Task-number: QTBUG-109394
Change-Id: Idc5b0057d41186c8dfd7e752fe819ebebc6f8859
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit aa29b3ef523d3f9d3e52942464d82cd58283c783)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-12 20:57:38 +00:00
Joerg Bornemann
b41b27352d CMake: Add switch for allowing missing Qt6*Tools packages
Consider a cross build of Qt with qtbase, qtshadertools and
qtdeclarative. If a user projects only links against QtQml without
creating an actual QtQuick module, no host tools from qtdeclarative are
needed.

Normally, find_package(Qt6Qml) pulls in Qt6QmlTools and errors out if
it's not found. By setting QT_ALLOW_MISSING_TOOLS_PACKAGES when
configuring Qt, one can disable the error and build a user project such
as the one outlined above.

Fixes: QTBUG-109547
Change-Id: I45e727713912d19e6007a7fbf3d61533f82b71d9
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Jaeyoon Jung <jaeyoon.jung@lge.com>
(cherry picked from commit 94e474b48e9d3c6434339afe166c2329f8c36ea2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-12 16:46:38 +00:00
Thiago Macieira
0cd48a0bc8 tst_QAlgorithms: don't use random numbers in the test row names
Just describe the row instead. We'd lose the original input in case of
failure, so I added a class to print that value on destruction. Example:

FAIL!  : tst_QAlgorithms::countLeading64(0) Compared values are not the
same
   Actual   (qCountLeadingZeroBits(value)): 63
   Expected (expected)                    : 64
   Loc: [tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp(374)]
QWARN  : tst_QAlgorithms::countLeading64(0) Original value was 0x1

Fixes: QTBUG-109958
Change-Id: I69ecc04064514f939896fffd1738b1119cd80cf8
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit d0408b5f13f811f73cf2485b5b31d5ec4b7f2b62)
2023-01-12 08:46:37 -08:00
Edward Welbourne
e7e179aabd tst_QAlgorithms: fix misleading indent in data table
A violation of coding style (requiring braces on multi-line bodies
of conditionals) was accompanied by a mis-indented else block.
Fix a long line while I'm about it.

Change-Id: Ibe9cf15eadbe9ef58138d7876e5e2c5a14a92fd4
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 0d915623ecef9d81f25c3891101b68384331233d)
2023-01-12 08:46:37 -08:00
Edward Welbourne
47088e0150 Clean up tst_QAlgorithms::count{Trail,Lead}ing_data_impl()
Pull out the arbitrary factor of three as a named constant and
document its arbitrariness once.

Pull out the mask and bit used in each function's loop to the outer
layer of the loop, since they don't depend on the inner loop variable
(or the random value generated in that loop).

Use QTest::addRow() instead of constructing a string to pass to
newRow().

Change-Id: Ifacbcb390e00828fd47f51b0c73d0ad5f6bc8bdb
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit ce950bcbf7f6cf3bd5bf5113e7b70016f0d60492)
2023-01-12 08:46:36 -08:00
Thiago Macieira
7ec591d124 QCryptographicHashPrivate: standardize on quint8
So we don't have to do these reinterpret_cast everywhere, as most of the
APIs we're calling take unsigned chars themselves. The reinterpret_casts
will be removed in the next commit, which needs to modify those lines
anyway.

Change-Id: Ide4dbd0777a44ed0870efffd17394f9f25062122
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 2d7a27b918ff576dbd8ec8b3aecaa45f8c78fa5e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-12 13:25:55 +00:00
Eirik Aavitsland
47b3f967d6 Fix deletion order also for QImageReader/Writer::setDevice()
Avoid dangling or incorrect device pointer during handler
destruction. This was recently fixed in the destructors, fixed here
also for the setDevice() functions.

Change-Id: I85b64726cd88d2c8e63eee59d5b4f2ae488df61b
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
(cherry picked from commit 5633cb69f68ca3d3b82476f9025d863f804e76c1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-11 20:32:56 +00:00
Liang Qi
3f7a73adb5 qxcbwindow.cpp: Fix sign-compare and another warnings
qsizetype(int32 on 32bit, int64 on 64bit) vs uint32.

qxcbwindow.cpp: In member function 'virtual void QXcbWindow::setWindowIcon(const QIcon&)':
qxcbwindow.cpp:1300:30: warning: comparison of integer expressions of different signedness: 'qsizetype' {aka 'int'} and 'uint32_t' {aka 'unsigned int'} [-Wsign-compare]
 1300 |         if (icon_data.size() > xcb_get_maximum_request_length(xcb_connection())) {
      |             ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
qxcbwindow.cpp:1301:53: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 3 has type 'qsizetype' {aka 'int'} [-Wformat=]
 1301 |             qWarning("Ignoring window icon: Size %llu exceeds maximum xcb request length %u.",
      |                                                  ~~~^
      |                                                     |
      |                                                     long long unsigned int
      |                                                  %u
 1302 |                      icon_data.size(), xcb_get_maximum_request_length(xcb_connection()));
      |                      ~~~~~~~~~~~~~~~~
      |                                    |
      |                                    qsizetype {aka int}

This amends ebdaf8ef9cea6f3669fc73bc3395acf2e497f7fc.

Fixes: QTBUG-109610
Change-Id: I2c9b5ad27881658463dd0870639c42d3ea8e7aba
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit ec787ce14363c843f9c1149bad8045ff6acbcf1c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-11 20:32:56 +00:00
Friedemann Kleint
8b47858231 Documentation: Port code snippets to new connection syntax
Task-number: PYSIDE-2182
Change-Id: I5f800cf3a4a7afefbc36a79372fc35449fa953f0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 8fccba0e63f9484866398e77a7e8ee54ed80a0a2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-11 14:20:17 +00:00
Amir Masoud Abdol
23475c7cf1 Disable PkgConfig for Android
We decided that it's better to disable PkgConfig for Android, as it is
unlikely that someone uses them.

Task-number: QTBUG-110007
Change-Id: I6ae1059ddd05feeec047fbb906c7dba1586e816b
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit e6693163e5e40668bc4cc5155003c173eea83273)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-11 12:48:59 +00:00
Timothée Keller
4642a6706d Windeployqt: change qml import handling
Made it so that qml dependencies will be imported for all invoked
binaries, rather than just the first one.

Task-number: QTBUG-99125
Change-Id: I0d97905c59281a03ef2126ae1c436f1034e1575d
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 2a732020ff58b6a779e0b374af5f8cd0f6e22459)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-11 12:03:10 +00:00
Juha Vuolle
1d1fd94a99 Adjust the SDK/API version check for getInsetsController()
The function is introduced in API level 30, causing an error
on a 29 device

Amends: eda4049a0142029c192e1690bafffbb98ee4ff99

Change-Id: I5f4e2301d04a0a2e0e2f4037e4c371efd2fef352
Reviewed-by: Bartlomiej Moskal <bartlomiej.moskal@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 40cb7434afe28c4dbe434a35b659e1af5299a3d9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-11 07:42:32 +00:00
Ivan Solovev
b506bff7d0 QPromise: improve documentation snippet
The multi-thread snippet in the documentation, when copied as is,
could actually crash because of the race condition between the main
thread and the thread that generate results for the promise.
This is fixed by explicitly calling QPromise::start().
Actually, the underlying snippet already has this call, it just was
not included in the documentation.

This patch modifies the documentation snippet to include calls to
both QPromise::start() and QPromise::finish().

Fixes: QTBUG-109230
Change-Id: Ic25f31a6b3b16ba6bc06a0b199289c8c5d50bab6
Reviewed-by: Sona Kurazyan <kurazyan.sona@gmail.com>
(cherry picked from commit a8261e327d6316d944cfcc312a1b2e71bd4e5d27)
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-01-10 10:23:19 +00:00
Timur Pocheptsov
e1575269e3 TLS backend SecureTransport: properly clear SSLContextRef
Simply calling SSLClose on context is not enough. Properly clear
the context by calling 'reset' member-function.

Change-Id: Ic6a32f6e4193bb19809d1cce184651b78d6273a7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 6128a92e07c0c66c29445c2d79c3b6bdbf8efcda)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-10 10:23:18 +00:00
Axel Spoerl
f20f1c6b7c Fix tst_QWidgetRepaintManager on XCB
Due to an XCB library change, QXcbBackingStore::toImage() cannot be
safely assumed to return an image identical to QWidget::grab().
The test functions fastMove(), moveAccross() and moveInOutOverlapped()
relied on QXcbBackingStore::toImage() and failed.
They were backlisted on Linux/XCB.

This patch obtains a screen shot instead of an image from the backing
store on XCB platforms. It processes events until the screen shot
matches QWidget::grab(). It makes the test fail only if the comparison
times out.
The patch also removes the BLACKLIST file, containing only the test
functions mentioned above.

Fixes: QTBUG-109036
Change-Id: I26dd5b89dc62b313db066a285f6ad7d4d92baaf2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 4096667d6601dcbc5e713e6b0fd5b5218453c4cb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-10 10:23:18 +00:00
Marc Mutz
7b0fc393a0 Move QTypeInfo<std::pair> from qpair.h to qtypeinfo.h to avoid ODR violation
First off, this doesn't cost us anything, because std::pair is defined
in <utility>, which qglobal.h unconditionally includes in C++ TUs.

More importantly, it prevents ODR violations: when a TU includes only
qtypeinfo.h, it will find std::pair<int, int> to be of Q_COMPLEX_TYPE,
in constrast with a TU which includes qpair.h, which will find it to
be of Q_PRIMITIVE_TYPE instead.

[ChangeLog][QtCore][QTypeInfo] The QTypeInfo for std::pair/QPair will
now be correct even if qpair.h hasn't been included, fixing an
One-Definition-Rule (ODR) violation.

Change-Id: I51f579c123183af25aac9f0ffcf077f752848fb1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f6b026eed1a4a3441ba9b1b92a9eaf2c17d69253)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-10 03:09:30 +00:00
Marc Mutz
26d560c01e tst_QSqlRecord: replace manual memory management with unique_ptr
Also replace the C array with a std::array and (some) indexed loops
with ranged-for loops. Most loops need the index in one way of
another, so can't easily be converted to ranged.

Change-Id: I7fa05f22de9df6c68ec5797c9583476a3881532c
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 70e070ecbd4d334598aed140a3825887733c3c59)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-09 21:21:23 +00:00
Liang Qi
5e31131df8 QOffsetStringArray: fix -Werror=type-limits
GCC complains:

  qoffsetstringarray_p.h:85:27: error: comparison is always false due to limited range of data type [-Werror=type-limits]
     85 |     if constexpr (Highest <= (std::numeric_limits<quint8>::max)()) {
        |                   ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fix by casting the RHS (of limited-range type) to size_t, the type of
the LHS.

Fixes: QTBUG-109875
Change-Id: I494ea544b8b3bfd877443119eebc160eb2f8e063
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit cf145a34b494e08a10271de277f6c4e62b54ea4f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-09 19:38:07 +00:00
Volker Hilsheimer
4ae329dc64 tst_Gestures: Don't accumulate global state
(Un)Register the custom recognize in init() and cleanup() instead of
initTestCase() and cleanupTestCase(), so that a new recognizer is used
for each test function.

In the test functions, use a scope guard to unregister the locally
registered recognizers to make sure that in the case of a failing test
and early return, the recognizer is removed.

Change-Id: I4fe9509f35474514ef55191d799e6707199fe853
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 58afdea1b32899cc4ee8bf2062596ed523bbdffe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-09 19:38:06 +00:00
Topi Reinio
0b461bfefd Doc: Fix linking to 'Drag and Drop' topic
Linking to 'Drag and Drop' target will link to a page local to Qt
Widgets with that section title. The intention is to link to the
topic page located in Qt GUI module.

Add a descriptive keyword to the correct target page and use that
for linking.

Fixes: QTBUG-109289
Change-Id: Ib6a39b43f9080cf5bb72fb07ab163e75eefb4da9
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
(cherry picked from commit 8a30b22930d3a3d15fba97ff7aec7f812721869e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-09 18:10:30 +00:00
Jaishree Vyas
8045282c32 Link update for Data Input Output in the save game example
Change-Id: I2a886766d59b9e75f42e401fca9c258fcbe02809
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
(cherry picked from commit aae855bd6f87533590b5f91ab7104276d58763ce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-08 16:31:28 +00:00
Friedemann Kleint
8d7227460f Documentation: Clarify the meaning of the precision parameter for double formatting
Move it to the table for QLocale::toString() to make it more prominent.
Explain the meaning for QTextStream::realNumberPrecision().

Change-Id: Ic2da22ff6bea09e79e17f19b4636cef35dc3a615
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit fe4cc2793f80e285be66c36bc1ec6903ddcd312e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-08 10:08:27 +00:00
Yuhang Zhao
03da3363a8 Update the documentation of QScreen::name()
Task-number: QTBUG-109569
Change-Id: I24ed586e9094e7cd2277c6289ffbd4210dd6e430
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 9af5a70c55c9ec85113303fb48af405304335d1a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 21:28:35 +00:00
Thiago Macieira
d4efc8af94 QUrl/doc: explain that the scheme-less URL is probably not intended
It is a valid URL reference, which is not what people may want.

Fixes: QTBUG-109855
Change-Id: I69ecc04064514f939896fffd173783ce2228c1d2
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit ce8fc1e88eef63308781d601dd10f694622abf95)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 17:31:52 +00:00
Sona Kurazyan
5fed09633d Fix crash when cancelling a QFuture that has continuation with context
To support cancellation of continuations attached via the parent future,
we store a pointer to continuation future's data in parent. This
requires preserving the lifetime of continuation future's data while the
parent is still alive (see 24dedaeaa1a94bfe9ade2da2a2c9aa112241b07a).
This is achieved by capturing the promise in the continuation's lambda,
which is only cleaned up after the parent's data is destroyed. This is
already the case for continuations without context, but was overlooked
for continuations with context: they transfer the ownership of the
continuation promise to lambda passed to QMetaObject::invokeMethod(),
which destroys the lambda's context after it's run. As a result, the
continuation's promise (and data, if there are no other copies of it)
is also destroyed, leaving the parent pointing to deleted continuation
data.

To fix this, capture a copy of continuation future's ref-counted data in
the continuation's lambda. This will guarantee that the continuation
data remains alive until the parent is destroyed and the continuation
is cleaned up.

Fixes: QTBUG-108790
Change-Id: Ief4b37f31e652988d13b03499505ac65c7889226
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 9e61cc4f72a4fe86fa97f64238f1e3d940a7746b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 15:30:40 +00:00
Andy Shaw
d045fe1f51 SQLite: Update SQLite to v3.40.1
[ChangeLog][QtSQL][SQLite] Updated SQLite to v3.40.1

Change-Id: Ic17019f65083b24238025fe6ea6ee9872ac783fe
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit cac325fdc11a409473bd13a758de608eb3df1540)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 15:30:39 +00:00
Jannis Xiong
c3b3329adf Fix cache maybe invalid while the signal is actived from queue
with default QObject::connect signal may active from next message loop. invalide cache will hit while accessibility interface is called from windows. Invalide cache will lead to a crash

Fixes: QTBUG-106653
Change-Id: I5359672bcd60ed6cfb2edf238645225164cb1b88
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 80f44954f6872afb5aa37e6737c3e1ac68ad3577)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 15:30:39 +00:00
Eirik Aavitsland
d0af61981b Fix potential corruption with image format conversion on arm neon
For tiny scanline lengths, even the initial offset to align on 16
bytes may overflow.

Fixes: QTBUG-109477
Change-Id: I198c6fa5a2551a951893515f905bb7cc35479608
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 7eccd7ac1c98e0c15c0b4a13d036a5ef46896d8a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 11:48:31 +00:00
Julian Greilich
5be8837e24 Android A11Y: Only access the main thread when it is not blocked
When the qtMainLoopThread calls QSGThreadedRenderLoop::polishAndSync(),
it waits for the QSGRenderThread.

In the QSGRenderThread, QAndroidPlatformOpenGLWindow::eglSurface()
calls QtAndroid::createSurface() and waits for the "android main
thread" to return a valid surface.
When the "android main thread" now calls "runInObjectContext" (e.g. by
calling QtAndroidAccessibility::childIdListForAccessibleObject()) it
waits for the qtMainLoopThread and the program is stuck in a deadlock.

To prevent this, we protect all BlockedQueuedConnection from the
"android main thread" to the qtMainLoopThread by acquiring the
AndroidDeadlockProtector.
When QAndroidPlatformOpenGLWindow::eglSurface() already acquired the
AndroidDeadlockProtector we abort the current A11y call with an emtpy
or default value.

Note: b8a95275440b8a143ee648466fd8b5401ee1e839 already tried to fix
this by checking "getSurfaceCount() != 0", but there are situations,
where a new surface is being created while an old surface is still
present.

Task-number: QTBUG-105958
Change-Id: Ie40e8654c99aace9e69b0b8412952fa22c89f071
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit b832a5ac72c6015b6509d60b75b2ce5d5e570800)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 11:48:31 +00:00
Axel Spoerl
78b5f41555 Skip tst_QWidget::optimizedResizeMove and ..._topLevel on wayland
Wayland omits optimizations tested in tst_QWidget::optimizedResizeMove()
and optimizedResize_topLevel() under certain circumstances, e.g. on
Ubuntu 22.04 / Gnome. This makes the test functions fail.

This patch skips the test functions on wayland platforms, if an
omission is detected.

This amends 2ec7a6322f465ad7cce3c48096d8912903196ab2.

Fixes: QTBUG-109746
Change-Id: If0df6b1cf451a7f0dccfc1bb7411e895d7ae29a3
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit df62cefdcb0ea6f644f1560285598ed179bb2bb2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 11:48:31 +00:00
Leon Zhang
e4b6b5076d Add resetTransform to see also of setTransform in QGraphicsView
Change-Id: I4a38d44f2109f8b92069651c23717da02f5b3091
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 0d251afddafe3a5f88af048868b89bcc56aeff06)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 11:48:31 +00:00
Alexey Edelev
9d7131f5ef Move '--sign' argument to the end of the androiddeployqt command
The '--sign' argument may and may not accept two follow arguments
to specify signing path and alias from the command line. This
functionality breaks the parsing of command line arguments that
follow the '--sign' argument and expect that '--sign' is used with
no follow arguments. It does make sense to check if the arguments
passed after the --sign staring with '--' to make sure that '--sign'
with no arguments is meant to be used.

Fixes: QTBUG-109619
Change-Id: I4ee7fe953e5378c00760d84ec58f9e89e4348944
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 9c56a77027db2fedfc2b50f96ceaee5003a7d383)
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-01-06 12:48:30 +01:00
Alexey Edelev
1f323d2167 Allow specifying CMakeLists.txt as the argument for qt-cmake-standalone-test
qt-cmake-standalone-test uses add_subdirectory call when evaluating the
project. This leads to an error if users try to use path to
CMakeLists.txt as an argument, instead of directory when configuring
standalone tests with qt-cmake-standalone-test. It makes sense to check
if the user-specified path points to CMakeLists.txt and cut the
filename part when calling add_subdirectory.

Change-Id: I6b9ac0ca8323eaf11f219eb1e6bed3057120a231
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 90806123e961d469c36ee3b19ac0960524abb9e2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 08:06:57 +00:00
Axel Spoerl
91bff47d31 Add comment to tst_QWidget::saveRestoreGeometry() for debugging
saveRestoreGeometry() somtimes creates a 29px offset when debugged in
Qt Creator, which makes the test fail.

This patch adds a code comment to make developers aware of this fact.

Change-Id: I920bd02eb7543faf8b25a0a242b888f3a3745e2a
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit efb74636567d9eff3366e439faf37eea5d6d3668)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 05:37:18 +00:00
Tor Arne Vestbø
65b93df96a macOS: Include text in key events triggered by insertion key-bindings
In 705665957baf16f9ec4d256dd4d2fad98788314b we started relying on the
input method to decide whether a key event should include the resulting
text or not, based on the assumption that text insertion would happen
via the insertText:replacementRange: selector.

But the NSStandardKeyBindingResponding protocol includes several other
commands for inserting content, including insertTab:, insertBacktab:,
and insertNewline:.

  https://developer.apple.com/documentation/appkit/nsstandardkeybindingresponding

We explicitly handle the latter, but for any command we didn't handle,
we concluded that the input method didn't want us to insert text, and
sent the key event without text, which broke tab character insertion
in text edits.

As long as we're not handling these commands explicitly, we adjust
the logic to treat any command starting with "insert" as an unhandled
request to insert text, and forward it as a key event with the text
included, as before 705665957baf16f9ec4d256dd4d2fad98788314b.

Fixes: QTBUG-109754
Task-number: QTBUG-106393
Change-Id: I4a164bc809c3606b43f267514a66ff017efeb4af
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7e7bae35f758acba45257d1cb4229d5bc43b07ca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-05 15:34:58 +00:00
Paul Wicking
eb841b3c7d Doc: Drop link to deleted page
The standard accelerators page was deleted, drop the link to it.

Change-Id: I2fa9a94200d0e5f8895bb8c6981c73b3e9dd159e
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit f10ae4b887f6652dcad95516ded43f2e2994e88f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-05 14:09:57 +00:00
Joni Poikelin
a37c31405d Fix a warning about extra semicolon in qstylepainter.h
Change-Id: I104037ff58ade4b2ceffd73687355a5d237ab571
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 7584871f4dab0cd8560603025217b7026568d81f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-05 06:01:52 +00:00
Eirik Aavitsland
aa769d8d1c Fix deletion order in QImageReader/Writer destructors
The device would be deleted before the image format handler, and hence
be a dangling pointer that could easily cause a crash if the handler
or codec would access it on destruction, e.g. for cleanup.

Change-Id: I51d16b1feddc5945955ac75a2e8701233dba7b82
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
(cherry picked from commit f091026be1deb4b4a90f32585b9b22f97209866a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-04 08:09:41 +00:00
Marc Mutz
2ab5df8847 QWindowsKeyMapper: make the code locale-independent
The C toupper function is locale-dependent. Given the right locale
(Türkiye, e.g.), toupper(i) is either

- İ (LATIN CAPITAL LETTER I WITH DOT ABOVE; if representable) or
- i (unchanged; if it isn't)

The latter is clearly wrong. The former might be what is wanted, but
since most locales these days are UTF-8, Í will be unlikely to be
representable in char.

So I conclude that what's intended here is that i gets mapped to I,
even in the Türkiye locale, so use the new QMiscUtils::toAsciiUpper()
instead of <ctype.h> toupper().

Fixes: QTBUG-109520
Change-Id: I6fee2fb15c2facae79f1727455180567698fed80
Reviewed-by: Samuel Ghinet <samuel.ghinet@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 7a6016aec4fdb446bd4f515fe7c08e1496cd2a7c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-03 20:31:32 +00:00
Liang Qi
52cf04379b ibus: support high dpi for cursor rectangle
on both X11/xcb and Wayland.

Following similar approach in QFcitxPlatformInputContext::cursorRectChanged()
https://github.com/fcitx/fcitx5-qt/blob/master/qt5/platforminputcontext/qfcitxplatforminputcontext.cpp#L490-L532

Tested with following configurations:
* GNOME on xorg, 100%/125%/150%/200% scale, 1 and 2 monitors
* KDE/Plasma X11, 100%/150%/200% scale, 1 monitor
* GNOME on Wayland, 100%/200% scale, 1 and 2 monitors

Enable fractional scale on GNOME:
gsettings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer']"

Fixes: QTBUG-103393
Change-Id: Idfd3153e4cd9f9530b4db6f089830ec47451a19e
Reviewed-by: Ilya Fedin <fedin-ilja2010@ya.ru>
Reviewed-by: Weng Xuetian <wengxt@gmail.com>
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 3790821b220ff6ab3c51a5c0b35581c00bc4e84d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-03 11:08:04 +00:00
Liang Qi
f0028627de ibus: add SetCursorLocationRelative in InputContext.xml
Task-number: QTBUG-103393
Change-Id: I90c48a0d698636ed289d6f6c1485875e2e91fb34
Reviewed-by: Ilya Fedin <fedin-ilja2010@ya.ru>
Reviewed-by: Weng Xuetian <wengxt@gmail.com>
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 54002671bd68b1c59b61a630c9333b2aab286483)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-03 11:07:56 +00:00
Liang Qi
420b8c0169 tests: skip tst_QComboBox::cancelClosesPopupNotDialog() on Wayland
QWindow::requestActivate() is not supported.

This amends c95de359b4fe7bc03f7defdb057ebbe79c51b3dd.

Task-number: QTBUG-107153
Change-Id: I45f53b5e9de85049ca41cc139a78a82450f53bed
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit f09f516ac149a723d3b00b8ecc746c12eb970465)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-03 11:07:55 +00:00
Axel Spoerl
6a0336c48b Stabilize tst_QSpinBox::sizeHint()
The test function used to flake on Linux occasionally.
8e6ede7cd131682161180bfab0cc46686674709b provided a fix. While it
seemed to work, further analysis has shown that the root cause is
event sequence in case of multiple paint events.

This patch re-engineers the test function:

1. Allocate test widget on the stack instead of the heap.
2. Send layout requests posted by QHBoxLayout constructor and
QLayout::addWidget() before showing the widget.
3. Remove calls to QCoreApplication::processEvents().
They are unnessecary, because
- the size hint request counter is supposed to increase (by any number)
- QTRY_VERIFY processes events anyway until the counter increases or it
times out.

Change-Id: I54998483725cbdd4899ba6f5469d7dae0980ab1d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 71e67dec957d41d55ae03f32613a80394c928352)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-03 09:57:36 +00:00
Andreas Eliasson
1550761a49 Doc: Fix broken link
Also, adjust line length to be < 80 columns and make link
parenthetical.

Fixes: QTBUG-107026
Change-Id: I5f7efa5d572103a6fb432d79a52a57363efd9dd7
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
(cherry picked from commit b556d6227f848d42a10d4f0fc5424bd094e56288)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-02 13:51:09 +00:00
Jani Heikkinen
48438514f1 Bump version to 6.4.3
Change-Id: I4cd14d079db749dbad0670cc1e20afd505e83e41
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2022-12-30 11:07:03 +02:00
Giuseppe D'Angelo
fb2bb95019 QTypeInfo: fix pointer detection
Although redudant, people are allowed to use Q_DECLARE_TYPEINFO on a pointer
type. There's no reason to mis-detect the isPointer trait in that case.

Change-Id: Ic116f24397c91f5a3d31f5d8ee9fa2e587823257
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 114b94c26e990c792f2735b1104dd094ada714f6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-30 05:20:37 +00:00
Axel Spoerl
8188408e1e Fix size calculation of unplugged dock widgets
When unplugging a dock widget, it still grows by the separator size
when dragged upwards or to the left. The unplugged dock widget's size
can become too small to drag it or to access window handles.

This patch corrects the size offset for all drag directions. It expands
the target size to a minimum size, making sure that title bar and
window handles can be accessed after unplugging.

Fixes: QTBUG-106531
Change-Id: Ie771a9338ebfb4c0eafd3b3b4205de730cbd20ac
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit e29ffd3bd13dbc1e808cfc4f7764878f855d1a62)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-29 17:58:52 +00:00
Axel Spoerl
bc6566b801 Use minimum size for in tst_QDockWidget::createTestWidgets
tst_QDockWidget::createTestWidgets did not set a minimum size for
test widgets. Upon unplugging, that can lead to a size correction in
connection with 8687c3f938cac56c4a2518576a5c9fac150d8de1, if the widget
gets too narrow to correctly display window handles. Test functions
checking the size after unplugging can fail in that case.

This patch sets a minimum size to each test widget created. The minimum
size corresponds to QStyle::PM_TitleBarHeight.

Task-number: QTBUG-106531
Change-Id: I3e552b37416d57d8ed30e0b9de4eec55f07ea158
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit c69e727274adae7d3943587091254696c46fb75b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-29 17:58:52 +00:00
Giuseppe D'Angelo
09f8b1f24b Wait conditions example: fix an incorrect condition variable usage
3a449bbb69c9a3c3a5bc6a052f2de98ab79be7e9 amended the code to remove
acquiring a lock when waking up a condition variable. It is fine to
not have a lock associated when waking a condition variable; what I
misunderstood was the scope of the lock, which (and this underlines
the importance of commenting _what exactly_ a lock protects, for
each and ever lock) protected both the buffer as well as the counter
of the buffer. This made my reasoning flawed: it is necessary to keep
the lock while notifying, otherwise the counterpart could verify the
condition isn't satisfied and wait (e.g. see numUsedBytes==0), missing
the wake from the other thread (which could arrive between the check and
the wait).

Amends the previous commit.

Change-Id: If7db2d045331f1b33b976fb6bf6aa9117c41678f
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit fddeec60cba806b88c5eb0e4758c3951457518a2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-29 15:24:07 +00:00
Marc Mutz
2d035d50c8 tst_QStringApiSymmetry: fix a typo and deal with the fallout
Turns out we don't support QStringView/QUtf8StringView comparison, and
the only reason the corresponding test succeeded was because it
contained a typo (QStringView instead of QUtf8StringView).

Fix the typo and disable the now-failing test.

Change-Id: I2210a247aac66743851e53578172a563ee1e96f7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 92e913a5414ea3a7fb002a139251bb8ae53c467c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-29 13:38:41 +00:00
Morten Sørvig
d0c0a48884 wasm: avoid LocalStorage past-the-end access on clear()
We were looping over all keys and removing the Qt keys
using an integer index. However, removing one key shifts
all other keys at higher indexes down one step such that
the loop eventually indexes past the end.

Fix this by getting the keys first in a separate step,
and then remove keys without relying on a stable iteration
order (which is also not guaranteed by the standard).

Change-Id: I8bc577d1831d6931ebca2b2e04faf65c9affb429
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 8a20a278fa5f1e2890f88a69d8b5f96873a67ac9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-28 21:20:56 +00:00
Marc Mutz
a6ea94cc3e Fix UB (reference to local variable leaving scope) in runOnAndroidMainThread()
The QAndroidApplication::runOnAndroidMainThread() function creates a
task on QThreadPool::globalInstance() to wait for a timeout and cancel
the QFuture representing the task.

It does so by passing a lambda to QThreadPool::start(std::function)
that captures the future, a local variable, by reference. This is UB
when the lambda is ever executed, because the local stack variable's
lifetime will have ended.

To fix, simply capture the future by value, not by reference. Since
QFuture::cancel() is not const, we need to make the lambda mutable.

Fixes: QTBUG-109586
Change-Id: Icacfb0dc76bcd3a145f90126f535e7c0f4b5ef6a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit 3642d5680df8a1b70e4a1a111347005e08555070)
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-12-28 09:44:56 +01:00
Axel Spoerl
5ad1d0b83a Stabilize tst_QSpinBox::sizeHint() by explicitly calling setLayout()
The test function places a QSpinBox in a QHBoxLayout, which has a
QWidget parent. The spin box is expected to be shown with the widget.
While the widget is the layout's parent, the layout is not explicitly
set. That makes the test function flaky in some cases.

This patch adds QWidget::setLayout() to explicitly set the layout on
the widget.

Change-Id: I3a1cc77c302c5ba96d3628d035139f9718dda9e5
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 8e6ede7cd131682161180bfab0cc46686674709b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-27 00:24:21 +00:00
Laszlo Agocs
e0d9005583 windows: gl: Fix WGL_SAMPLES reduction
The logic for writing 0 and false to the keys and values
is off by one.

While we are at it, unify the naming between the two settings
that are possible to reduce (samples and sRGB).

Amends d64f776a9a41a8d1144397b7b62efbdee8d24857

Fixes: QTBUG-109453
Change-Id: I97f3a3c7175bcb555c70967056ab2de45b077f48
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 3e619aff308dad02ee3d54aeda85a2bbaae77063)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-24 11:19:45 +00:00
Marc Mutz
ee981bac2a [doc] QSharedPointer: add some missing docs
Added docs for
- move-ctor, -assignment operator
- move-construction and -assignment from QSP<X>
- qHash()

There's more stuff missing, but I declare 'twas enough qdoc wrangling
for this round.

The texts are taken from other smart pointer docs, esp. QESDP, so
they're consistent.

Fixes: QTBUG-83134
Fixes: QTBUG-63700
Change-Id: Iff980d043e1635ed6cfdd3113c68bc23f3a0bad7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5dc0f52e7047ca5927e6741fda554cb090184b71)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-24 07:37:52 +00:00
Marc Mutz
655eb08578 QAndroidNaticeInterface: replace a pair with a struct
Nicer member names make the code using the type more readable. It also
allows to add other members later.

Change-Id: I69f1f97673a8f1ad8eb73e4f1e5323eccf929413
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit b6fdf34dfca20c8312feeb28efd3288700ad4b3c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-23 22:23:27 +00:00
Marc Mutz
9f0a75d264 runOnAndroidMainThread(): Don't block QThreadPool::globalInstance() with timout awaiters
A waiting task on QThreadPool::globalInstance() will block the worker
thread that it was scheduled on, making it unavailable for productive
work. That's why one should only put CPU-bound tasks onto
QThreadPool::globalInstance(). When blocking nonetheless, use the
releaseThread()/reserveThread() trick to avoid deadlocks caused by the
pool running out of workers.

So, do that here.

Task-number: QTBUG-109586
Change-Id: Ia2660c69e1f23b5df0c308576301aac6e05d4725
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit c0496013484c35ab9b1a29ffb0f1eb687ef6db78)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-23 22:23:21 +00:00
Marc Mutz
991b5dfe8c runOnAndroidMainThread(): Use QThreadPool::start() instead of QtConcurrent::run()
The latter is in a module (QtConcurrent) that depends on QtCore. Don't
make QtCore depend on QtConcurrent...

The code doesn't use the QFuture returned from QtConcurrent::run(),
anyway, so QThreadPool::start(function<void()>) is more than an
adequate replacement.

Task-number: QTBUG-109586
Change-Id: Id00a42525c3d7454a1fa2d4812de634dbbea1035
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 500e161987af24e2e10d46011d776258d5c0e47a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-23 22:23:18 +00:00
Marc Mutz
a3d8512fe1 Don't create a QRunnable in QAndroidApplication::runOnAndroidMainThread() w/o timeout
Creating a QRunnable is expensive business, incl. setting up
QThreadPool::globalInstance() if it wasn't set up already, so don't do
it for a no-op task.

Somewhat mitigates, but doesn't fix, QTBUG-109586.

Task-number: QTBUG-109586
Change-Id: If2043134414d68adc9188e5bb7650ca08046b4aa
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 26ea6157e6429a6ba0794272df195c0bc591cda9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-23 22:23:09 +00:00
Samuel Mira
c020e5fef7 Android: Fix UI is scaled smaller than before
The 413593183bbb1137fdc784d98c171d67a167bb32 patch changed the way
how the display metrics are retrieved. By doing so, it was found that
the previous way retrieved the scaledDensity always equal to density.
It is intentional for scaledDensity to be dependent on the font scale
chosen by the user. However, this change altered not only the font scale
but also the layout. This patch will make the layout dependent on the
density instead of the scaledDensity and normalize the way the display
metrics are retrieved among Android versions.
Currently, the fontScale is ignored, QTBUG-109566 will track future
developments.

Fixes: QTBUG-109026
Change-Id: I6adacd17583cbe9bee368af35c50b780872ab222
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit 99893a914a821567e10935ffb8be24df7147ccd9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-23 09:49:13 +00:00
Volker Hilsheimer
9242363fa6 QTextImageHandler: Resolve Nx images correctly for file or qrc URLs
The qt_findAtNxFile helper in qicon.cpp expects a local file name that
can be probed with QFile::exists. If the src attribute of an <img>
element specifies the location of the image as a file:/ or qrc:/ url
rather than as a local file name, then we need to strip the scheme
off the file path, and in the case of a qrc URL leave the :/ prefix
before calling the qt_findAtNxFile helper.

Amends, and partially reverts, 760df7256588e76d082ea959399af36d7ba80a86.
We can't avoid testing whether the source in the HTML is provided as a
URL before interpreting it as a file name.

Fixes: QTBUG-109212
Change-Id: I7ea7a5bfde79bab90a8025c42e754129813dd0fc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 2d87c4d881b74619fef966ffb0d7a00cb4ccea50)
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-12-23 07:48:27 +01:00
Volker Hilsheimer
8f19bab7b6 QTextImageHandler: Add test coverage for resources and URLs
If an image source in HTML is specified via local file name or resource
path (i.e. without qrc prefix), then the correct image is loaded.

With file:/ or qrc:/ schema however, the image is either not loaded at
all, or the 2x image is not loaded. The qt_findAtNxFile helper in
qicon.cpp gets a URL path, but expects a file path (that can be tested
with QFile::exists).

Task-number: QTBUG-109212
Change-Id: Ibcf687c69b3e53a10f21d718d28c8177a02d6be6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit c9cf4037cafe22aa20cfea6efe1c6a4c7211d21f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-23 07:47:43 +01:00
Volker Hilsheimer
c35691cd1c Enable and fix the test for QTextImageHandler
Amends 52ce0c177e80c2d5b70b38d429abb3689b3da51e, which added the test
without adding it to the parent directory.

Refactor the test code to be data driven, add the image files as
external test data files, and adjust the test code to find the files.

Use the QTextImageFormat from the document rather than a manually
crafted one, as otherwise we don't test a real usecase.

This also makes the test more flexible for adding qrc, resources, and
file URLs.

Task-number: QTBUG-109212
Change-Id: Id0771037b961d95ec3cadd0cd6467d2448f22884
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
(cherry picked from commit d8e213a9e6b3013f768cbf4d94878cd2a0f7bb79)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-23 07:47:33 +01:00
Topi Reinio
e64172efcd Doc: Remove incorrect CMake instructions for QtCore-private
Drop the use of \qtcmakepackage for the module page that results in
incorrect instructions, and replace it with a snippet with the correct
commands to use.

Fixes: QTBUG-109214
Change-Id: I936910ddb9e4118f931d85e4b096ad52006dcc32
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit 8844c6ef379f466a12a5f4981c78bdb990d92db8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-23 05:00:19 +00:00
Yuhang Zhao
90ced0fab6 GTK3 theme: simplify code
There's no need to first convert to QString and then convert back to
QByteArray.

Change-Id: Idedcf3143f44c640a9259f16e364dfe76ecf4c0d
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit e86a5f5f8b184562b5cde0da8882a2d8ebce84d5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-23 02:24:03 +00:00
Ville Voutilainen
ae6a3d6470 Skip QProcess tests when run under ASan
These tests exhibit weird crashes when run under ASan, but sometimes
they fail sometimes they don't. Pending more insight, just skip this
test under that configuration.

Fixes: QTBUG-109329
Change-Id: I49d940de419f7166aab0da0b8c2b44297c4b6d74
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c672f148dbf179f2e0ac94dfac7d329d50a3e4a3)
2022-12-22 09:04:14 +00:00
Bartlomiej Moskal
48c291f2b7 Android: Do not close the keyboard for NO_ENTER_ACTION
After commit cc9144b4f39923dfb9ee17f951f93f257aa2d221, virtual keyboard
is hiding after clicking the done button. This is expected behavior,
but not in case when imOption is set to IME_FLAG_NO_ENTER_ACTION[0]

This commit removes hiding keyboard in mentioned case.

[0]https://developer.android.com/reference/android/view/inputmethod/EditorInfo#IME_FLAG_NO_ENTER_ACTION

Fixes: QTBUG-107662
Change-Id: Id280c4a67e3940fce5045724f77284a77c886f06
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit abe3bc1c432e670fc1244a643b720c1b6a2d56f6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-22 06:49:19 +00:00
Jaishree Vyas
eb1b3594cd Doc: Increase Test Function Timeout
Documentation on QTEST_FUNCTION_TIMEOUT environment variable

Fixes: QTBUG-88652
Change-Id: Ib851eb2312088cf6b9ab277faa571757f4076ad4
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 46d2b45d2c33b066ee4ef31f5a44ee5c6b8bae73)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-21 16:49:03 +00:00
Assam Boudjelthia
808b29662a Android: handle move operation with content uris
Allow moving content uris if the destination is provided
a full content uri with a parent that's different from the
source content uri (i.e. different folders).

Note: since the underlaying Android APIs don't always know about
the parent of a uri, we do some step to deduce that, but that's
not always guaranteed to work.

Task-number: QTBUG-98974
Change-Id: If21954e5963f4eb0b96c7ccd983943ea2cab5b24
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit c203ec2720b694fd877512da531a227e0f3310cb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-21 12:39:18 +00:00
Assam Boudjelthia
5244c8df0c Android: fix deprecations for getDrawable() on QtMessageDialogHelper
Change-Id: Icd359663af11f44b4bcf0cd4e4f1f7f5a51242e4
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit 31a0d99fa565d39bf39f0c3ae5ed00859679a969)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-21 00:29:14 +00:00
Assam Boudjelthia
fe24040e90 Android: Fix deprecations AlertDialog.setButton()
https://developer.android.com/reference/android/app/
AlertDialog#setButton(java.lang.CharSequence,
%20android.content.DialogInterface.OnClickListener)

Change-Id: I470acba581b7226b2d4a56754cf6372baa167eb4
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit 40b42ac517c45beff3caf5e991c84739ac014912)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-21 00:29:06 +00:00
Bartlomiej Moskal
d6c932e001 Android: Fix for low contrast status bar
After we start to use THEME: Theme_DeviceDefault_DayNight, status bar
icons have low contrasts on some devices.

That is why we need to set APPEARANCE_LIGHT_STATUS_BARS[0] in case when
Status bar color is too bright.

[0]https://developer.android.com/reference/android/view/WindowInsetsController#APPEARANCE_LIGHT_STATUS_BARS

Fixes: QTBUG-108365
Change-Id: I38a31cfb0a3a1b912b86ed1b302c567e14a7ffcc
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit eda4049a0142029c192e1690bafffbb98ee4ff99)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-20 12:42:52 +00:00
Assam Boudjelthia
25b9567f0e Android: handle rename() operation with content uris
Allow renaming content uris if the destination is provided
as a direct fileName (i.e. not full content scheme path),
and if the destination has the same trailing path (or parent)
which means a rename in the same folder structure.

Task-number: QTBUG-98974
Change-Id: Ibc4973366807dd5284c19912ab04ff90f2a573cb
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit c1fa5d602c541b06e3e2fc2d02f5d62060c84504)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-20 12:42:50 +00:00
Oliver Wolff
4ae6183f4a Windeployqt: adjust bitset change for scaling (Take 2)
Important parts of 58861f78c0822f74744a3285abeb785219b8f96c were lost
during the cherry pick to 6.4.

Change-Id: I1a28aea60f4dc73a9eca0a3001aac0077a6bb759
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-12-20 10:00:57 +01:00
Ville Voutilainen
1620f6733b Skip tst_qconcurrentrun completely if running under an emulator
Task-number: QTBUG-106906
Change-Id: I1836f5be42528c71470c2cd6509f7125feb47691
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 413798cc01a3a2499c1f7683acdb68fd3466aae1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-19 15:31:33 +00:00
Ville Voutilainen
e65246b854 Autoclose a FILE* if we open it
Task-number: QTBUG-105736
Change-Id: I2bc10b54b77436cad914ec21fd85678c54de4305
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit f7559904d0e8f7966e726fd04801cb58a1bd4a2d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-19 15:31:24 +00:00
Assam Boudjelthia
af252e9bb6 Return the QFileInfo::baseName/QDir::dirName() from fileEngine impl
Get those values from the file engine instead, this is relevant
especially on Android for content uris.

Task-number: QTBUG-98974
Change-Id: I65fe4c59e5f1feed0dcf14cc8988b4a40d9d979e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f77668ffec48d8aaad7c74069c6f3e770a305ae1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-19 14:53:25 +00:00
Leena Miettinen
8e647d9f3b Doc: Add link to Tools Examples from the Qt Widgets module front page
The example docs were difficult to find.

Change-Id: Id7003b140275e722dad2c41767eabc24fef728e5
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit d77b5fbcf1225381c78cadf3c1d925f98ca93937)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-19 11:10:29 +00:00
Marc Mutz
81be57a99c QtMiscUtils: add missing toAsciiUpper(), use it in moc
... to make moc code locale-independent.

The C toupper function is locale-dependent. Given the right locale
(Türkiye, e.g.), toupper('i') is either

- İ (LATIN CAPITAL LETTER I WITH DOT ABOVE; if representable) or
- i (unchanged; if it isn't)

Both results are wrong for the present use-case.

Fix by adding QtMiscTools::toAsciiUpper(), complementing existing
toAsciiLower(), and using that. It's private API, but moc.h, despite
the name, is not a public header.

Task-number: QTBUG-109235
Change-Id: Iaf071ba2113b672aa0aed3da6a4e1d47fb659365
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b8c2a0c18a0676595946b5543ff88492a5fc7876)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-18 14:02:59 +00:00
Marc Mutz
f7381cecf4 tst_qmlstream: re-use QBuffer instance in readBack()
This improves the runtime of this particular test function by
almost 17% on my machine.

Change-Id: Icd77cdda92374b92121988c99e56787d405fa2d9
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 7fa6670fa4ff5a916477f14d5754f9337ec9f1a8)
2022-12-17 14:49:46 +00:00
Marc Mutz
92d13e933d QLatin1/String/View: don't decay the arg() arguments
This turns const char[] arrays into const char* pointers and
therefore prevents the implicit conversion of string literals
to QString in QT_RESTRICTED_CAST_FROM_ASCII.

Fix by avoiding the decay.

Also simplify the template magic.

Change-Id: I88164a1866ac71b41d9cd1564f3a5e83d2d42aaa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ba52b29d336cc32a462306d9011b75e9948c7040)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-17 12:40:40 +00:00
Marc Mutz
4a68590fb3 QTest::WatchDog: fix missing timeout resets on test function change
Since e0cad1aab53119a0e47467f2236f019ce8d6da2a, the code suffered
from an ABA problem where the TestFunctionStart expectation is set
in testFinished(), but by the time WatchDog::run() gets around to
examining the state when returning from condition_variable::wait()
in waitFor(), the next beginTest() has already set the expectation
back to TestFunctionEnd.

There are several known solutions for ABA problems. Embedding a
generation count into the expectation state seemed to be the most
straight-forward fix, and can be done without DWCAS support, because
the state is just 2 bits, leaving the other 30 or 62 bits for the
generation counter, so do that.

[ChangeLog][QTestLib] Fixed a bug which caused
QTEST_FUNCTION_TIMEOUT to be applied to the whole test execution,
as opposed to each test function.

Fixes: QTBUG-109466
Change-Id: If71ade932330407b85d204d45c74350c651325fe
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 26c190f57ea336106aeceffe1191a0314bb4443c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-17 10:53:29 +00:00
Marc Mutz
e6adca47d3 QTest::WatchDog: Extract Method setExpectation()
Keeps the code DRY and enables a follow-up commit to fix QTBUG-109466.

Task-number: QTBUG-109466
Change-Id: I2b904ea7b38286b07049524ba63c2c5028e680bb
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 17a7e5cfddcbf33ef0fd1c2b7acc65b85159194e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-17 10:53:27 +00:00
Mårten Nordheim
6acfa08745 Schannel: Don't emit error when peer performs graceful disconnection
Change-Id: Ie19a31fc61223d954badc704324adf4f5f7d361e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 3ff8629a0fbdf432086a47a1047d03ad457118c6)
2022-12-16 22:12:33 +01:00
Volker Hilsheimer
cdbc83eab8 QJniObject: fix binary compatibility breakage
Amends 601dbd64993fcbbb2ce6aaa95ef153ffd4f852b9, which changed the
signature of the private callVoidMethodV function. However, that
function got called in a public template member function, so callsites
depended on the private function to be present. By changing the function
signature, we broke binary compatibility.

Bring the original function back and implement the variadic overload
through it.

Fixes: QTBUG-109428
Change-Id: Ie2297e120fbeb146089c0fbe8f91f8b8d3c79713
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit f2b49789b2f9f9145d318a00868d2f054052aee4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-16 21:12:33 +00:00
Andy Shaw
3801ac5db5 SQLite: Update SQLite to v3.40.0
[ChangeLog][QtSQL][SQLite] Updated SQLite to v3.40.0

Change-Id: I7beb0bc9c1256f273d6011567c5ef3975ada5060
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit eac9f395175d7a80603ccf7ca9b431f1a4c7932f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-16 21:12:33 +00:00
Tor Arne Vestbø
418dcb3678 iOS: Don't assume screens will not be connected before QIOSIntegration
When an external screen is connected to an iPad, and the application is
starting up on that screen, we will get a connection notification about
that screen as part of the initial bootstrap of UIApplicationMain,
before we call the user's main().

Since we initialize and add all available screen on QIOSIntegration
creation, we can just ignore the early connection notification.

This avoids a crash, but the window will not show anything on the
external screen, which is a separate issue.

Fixes: QTBUG-106701
Change-Id: I9e0a9736bf602277316bd004e0d01c640feaf319
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit dd49793bc3b4dd3808f0f24b717c442a5095db14)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-16 21:12:33 +00:00
Tor Arne Vestbø
cbd9c0ed58 iOS a11y: Ensure parent elements are stacked below their children
The accessibility system on iOS does not support elements that are both
accessible themselves, and act as a container for other elements. You
either return YES from isAccessibilityElement, which allows you to
report accessible properties for the element, or NO, in which case
you can implement the informal UIAccessibilityContainer protocol
to report child elements. This was confirmed in Apple Q&A session
on accessibility December 14.

As Qt's accessibility system allow elements that are both containers
and have properties of their own, we can't build a hierarchy of elements
and containers, with only the leaf elements being accessible. Instead,
we let each UIView act as a UIAccessibilityContainer, and report the
entire child hierarchy as a single level of sibling accessible elements.

In doing so, we include elements such as the Window or Dialog that
root all the accessible elements. And apparently the order that we
report these elements back to iOS determine the z-order of the
elements, so we need to ensure "container" elements are behind
their children. Otherwise assistive technologies such as Voice Control,
or the Accessibility Inspector, will not be able to target the child
elements.

Fixes: QTBUG-108848
Change-Id: I5234bab2f14d5f368ae8c2672b051efcb80aa77d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 095604c9af90989957c974549bafdb0518c2ed3f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-16 17:30:14 +00:00
Marc Mutz
9a0b8c9072 tst_qxmlstream: swap WHEN and THEN in readBack()
WHEN writing an invalid character, THEN we expect the writer to report
an error.

The old code had it the wrong way around. It checked that WHEN the
writer reports an error, THEN the character was invalid.

The formulations are equivalent, but the latter is mixing up cause and
effect, making it less clear what's being checked (QXmlStreamWriter,
not isValidSingleTextChar()), so swap.

Change-Id: I703de9ddde98d9913977a913f671472930735900
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 7d0f08094a2318b753ea7d69b71c0abe0a46b3d3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-16 17:22:58 +00:00
Thomas Senyk
7e13d737a7 Remove QEglFSCursor's inheritance of QOpenGLFunctions
As QOpenGLContext can be destroyed
it's a bad idea to store QOpenGLFunctions
(which are QOpenGLContext bound)

This change remove the inheritance and replaces it with
querying the functions per call.

Change-Id: I2f3104b62f395f3e65337a15d0a0835383b66e16
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 6160635c9d0616882ae826c6166d1d583d66827b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-16 17:22:15 +00:00
Marc Mutz
db9d604357 QT_INLINE_SINCE: never inline for static Qt builds
Static Qt builds are not covered by BC guarantees, but since all
'libraries' are linked into a single executable, we face in all users
of the library the same ODR violation that we faced within the
implementation DLL: we can't define the same symbol as inline in some
TUs and out-of-line in others.

In the past, we decided to always inline in static builds, but that
breaks users which, by Hyrum's Law, have come to depend on the
non-existent BC guarantees for static Qt builds.

By switching to never inline¹ in static builds, we restore BC for such
users. The performance issues should be minimal, since LTO will anyway
inline whatever it wants, independent on how it was declared.

¹ except when the deprecation point has passed over the Qt version the
  API was inlined (-disable-deprecated-up-to configure switch).

[ChangeLog][QtCore] Restored binary compatibility for static Qt
builds broken by the QT_INLINE_SINCE mechanism. Qt still does not
guarantee BC for static build configurations otherwise.

Fixes: QTBUG-109449
Change-Id: Ie3fa62621b74dc5e9dac301b9882c0e3c3999eaf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 8602a224b6ade5680329270d8d573b786a7a81a1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-16 17:22:13 +00:00
Alexandru Croitor
a3569e4cdf qmake: Document that QMAKE_PRE_LINK does not work with Xcode
When generating an Xcode project using qmake that's targeting the new
Xcode build system, QMAKE_PRE_LINK does not work properly.
It generates rules that conflict with the default linker rules.
This is a limitation of the new Xcode build system which does not have
any known workaround.

Document the limitation.

Fixes: QTBUG-99601
Change-Id: Ie4e6bcb0603ced85f786e9f7f407172e84a00d83
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 5fe52a0420a50e0d0e78bb7ff5d7625443a43673)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-16 09:56:38 +00:00
Eskil Abrahamsen Blomfeldt
81f1611cc8 windows: Fix vertical metrics with GDI engine
In Qt 6 we consolidated vertical font metrics across all
platforms (see f761ad3cd9ad1252f24b76ae413298dc7bed8af3
and follow-ups). However, a couple mistakes were made.

First of all, when we use the winAscent/winDescent values
from the OS/2 table, we would also set the leading to the
line gap value from the HHEA table. However, the line gap
is actually built into the winAscent/winDescent, so we
ended up adding this twice to the line spacing, increasing
it with some older fonts. When using the Windows legacy
metrics, we now set the line gap to 0 instead to reflect
that this is baked into the height.

In addition, since we now calculate the values ourselves,
we would not round them to nearest integer like the GDI
engine does. We now round these values to make it clear that
the GDI engine does not support any fractional metrics.

[ChangeLog][Windows][Text] Fixed an issue where the line
gap of some fonts would be included twice in the font's
leading.

Fixes: QTBUG-109400
Change-Id: I02ab7447b5e82d9f4474f9bca581f82acee85ff3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
(cherry picked from commit 8892819d0c89d0434c94f0c0951458719cba5c2e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-16 07:15:29 +00:00
Tor Arne Vestbø
7f5c5eb9c0 macOS: Use NSStatusItem.menu to manage system tray menu
Using [NSStatusItem popUpStatusItemMenu:] to manually show the menu is
deprecated, and was causing various issues when right clicking the menu,
such as not unhighlighting the menu item when dismissing the menu, or
worse, not quitting the application if a 'Quit' item was triggered from
a right click.

The reason we were using popUpStatusItemMenu instead of the menu
property of NSStatusItem was that the latter prevented us from seeing
the action message of the NSStatusItem button, which we used to emit
the system tray's activated signal, but this can be solved by listing
for the menu's tracking state starting.

Fixes: QTBUG-103515
Change-Id: I686550ebac7d94d8d11b2e3c49ed16a8240cb214
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit da754d5b6589c9877f0325edb3da5cbc64d966c7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-15 09:46:40 +00:00
Paul Wicking
8436864744 Document max size for QFont::setPixelSize
Fixes: QTBUG-102989
Change-Id: I9a63a2ab8ac6eadf1b5a5865a0a084700d9e85d2
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 8165750af85e324055b89f69d2e359e40f043bfc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-15 09:41:34 +00:00
Christian Ehrlicher
c8d46f7926 Widgets: Deactivate effect on destruction
If a QGraphicsEffect is active during destruction, the corresponding
widget does not inform it's parent about this change which leads to
artefacts of the old effect. Therefore trigger an update through
effectBoundingRectChanged() if the graphics effect source changes.

Fixes: QTBUG-109165
Change-Id: Ib3fd9bec2134ed61f098c4ce6629ebcc5df90787
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 2946447f50bc03ae5c9b5b9668d43ca7223a53c1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-14 23:43:57 +00:00
Marc Mutz
3da9143b36 QBuffer: test and document open() behavior
QBuffer::open() was only documented as \reimp, so its behavior
regarding WriteOnly was never actually described.

Add a test and document the outcome.

Change-Id: I75c49cd3f6a1961bcaece4a92a4e479bb3300d36
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit c262a1805a062fd99abc890f58ea951da80ff0af)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-14 18:07:29 +00:00
Giuseppe D'Angelo
9af5ed3a81 Fix the focus frame on Mac
The Mac style uses focus in/out events (sent by QApplication) in order
to update the focus frame. If a proxy style is installed, these events
never reach the Mac style object.

Amends 5d8a7652b995124495ef4f4a43fd8cf461367d62 , by making the
forwarding limited to the events for which we want it to happen, and not
just *any* event.

Fixes: QTBUG-109375
Change-Id: I6df49aa81d6ebb8dbaf00b9ba99e2a7c006e1181
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3bb055d8ab045def265bb9b3eb4e7dff1874a093)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-14 14:28:39 +00:00
Bartlomiej Moskal
16040e51f7 Android: Close the keyboard after clicking Done
The keyboard was not hiding after clicking the done button.
This commit changes this behavior. If KeyCode is other than
IME_ACTION_PREVIOUS/IME_ACTION_NEXT the keyboard closes automatically.

Fixes: QTBUG-107662
Change-Id: I3449aa6898b826bfa03104275c7224329f24ed9a
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit cc9144b4f39923dfb9ee17f951f93f257aa2d221)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-14 14:28:36 +00:00
Assam Boudjelthia
8dd90fc8aa Android: Add facilities to handle more content URIs operations
Use DocumentFile and DocumentsContract to support more operations
on content URIs, such as:
* listing files and subdirectories with usable content uris
* mkdir, rmdir
* creating non-existing files under a tree uri
* remove

And since dealing with content URIs require some level of user
interation, manual tests were added to cover what's been implemented.

Note: parts of the code were from from BogDan Vatra <bogdan@kdab.com>.

Task-number: QTBUG-98974
Task-number: QTBUG-104776
Change-Id: I3d64958ef26d0155210905b65daae2efa3db31c1
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit e5d591a0d09032d1870e47d1bf59c9069ea0a943)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-14 13:56:19 +00:00
Thomas Senyk
cc295aac1f eglfs-kms/gbm: fix segfault and add qScopeGuard
As framebufferForBufferObject has a code-path which returns a nullptr,
it's vital to check on that and return early in that case.

As this is the second segment in this function that does gbm_surface_release_buffer,
a qScopeGuard was introduced to reduce code duplication.
This also makes this function saver/easier to maintain long term.

The platform on which this segfault was reported is QEMU

Change-Id: I5ee1ad4073712349b7475bce3a7978961fea2344
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit ad2aca113daccb4d0e9299b7c37d61f2d9b1f930)
2022-12-14 11:44:09 +01:00
Yuhang Zhao
c3f04ebfa9 HiDPI: fix wrong window size after DPI change
Current code doesn't take the custom margins into account,
it will cause windows with custom margins have wrong size
after DPI change.

Amends commit 2cfca7fd1911cc82a22763152c04c65bc05bc19a

Change-Id: I80b01c030a63d02cf66f105785df7c3f590481b5
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 67284763e7ce0d12650b652e92dfd022a8affb1d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-14 03:50:00 +00:00
Giuseppe D'Angelo
08a0f332b5 PCRE2: upgrade to 10.42
Upstream released 10.41 and 10.42 in quick succession.

[ChangeLog][Third-Party Code] PCRE2 has been updated to 10.42.

Change-Id: Iadec8e64e9ce7ddad17afb075157719af76379bd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 05e72d53a6b0546d67dc699f922811790a896fb3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-14 01:34:53 +00:00
Bartlomiej Moskal
085138bc2d Android: fix Android assets handler not listing dirs with only sub dirs
It looks like AAssetDir_getNextFileName is not enough.
Directories that contain only other directories (no files)
were not listed.

On the other hand, AAssetManager_openDir() will always return a
pointer to initialized object (even if the specified directory does not
exists), so we can't just leave only it here.

Using FolderIterator as a last resort. This approach should not be too
time consuming.

As part of this fix, add some unit tests to cover/ensure assets
listing/iterating works as expected.

Fixes: QTBUG-107627
Change-Id: Id375fe8f99f4ca3f8cad4756f783ffafe5c074df
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 4ceee3911a2ef567f614fc296475bc2b2a0e3add)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-13 12:04:49 +00:00
Friedemann Kleint
4928414d91 Vista Style: Use correct action icon pixmaps matching the device pixel ratio
Extend change 5911335756dff5a917e4a7ccf025816c08ddd656 to the Vista
style (using the paint device's ratio).

Fixes: QTBUG-108440
Task-number: QTBUG-85885
Change-Id: Ib0b5fcc943a18896b770b382b39bbb684238a618
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 2d20406f5996e42dfb06c6c19ae28a92314929bf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-13 05:53:02 +00:00
Kai Köhne
2706f8c787 CMake: Warn about additional arguments to qt_add_plugin()
From Qt 6.5 onwards, qt_add_plugin() supports passing source files.
Let's warn if people use that feature for Qt 6.4, or older versions.

Pick-to: 6.2
Task-number: QTBUG-104189
Change-Id: Iee6592720500db3f45705f13a3c4fde6eb29e264
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-12-12 16:35:52 +01:00
Axel Spoerl
003d30fac2 Set geometry property in QXcbWindow after checking minimum size
QXcbWindow::create() bound the window's size to windowMinimumSize(),
after its size had been inherited from parent().
QPlatformWindow::setGeometry() was called before that sanity check.

When a fullscreen window is re-mapped from a deactivated screen to the
remaining screen, the call to QPlatformWindow::setGeometry() assigns
an invalid QRect to QPlatformWindowPrivate::rect
The negative int values x2 and/or y2 cause
QXcbBackingStoreImage::flushPixmap to address unmapped memory and
crash.

This patch moves the call to QPlatformWindow::setGeometry() from
before to after bounding to a minimum value. That assures a valid
rectangle to be assigned in all cases.

Fixes: QTBUG-109226
Change-Id: I349a0f3c721059a9013a275de5b4cb147fbdd7a1
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 6a3627b6c5aa5109a80024f3d7b0f938504f7ffe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-12 12:43:33 +00:00
Alexey Edelev
1d793e425c Add forwarding of CMake variables to ABI-specific external projects
The 'QT_ANDROID_MULTI_ABI_FORWARD_VARS' variable allows to forward
variable values to ABI-specific external projects. The variable accepts
names of variables that needs to be forwarded.

Task-number: QTBUG-107893
Change-Id: Iaa4fa7e98ad0df956d90f91e157edb561183c795
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 19ddc0b22560c58b3f519beb5acc4243efe8ecb2)
2022-12-12 11:57:30 +01:00
Assam Boudjelthia
a549aa434e Fix infinite loop when iterating content uri sub-files/dirs
make QAbstractFileEngineIterator::currentFilePath() virtual
and implement it under AndroidContentFileEngine to return
current fileName because content uris shouldn't be constructed
manaully like normal file paths.

Fixes: QTBUG-104776
Change-Id: I4643a73a3bd4019bedaa056c35468117bcec18dc
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit f3c998510d3a6c8fc468e449d66b0280119d0a8f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-10 08:03:24 +00:00
Alexey Edelev
c9d886f1c2 Document QT_ANDROID_MULTI_ABI_FORWARD_VARS CMake variable
Add documentation for the QT_ANDROID_MULTI_ABI_FORWARD_VARS CMake
variable.

Task-number: QTBUG-107893
Change-Id: Ia8dfd14a89d043c4f967464646388f57c96f911a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 050b849c9664ba15cbe4a6ec176fec217f276094)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-09 21:16:28 +00:00
Thiago Macieira
5246393d91 tst_qdbusmetatype: fix build with Clang (and probably MSVC)
This test makes use of a GCC extension-slash-defect in matching of
template template parameters. Either Clang has recently changed its
behavior not to accept them any more, or we've never compiled this test
with Clang.

Tested with Clang 15.0.6.

Change-Id: I69ecc04064514f939896fffd172e98d826989ca3
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit abaa3e61120529b656922c2272b99a674d9e1a38)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-09 15:28:56 +00:00
Alexey Edelev
41a8e6fce5 Add _qt_internal_apk_dependencies if qt_finalize_project is never called
With CMake versions < 3.19, we don't have a deferred call of
qt_finalize_project. In qt_add_executable we only have immediate
finalizaton call of qt_finalize_executable, but
qt_android_generate_deployment_settings still depends on the
_qt_internal_apk_dependencies target that is created by qt_finalize_project only.
Create an empty target for the cases when we need to generate
deployment setting but qt_finalize_project is never called.

Fixes: QTBUG-106634
Change-Id: If0608cb527eea662e0f9dd41f2751fe49ce433db
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 6294ee060eeb564d7fce3eb56624b0711d30af15)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-09 15:17:21 +00:00
Timothée Keller
9f6ad14591 Windeployqt: change platform plugin base filter
Add infix to "qwindows" for platform plugin search if it exists, to
account for libinfix builds

Task-number: QTBUG-105820
Change-Id: I7a3c671fb6cdb4a216f6f4bffb445add4f8e0c83
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 832a337831a4736a3a610764271b1ab4cf0699bd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-09 15:17:17 +00:00
Mårten Nordheim
6714a4295e TLS[openssl]: Bump minimum warning level to Critical on Win/macOS
On these platforms there is a platform-native plugin that can be used
instead. If, as has happened, a developer uses the OpenSSL backend
without OpenSSL being available they may be confused by the output of
OpenSSL without it being of any concern.

Leave the warning level low on other platforms since they have nothing
to fall back to.

Change-Id: Ic36a0429a9e8eed728aa59ec9e028626d6579de1
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 4af5f0b983fac067ad66921a68a2bb6de2c9e677)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-09 15:17:13 +00:00
Alexey Edelev
e85b0ad567 Remove CMake version check when adding _lib_pri to ALL
It looks like adding dependencies to interface libraries is either not
fixed or broken in CMake versions newer than 3.20. Remove the CMake
version check to ensure that 'lib_pri' targets are executed. This will
restore the initial behavior.

Amends cfcc4ef8edc4e8256ae738bbe8c23b4204021830

Fixes: QTBUG-109240
Fixes: QTBUG-109239
Change-Id: I8c5b317fcdd0a715a1a668b4e955df1acfe4be8b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 85b941f4251bb5207db65efc9ccdd1f5586c8d11)
2022-12-09 12:06:46 +01:00
Kai Köhne
d4ebb92178 Doc: Change links from froglogic to qt domain
Change-Id: Ic249f8dfa168948eddc83f35314708ffb40e75b1
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
(cherry picked from commit 486c8aae62b5702fee82ffc65a3b034134704739)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-09 10:40:58 +00:00
Timothée Keller
6c35c877c3 Update list of windeployqt modules
Added Quick-controls,dialogs,layouts,shapes,test,timeline,3d- modules
to the windeployqt module list

Task-number: QTBUG-105135
Change-Id: Id5bbaa4b86f1ec9861ee308cec6deff50704c77f
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 7a4b89fb001bf48829db59d34a2d829394a0bbd6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-09 02:40:26 +00:00
Allan Sandfeld Jensen
06a7b5ff78 Fix wrong to linear conversion
Causing bad rendering of gamma corrected text on non-standard image
format paint devices.

Fixes: QTBUG-109169
Change-Id: I6d95e9a42b9ccac609071123dd4535d25e225a29
Reviewed-by: Fabian Vogt <fabian@ritter-vogt.de>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit a09c33e1f7b5999a16bce9dd23ef8ca33d519210)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-09 00:22:26 +00:00
Christian Ehrlicher
61c59f2d8b SQL/MySQL: don't use deprecated defines, cleanup
Replace plain int with enum 'enum_field_types' and don't use deprecated
MySQL type names.

Change-Id: I8a629ac1b4ad7d6d78604ff641b5b35397cd769c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 4091d73af8fdc42b538d5bf82442f5e79b34ff1d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-08 21:50:26 +00:00
Marc Mutz
252a29f716 QNetworkRequest: don't assume QByteArray::constData() is NUL-terminated
It isn't guaranteed to be, for QByteArrays originating from
QByteArray::fromRawData().

Use the four-arg qstrnicmp() overload (with defaulted fourth
argument), wrapped in a lambda to DRY, instead of qstricmp(), which
may produce incorrect results or even read past user-supplied buffers.

There were also uses of QByteArray::compare(c-literal,
Qt::CaseInsensitive). They're not affected by the problem, but
QByteArray is scheduled to lose its string-y API parts and become a
container of octets in the future. Besides, the lambda solution is
much nicer on the eye.

Change-Id: I1e0f9003082f4158edecc6fe8cf3c0518e5403f5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 0326ea08b1d856b5d879564d8dc4a122ad457575)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-08 18:00:40 +00:00
Marc Mutz
f11a9b203b QNetworkRequest: Make header parsing locale-independent
The existing header parsing used C's tolower() function for
case-insensitive switching over the first character of the
header. However, that function's result depends on the current locale.

Since the parser is supposed to match the likes of "If-Match" and
"If-None-Match", matching may fail in locales, such as Turkish, where
tolower(I) is ı (LATIN SMALL LETTER DOTLESS I) (or I, if the former
isn't representable in the current charset), causing a False Negative.

To fix, use the US-ASCII-only QtMiscUtils::toAsciiLower() function,
which has the added advantage that it's inline.

Replace at(0) with front() as a drive-by.

The WASM copy of the function is hopelessly outdated (recognizes less
headers than the QNetworkRequest original).

[ChangeLog][QtNetwork] Fixed a bug where certain
QNetworkRequest::KnownHeaders wouldn't be recognized as such in
certain locales.

Task-number: QTBUG-109235
Change-Id: Ib147ab64803bb868647dd07ad657d785071242ea
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 536e17372803e7c9557e4a59ae8dad0405f11cd2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-08 18:00:31 +00:00
Timothée Keller
b0fa19a92e Update list of windeployqt modules
Added Positioningquick, Sensorsquick, Webenginequick, and Webviewquick
modules to windeployqt list

Task-number: QTBUG-105135
Change-Id: I26c0b5006453c8533ff94967b2e8f03ede88bf7e
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit bb5d4094e040359d2f74c75b8a25732c1ea89b87)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-08 16:57:18 +00:00
Volker Hilsheimer
7107b4ae5b QComboBox: Don't dereference potential nullptr, simplify
Amends a874087504cf5af8bb4171d4137f23f100b7063b, which tested whether
d->container is nullptr to decide whether to hide the popup, and then
dereferences d->container later without checking again. This raised a
correct static analyzer warning.

Simplify that logic. hidePopup() does nothing if there is no visible
container, and we don't want to accept() the cancel key if there isn't.
So the closeOnCancel logic isn't actually needed, we only need to accept
the ShortcutOverride to make sure that QComboBox sees the Cancel key
even if there is a shortcut registered, and then we can handle and
accept the cancel key to call hidePopup() only if the popup is visible.

Add test to verify that this interaction works as expected.

Task-number: QTBUG-108908
Change-Id: I60d92b068f0f5139d629cf4a58e225512170df77
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 c95de359b4fe7bc03f7defdb057ebbe79c51b3dd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-08 14:14:32 +00:00
Kai Köhne
22dfb9cf1a Doc: Fix paths for Files property in qt_attribution.json files
qtattributionsscanner expects file paths to be separated by a space.

Change-Id: I4c9dfea0f086fc9631cb06f40e2d3cab0a32ca4e
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit cbd5bc0b587de74d900494817509717ef2f0c472)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-08 14:14:27 +00:00
Volker Hilsheimer
49d6a259cd Windows: regenerate systray icon when screen resolution changes
When the screen resolution or scale factor changes, then we have to
recreate the system tray icon so that it doesn't get blurry. Such
changes generate a WM_TASKBARCREATED message, which we already handle
through a self-registered message ID to re-add the icon when the task
bar/explorer crashed. So call updateIcon there to recreate the HICON
before adding it again.

For this to work, we have to actually store the QIcon in the already
present (but so far unused) m_icon member, and reset that member before
calling updateIcon, which would otherwise be a no-op.

Fixes: QTBUG-108641
Change-Id: If3dd042416b7f61bbb3b43f7d563e52b406136a2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 9bc36308c77e10c6a890c3dd6a72dd2f23a72288)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-08 12:28:57 +00:00
Jaishree Vyas
bd7f23f347 Doc: Document Qt Serialization with use cases
Added some background about Serialization with the classes and used cases.

Fixes: QTBUG-103951
Change-Id: I3ff179b814fc5d424f2ac2ffaf3237b90ddd7e2b
Reviewed-by: Vladimir Minenko <vladimir.minenko@qt.io>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit 57a4c0d73c3521a0855ce597204b096928c43117)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-08 12:28:52 +00:00
Mårten Nordheim
fec918e4f4 macdeployqt: Add networkinformation as plugins to be deployed
This was missed during original patch

Fixes: QTBUG-108677
Change-Id: Icd8960f2f41468dc12c3269b12df777acd962753
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit effd3b4d83703996f30e85d113efe16771024e37)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-08 00:10:22 +00:00
Alexey Edelev
4f00d5d0b9 Add _lib_pri targets to all
In CMake versions older than 3.20 add_dependencies have no effect
when adding interface libraries. So need to add the '_lib_pri'
targets to ALL to make sure that the related rules executed.

Amends 190e58e1f4eb9e9bf12a9561cf32cdccdc0b22e0

Fixes: QTBUG-109240
Fixes: QTBUG-109239
Change-Id: I7c565ce3bc15e549569317454c2f7caac823cf66
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit cfcc4ef8edc4e8256ae738bbe8c23b4204021830)
2022-12-07 15:51:22 +01:00
Marc Mutz
cb72901d1c corelib/QMakeLists.txt: fix order of files in in qNN section
They're supposed to be lexicographically ordered, so fix.

Change-Id: I88acad048990b16b7e9dd073f55608a80e71c416
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 68fd43212c22397ae952959a49cb2746ac89dce3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-07 07:39:47 +00:00
Marc Mutz
8e55208bd3 QFont: replace a QVLA with a C array
QVarLengthArray doesn't allocate, but is nevertheless dynamically
initialized, incl. thread-safe static overhead.

Turn the QVLA<QPair<int,int>> into a std::array<int,2>[] instead. This
container has constant initialization and the use of array<int>
instead of pair<int, int> means we can use the bool inverted argument
as an index into the array instead of having to switch over .first and
.second.

Saves ~600B in text size and ~100B in BSS on optimized Clang 15 AMD64
Linux builds, and the copying, under mutex protection, of the data at
runtime.

Amends 3558704ed5c3d2c6dc6d024dfa454997469ca75f.

Change-Id: Iad48eca4eef77011d4094125670ea302e8beae46
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
(cherry picked from commit 1501f45c335f0a82843e3133ec2ef54d93546cf9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-07 06:24:29 +00:00
Marc Mutz
9a17766869 tst_QString: fix custom QCOMPARE for strings > 2Gi characters
Same fix as in tst_qbytearray's QCOMPARE() in
cb9715557c414d5b3c90165cc8fc710fbdcdba77.

Change-Id: I2222d9015ae7121a2fbcf5b936b27de20e873064
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 20d1477c14316a43b65415bae90d1e5d12fcbf44)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-07 06:24:28 +00:00
Marc Mutz
3cae2c25fc qcompilerdetection.h: de-duplicate feature test macro discussion
Both links are valid for both C++14/17 and C++20+ variants, they're
just sorted differently. Mention that.

Change-Id: Id88ec05f935fd6d01c0f1e733ca42faaaa88dd25
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit e2c08b5f3a2f978e969175d4b61bd7e07815f1aa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-07 06:24:27 +00:00
Markus Goetz
661544d490 tst_QNetworkReply: check whether we actually use six TCP connections in HTTP/1
Task-number: QTBUG-25280
Task-number: QTBUG-108215
Change-Id: I5f94866e30f08465943922e3dee5150f37054225
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 9329e4e8c7508c2fe1e22e4b8e96abc1ad1ece91)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-06 10:13:02 +00:00
Giuseppe D'Angelo
ba13715e5c Wait conditions example: code tidies
In no particular order:

* Clean up #includes.

* Document what is protected by the mutex.

* Use explicit, nullptr.

* Use lock managers, not manual calls to lock/unlock.

* Unlock the mutex before notifying the condition variables.

* Condition variables are always meant to be used in a while loop, and
  never with a plain if, because of spurious wakeups.

* Don't lock a mutex just to protect a plain integer. We have atomics
  for that use case.

* Remove an unneeded signal, therefore also the need of using
  Q_OBJECT and the inclusion of the moc-generated file.

Fixes: QTBUG-108860
Change-Id: I2afc77955b95de8aa5fb88048cd9feb217f83b4f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3a449bbb69c9a3c3a5bc6a052f2de98ab79be7e9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-06 07:25:14 +00:00
Timothée Keller
77490d15d7 Update list of windeployqt modules
Added DBus, StateMachine and 3DLogic modules to windeployqt module list

Task-number: QTBUG-105135
Change-Id: Ied8624e87f62bd655db8b82cf9fe20d72873d823
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 8c33fe9ded700a4b65985dc1b85676cb7f333317)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-06 07:25:14 +00:00
Kai Köhne
8e2fbd5e24 CMake: Properly quote paths in FindPPS.cmake
PPS_LIBRARY and PPS_INCLUDE_DIR cannot be empty at this point (otherwise
PPS_FOUND would be FALSE). But it's arguably good practice to puth paths
in quotes.

Task-number: QTBUG-108930
Change-Id: I87128da50f37cd6aa1a66811261a05ceb8c3e790
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit f5f5a29bbac86d31420be8058d4b96b210d8560e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-05 21:16:52 +00:00
Volker Hilsheimer
c5544de393 Fix documentation of QAction's text property
The text of an action is used as the tooltip and iconText unless those
are explicitly set, and only then does an '&' mnemonic get stripped.
An '&' in the text will generate mnemonic shortcuts in some UI controls,
such as menubars, menus, or buttons. Document that in the text property,
and add a see-also from the constructor to the relevant properties.

As a drive-by, reduce the usage of "widget" in the documentation.
QAction now lives in QtGui and can be used by both widget and Qt Quick
UIs.

Fixes: QTBUG-109060
Fixes: QTBUG-109061
Change-Id: I5e7c2a01b8029f519d7050187e486b667d3cd52b
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit f546f3700b376fb25de38958e0ab2ca880f9629a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-05 21:16:52 +00:00
Tor Arne Vestbø
da7283eddc macOS: Don't pass on key event text for function keys when IM is disabled
On macOS function keys such F1-F16 and the arrow keys result in NSEvents
with a character in the 0xF700-0xF8FF range of the private use area:

 https://unicode.org/Public/MAPPINGS/VENDORS/APPLE/CORPCHAR.TXT

We used to filter these out for all key events sent from the platform
plugin (4dbce2a4696081), but this had the side effect of breaking the
Unicode Hex Input keyboard's ability to explicitly input these
characters.

As of 705665957baf16f9ec4d256dd4d2fad98788314b we started trusting the
macOS text input system on whether a key event should include text or
not, which fixed both the hex keyboard and Russian keyboard input when
the key included the ^⌥ modifiers.

Unfortunately this didn't account for the case of non-IM enabled input,
so we started sending key events with text for arrow and function keys.
And since Arial Unicode MS provides glyphs for these code points, we
would end up with confusing characters in input fields when pressing
the arrow keys.

In general a client can not assume that the text() of a QKeyEvent is
printable, and the logic to determine if a character should be filtered
out or not depends on the font matching, since all code points can in
theory have a font that provides a glyph for it, but since we know that
the function key range on macOS is not supposed to have associated
glyphs we filter them out explicitly.

Note that we only do this for non-IM enabled text input, and otherwise
leave it up to the macOS text input system to determine if a event
should result in text insertion or not.

Task-number: QTBUG-106393
Change-Id: I5498fbedee21b0720c56e99b26924959ade897bf
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit b2e5d547263f297a7a8f37e8ad5cded7e66f93c9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-05 21:16:51 +00:00
Christian Ehrlicher
5ed99a42a6 SQL/MySQL: fix handling of json column
Add handling for MYSQL_TYPE_JSON by treating it the same as
MYSQL_TYPE_BLOB (which is used by current MariaDB Server for a json
column)

Fixes: QTBUG-101680
Change-Id: I4d4b0cdad73cd12e0db4df4021fddbd6a649c8ed
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9d27c07e284457fb86258ab518f39c5cab1dac80)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-05 17:45:17 +00:00
Volker Hilsheimer
f8b151891e QComboBox: hide the popup on keypress rather than ShortcutOverride
Qt sends a ShortcutOverride to the focus widget to evaluate whether the
widget's key event handling has higher priority than shortcut handling.
A KeyPress is then sent if the ShortcutOverride comes back accepted, or
if the Shortcut event returns ignored.

QComboBox needs to accept the ShortcutOverride for Cancel, so that
hiding the popup has priority over application shortcuts. But it should
only hide the popup when the KeyPress event actually arrives, as
otherwise the the focus widget changes (from popup to combobox), which
breaks event delivery on macOS.

Fixes: QTBUG-108908
Change-Id: Ie9cce1c2041cbe0e41be301686d7c3b5683e9f10
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit a874087504cf5af8bb4171d4137f23f100b7063b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-05 15:01:55 +00:00
Alexey Edelev
c47e857ac3 Link ${target}_lib_pri directly to INTERFACE_LIBRARY targets
There is no reason for adding dependency to the custom
'_pri_dep_timestamp' target instead of the INTERFACE_LIBRARY target
itself. This will close the chains of dependency between repo targets
and the HEADER_MODULE dependencies.

Fixes: QTBUG-108815
Change-Id: I0e170d3e0e42d342881beb8aca1cc5a764425826
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 190e58e1f4eb9e9bf12a9561cf32cdccdc0b22e0)
2022-12-05 16:01:55 +01:00
Kai Köhne
5ef6a158c7 Add \brief descriptions to CMake overviews
Add brief descriptions of the pages that are shown in
  https://doc.qt.io/qt-6/overviews.html

Change-Id: I177e4ba82cd7b8e264122375bf9a595509918fdd
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 2e241d153738c9881c4e57a6b8f095cd1c514992)
2022-12-05 16:01:55 +01:00
Nicholas Bennett
caf2667ea6 Docs: Document the QT_ANDROID_SDK_BUILD_TOOLS_REVISION CMake variable
When updating Qt for Android platform documentation, it was discovered
that the CMake variable for setting a specific Android SDK Build Tools
Revision was undocumented.

Change-Id: I5f1b4e9d10b9ce817f5529cf4897bd0423a84455
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 3aaf5975e4ed426f5902283e1d4139b57bdffc36)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-05 15:01:55 +00:00
Eskil Abrahamsen Blomfeldt
2b65c4943e Fix missing text when Harfbuzz fails to shape a substring
This amends fccd419dd632306a4bd85928223e0a56a59510ef.

If Harfbuzz failed on one of the items in a string and returned
zero glyphs, then we would exit the shaping loop. The mentioned
change fixed a crash related to this when the ignored character
was the only character in the string, but it occurred in a
subitem of a longer string, then we would return and fail to
lay out the rest of the string.

This popped up recently because an update to Harfbuzz has caused
it to return zero glyphs when applying the Apple emoji font to
an isolated variant character (see bug report). When we matched
the symbol to the main font and only the variant character to
the emoji font, we would get in this situation, and end up
exiting the shaping early.

[ChangeLog][QtGui][Text] Fixed a regression which would
sometimes cause text to disappear if the string contained
an unmatched variation selector character.

Fixes: QTBUG-108799
Change-Id: I616ab1b2d33c2df731419c5ce06fbc578a625a32
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit c9d991de1ff32a7993aae90b50badfaa39323a61)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-05 12:15:08 +00:00
Eskil Abrahamsen Blomfeldt
658ded34c7 Don't return a visual glyph for ignorable characters
When Harfbuzz returns zero glyphs, this will typically be because
the character is ignored. We currently have no way to differentiate
this from actual error cases, so to avoid return the error glyph
for cases which are not really errors, we set the dontPrint flag
for this.

When we add a way to differentiate between error cases and non-error
cases later, we should revert this for the actual errors.

Task-number: QTBUG-108799
Change-Id: I2a910d951b71c705fb4dd761fcfe3a942b3afa7c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 0dcd640a1faa9943645ab0e15ebfdbe263058529)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-05 12:15:08 +00:00
Timothée Keller
5e8048f966 Windeployqt: adjust bitset change for scaling
Replaced the ullong with Modulebitsets for when the number of modules
exceeds 64

Change-Id: I489d35bc53d6aacf7907f75957bd8c6d21fbeb60
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 58861f78c0822f74744a3285abeb785219b8f96c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-05 12:15:07 +00:00
Samuel Mira
89725106ed Android: Fix incorrect dimensions - part 2
The previous fix worked for lower API levels but failed to
work properly on some devices (Devices with > 29 API levels). This
patch fixes that issue.

Task-number: QTBUG-107604
Task-number: QTBUG-107923
Change-Id: I8fd3601225026ea5c370a8a1a1aab317558432b5
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit bb629a2e293b8b181cfb176087aab96f68cfbbd7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-05 08:33:09 +00:00
Timur Pocheptsov
f2a6eeb978 qsslsocket_shared_mac: add more logging into certificate parsing
On macOS we observe strange CA certificates that are coming from
Security framework and which it cannot later parse from the DER
format we feed it in. Add some more debugging in order to understand,
which certificate gives such result.

Task-number: QTBUG-109135
Change-Id: I75cf4591e33c85db6fe80d37d84ede1456c56231
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 8a18466e38779b63c19e281e92031cebaedbcba5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-04 18:00:26 +00:00
Joerg Bornemann
95811fba5e CMake: Make it possible to specify a debug MySQL client library
An MSVC debug-and-release build of Qt with the MySQL plugin requires
separate builds of the MySQL client library: a debug and a release
build. There was no way to specify the debug version of the library.

Now, it's possible to configure Qt like this:
cmake ... \
    -DMySQL_ROOT=D:\mysql-connector-c-6.1.11-winx64 \
    -DMySQL_LIBRARY_DIR=D:\mysql-connector-c-6.1.11-winx64\lib\vs14

This will automatically detect the include dir and the debug and release
library files. We expect that the debug build of the MySQL client
library resides in a "debug" subdirectory below MySQL_LIBRARY_DIR.

If the automatic detection doesn't work to due a different layout on the
build machine, one can set the variable MySQL_LIBRARY_DEBUG to specify
the debug variant of the MySQL client library.

[ChangeLog][CMake] If pkg-config is not used, a debug build of the MySQL
client library can be specified with
-DMySQL_LIBRARY_DEBUG=<path-to-library>. The debug and release variants
of the library are automatically detected. Setting MySQL_ROOT and
MySQL_LIBRARY_DIR is sufficient in most cases.

Task-number: QTQAINFRA-4999
Change-Id: I663fb8ac1dbd07bc73484791be9cc21bff2f4a9b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 84c76d6205c26e27a59bebcabb78d95a0891ce79)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-03 16:46:37 +00:00
Marc Mutz
e372399e2f [doc] QAnyStringView: document visit()
For some reason, it wasn't documented.

Change-Id: I480623398dc33be91e82b24ac2616bcdd20da34b
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 22ad2c3320acd4d20179d6c58e2727bdc0820582)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-03 16:46:37 +00:00
Mate Barany
f234a39032 Refactor\Extend tst_QString::prepend_data with additional test cases
During the implementation of QString::append(QUtf8StringView) it has
become apparent that the testing is insufficient as it did not warn
about an extra growth. The following tests have been added that append:
- y-umlaut and greek letter small theta (2 UTF-8 code units => 1 UTF-16)
- devanagri letter ssa (3 UTF-8 code units => 1 UTF-16)
- chakma digit zero (4 UTF-8 code units => 2 UTF-16 code units)
- some combinations of the above

Task-number: QTBUG-103302
Change-Id: I981213c296bafc81663b08c0f1f339bbd8a96485
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 8c0ed7422c426046343e6d3ce81b35105cc2bc6b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-03 16:46:37 +00:00
Mate Barany
233109e93f Refactor\Extend tst_QString::insert_data with additional test cases
During the implementation of QString::append(QUtf8StringView) it has
become apparent that the testing is insufficient as it did not warn
about an extra growth. The following tests have been added that append:
- y-umlaut and greek letter small theta (2 UTF-8 code units => 1 UTF-16)
- devanagri letter ssa (3 UTF-8 code units => 1 UTF-16)
- chakma digit zero (4 UTF-8 code units => 2 UTF-16 code units)
- some combinations of the above

Task-number: QTBUG-103302
Change-Id: I3d81cf10b7eb74433ce5bea9b92ce6bce1230dcd
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit bc9e1c5c2724161b97560b2957b9273bee013316)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-03 16:46:37 +00:00
Mate Barany
ca5b8565ff Refactor\Extend tst_QString::append_data with additional test cases
During the implementation of QString::append(QUtf8StringView) it has
become apparent that the testing is insufficient as it did not warn
about an extra growth. The following tests have been added that append:
- y-umlaut and greek letter small theta (2 UTF-8 code units => 1 UTF-16)
- devanagri letter ssa (3 UTF-8 code units => 1 UTF-16)
- chakma digit zero (4 UTF-8 code units => 2 UTF-16 code units)
- some combinations of the above

Note that this also affects operator_pluseq_data, which is basically
a wrapper around append_data.

Task-number: QTBUG-103302
Change-Id: I09ed950e3f0e71ae9ae85a455f42e130887f1109
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 4e5f8740635d1d57371b7639d58e9998c0027a04)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-03 16:46:36 +00:00
Oliver Wolff
5749fafa1f windeployqt: replace enum with bitset
we are running out of enum values for the flags.

Change-Id: Idd7cabb0c46c0c95eb4a87d047defb15ddeef024
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit ac0cf6a5cc1a3c4c0d785c351c6389afa464e3c9)
2022-12-03 15:00:34 +01:00
Volker Hilsheimer
8fcc92e38a Deliver tablet events to the toplevel widget if there is no child
QWidgetWindow dispatched only tablet presses to the toplevel widget if
no child was found at the position; other events, such as hover events,
were discarded. The tabletTracking test case even documented that
shortcoming in a comment.

Fix that by falling back to the toplevel widget for any event. As
before, only press events initialize the tablet grabbing target widget.

Remove the now unneeded parent widget from the test case, and move the
test class into the only test function that uses it.

Amends ea615b421b76668332a3029ad31fa725b5bb9e58 and
8fd6cef3724b2d676c5f6ae235956192d85eac39.

Fixes: QTBUG-108747
Change-Id: I79050f1e063931e439945f64b50712dcc1ecb18c
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 7956d9e06032e5488d57cf1dc1c9aae0e7172a20)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-03 11:30:49 +00:00
Timothée Keller
b7900fe742 Update windeployqt plugins
Added scxmldatamodel to plugin mappings

Task-number: QTBUG-100700
Change-Id: I58af7c0e47d3d9b7fc4d733610dcee8a7cb17228
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 3a967deebd60d3a5c5132270eb9ea5a6f7104cfb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-03 00:20:11 +00:00
Axel Spoerl
761bd30d7d Stabilize tst_QWidget::optimizedResizeMove and optimizedResize_topLevel
The test functions tst_QWidget::optimizedResizeMove and
tst_QWidget::optimizedResize_topLevel use a custom widget to record
paint events in a boolean.
Using QTRY_* or qWait() to wait for the boolean to become true stops
event processing upon consumption of the first paint event.
In case of multiple paint events, the next paint event will be recorded
in the next check and may lead to a wrong result.
This leads to flakiness on platforms generating multiple paint events,
openSuSE Leap 15.4 / XCB being one of them.

This patch replaces the boolean with a counter. It adds a
waitForPaintEvents method to the custom class, which processes events,
until the counter stops increasing. It returns true when paint events
have been recorded and false otherwise. It resets the counter after
each call.

It also removes the QSKIP on wayland, as the failure results from the
same reason.

Fixes: QTBUG-109093
Change-Id: I59ee8bb4efeaf5417d5749d21e384bee89301ae0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 2ec7a6322f465ad7cce3c48096d8912903196ab2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-02 20:17:29 +00:00
Ahmad Samir
d95b21706f ContainerApiSymmetry: verify Qt containers member erase returns iterator
For QSet, the key_type is const, so can't test assiging to it.

Change-Id: I9d363ef3fe52646b937d6a422227b19c48fdaf1f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 93f54f0aa44467da1ea7ef7bcb01e891c619c8f5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-02 19:53:16 +00:00
Friedemann Kleint
c1bbd4e442 Brush up the container documentation
Make the code snippets consistent, update the comparison table
and fix some sentences.

Change-Id: Ic8baaa56805392855736164efa03d065330309fa
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit f6b137bdc43d4021cbbe602759dbcced2e04d638)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-02 19:53:14 +00:00
Laszlo Agocs
d2f3e3949f Avoid continuous texture alloc in Composition Modes example
There seems to be some confusion from back when the example were
mass-ported to the QOpenGL stuff in Qt 5 times.

Fixes: QTBUG-109119
Change-Id: Ic4bcd010df3fcf82e16385ce241b379f0c351788
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
(cherry picked from commit 919664b29a874e8cdc3d74427654cbaa2b61be29)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-02 19:53:12 +00:00
Alexandru Croitor
6453d17a0a CMake: Add auto test for qt_add_resources dependency rebuilding
Make sure that touching any file that is part of a qrc resource
actually rebuilds the resource and the target that depends on the
resource.

Task-number: QTBUG-107687
Task-number: QTBUG-108113
Change-Id: I1153dc13fee44ffe59d2685a8cb33303538b026c
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 9b2c82cc8424f65a00ec6d5842103181e27604ee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-02 19:53:11 +00:00
Timur Pocheptsov
5d7ea8de1f Try fixing auto-tests that need resolving openssl symbols
For the case of static builds. Also, remove somewhat funny comment
from the shared tlshelpers.h file.

Fixes: QTBUG-105046
Change-Id: I2fd677a11b64df89c0ad0237e1014f5e80144c24
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 190e5af111a37928a434cdac051bd0d2f8a1e92d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-02 19:36:29 +00:00
Timur Pocheptsov
3eb20325c5 Stop using deprecated constants and use suggested replacement
Change-Id: I3686d896267d219501f8eeec74729c17d9c2b42d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 96628b1254233456e542d60672b96fe6a65a0797)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-02 19:36:27 +00:00
Mårten Nordheim
dfbd527ef9 Ocsp: Fix openssl feature requirement
We now only support 1.1.1+, so drop the version limitation.

Change-Id: Ife1e46c31bf6984159535b5739dd43609dcef714
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit b0e1dc652dbbadee86fa4ad681529bf2d3cbc4ed)
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-12-02 14:49:30 +00:00
WANG Xuerui
c38000b3a6 forkfd/linux: add support for LoongArch
This architecture is not CLONE_BACKWARDS in any way.

Matching OpenDCDiag PR: https://github.com/opendcdiag/opendcdiag/pull/169

Change-Id: Ibceccfd20d270b30302a936885d12e4c55cdd833
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 0ab51dcc3c0cca0d84822f3871d98ffa46b6b2e4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-02 09:26:42 +00:00
Nicolas Fella
e9c7d0c10a Fix typo in documentation for QVariant::nameToType
Change-Id: I69742b9e597012329de5f5f742d4972ea7575775
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit a528b1eb02a685e9e848bd7d69a5ef0c57774bd7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-01 06:59:17 +00:00
Oliver Wolff
1daf2593ab Add keyword msvc-2022 to testlib blacklisting
Change-Id: I04942dc9474fd2abfc341a1dd6434f7c78b6b5bd
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9a5ac4bcb35e1d30bbd9acaf74fa7a581983ee66)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-01 06:59:16 +00:00
Inho Lee
7382529fd9 Check if fontEngine is valid in QStaticText
When QuickWindow is set as setPersistentGraphics(false) and
setPersistentSceneGraph(false), texItems' fontEngines can
become invalid with hiding and showing.
In this case, a new font engine is created but not used.

Fixes: QTBUG-108300
Change-Id: I2bd759724d78cecd62666beb6fb4a01f6063cae1
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit b93720472ea5b14717bfe41304c3aab63faedef3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-01 06:59:16 +00:00
Edward Welbourne
77568d7bcb QDoc-ify QTest::runningTest()'s comment
While it's being picked into 6.3, it's not present in 6.3.[01], so
I've left it out of QDoc's sight (even though it's still \internal)
for the version picked to 6.3, but let's include it in internal docs
as "from 6.4" since that's the first minor release to contain it.

Change-Id: I1704a1ca4ba1231d0213e9ca236ef8401a59ddd0
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit b3262c7e540c446c5570c3ebf999adea48b2e2e4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-01 06:59:16 +00:00
Marc Mutz
821b993857 [docs] Adjust qExchange() docs for the present, where C++17 is required [2/2]: 6.3+
In C++17, std::exchange() is unconditionally available, so focus
attention on the missing constexpr and noexcept.

Manual conflict resolutions:
- docs moved from qglobal.cpp to qttypetraits.qdoc in 6.5

Change-Id: I5eb466b784bd741a7313a1554d8b7b67711d2cbc
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9c1a00271bccd8cefa1a7e568e21debc429ad73a)
2022-12-01 07:59:16 +01:00
Marc Mutz
abb629c023 [docs] Adjust qExchange() docs for the present, where C++17 is required [1/2]: 6.2
In C++17, std::exchange() is unconditionally available, so focus
attention on the missing constexpr.

Manual conflict resolutions:
- docs moved from qglobal.cpp to qttypetraits.qdoc in 6.5

Change-Id: Ia09bf6da7bd62e5a41083cfc5253e30a0298099f
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8cb4ada2a4aaa80cae411da6df9d07e8e7150a51)
2022-12-01 07:59:16 +01:00
Marc Mutz
a1e84f4bf7 qNN headers: only promise what we can keep
In general, we can't make the qNN types behave exactly like their
C++NN std counter-parts, because their exact semantics and
implementation may depend on C++NN language features, while qNN are
back-ports to C++ standards older than NN.

Adjust the warning message accordingly.

Thanks to Eddy for noticing.

Change-Id: I8533214549f2140a99e2216e3bcd979263fe100c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit f1c41382af0fd3e769b5792891b204ebeecd3bd2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-01 06:59:16 +00:00
Marc Mutz
866301ca12 [docs] QList: fix history of clear() semantics change
The description was copied from QVector, and doesn't exactly fit
QList. For QList, the behavior changed in Qt 6.0 when QList became
QVector, not in Qt 5.7, as indicated.

Be more precise.

Change-Id: I4029d83128ec205f628125d78394e8ee79cc221f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 13293d3308c04d22bc2928e8991f47744560e085)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-01 06:59:16 +00:00
Marc Mutz
83bf81fd73 qcompilerdetection.h: include <version>
...and update the documentation for how we detect post-C++11 features,
as proposed on the mailing-list:
  https://lists.qt-project.org/pipermail/development/2022-November/043248.html

According to https://en.cppreference.com/w/cpp/compiler_support,
<version> is available from
- libstdc++ from GCC 9
- libc++ from LLVM 7
- MSVC 19.22 = VS 2019 16.2
- AppleClang 10 = Xcode 10.0 beta (10L176w), 10.0 (10A255), 10.1 (10B61)

It is _not_ available on
- GHS 22.1.4
- GCC 8.3.0 (as used by QNX 7.1, but the default is libc++)

Task-number: QTBUG-108228
Change-Id: I61e0727573d1b4559228e3f5bd58d73e86a9256e
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 b2ed29b8d9b33dcece83000aee28073dd27f1cd9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-01 06:59:16 +00:00
Marc Mutz
2fa63f352a tst_QString: check empty regex can replace in empty/null string
It's not intuitive, so check lest people break it.

Change-Id: I2435cd69be7b77a6ae59cdc7b5fb99658cfc42fd
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d1a37ab0997fbe393fb9cca7158dfa59041f165d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-01 06:59:16 +00:00
Axel Spoerl
e5f94b3b1f Handle multiple paint events in tst_QWidgetRepaintManager
The helper function TestWidget::waitForPainted returned after the test
widget had consumed the first paint event. In case of multiple paint
events, QRegion paintedRegions did not match the entire region that
was supposed to be painted. The test function children() failed/flaked
due to that.

This patch extends the helper function. After consumption of the first
paint event, it processes events until the painted regions no longer
change.

Fixes: QTBUG-108764
Change-Id: I54e14bb07725dd1f602cc93085da13836e3b7494
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f7089e691e2f154f5ce6b50c5fee3d52e693c0ff)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-01 06:59:15 +00:00
Marc Mutz
268652173e tst_QStringApiSymmetry: add checks for QByteArrayView
... where checks for QByteArray existed before.

The checks we can't add are
- left/right/mid (legacy APIs not implemented in QBAV)
- several relational operators, d/t ambiguities. Created
  QTBUG-108805 to track these.

Task-number: QTBUG-108805
Change-Id: I30cc9b29a228d69d32af51234f2c28221478a75c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 5812c36cd53ab7ccf472f7d041e0c61a00482d9d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-01 06:59:15 +00:00
Volker Hilsheimer
0369967e3e QObject: stronger warning about isSignalConnected and threads
Document explicitly that it is not allowed to call isSignalConnected
from (dis)connectNotify overrides, and add the respective warning from
the disconnectNotify documentation also to the connectNotify
documentation (with some light editing).

Fixes: QTBUG-106025
Change-Id: I41e8a9d3e6ce697cb2943d55a7c853eeec9c1dbe
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit e75c1a00e31723f1c9deb8427725fa0a58fae2a8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-01 06:59:15 +00:00
Volker Hilsheimer
29e9766189 Windows: Reevaluate dark frames if the application palette changes
Since 5ea7e3a8111b2939f0c91b750aa1c62ab16ab715 we are using dark window
frames if the default palette is dark, unless applications explicitly
override dark frame support.

If the palette changes during runtime, we didn't reevaluate that
setting. Do that by handling ApplicationPaletteChange events in
QWindowsWindow. We still have to respect an explicit opt-out.

Simplify the code at the call sites of setDarkBorder(), we don't need
to check all the time whether the application has opted out of dark
frame support.

Task-number: QTBUG-72028
Change-Id: I94e7d33cd21f9656ca210b43e775f487abc25b54
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit f32aa06f4f925e9a14db1bf76918358480b98b6a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-01 06:59:15 +00:00
Phan Quang Minh
c9837c84aa ibus: check object validity before honoring inputMethodAccepted()
`inputMethodAccepted()` always return false if there is no current focus
object. This means QIBusPlatformInputContext will fail to send the
necessary `FocusOut` request to the input context, causing IBus to not
send the appropriate content type information to the panel service when
the application regains focus and issue a `FocusIn` request.

This results in issues like
https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5346, which can
happen when a Qt application is in foreground as the IBus daemon fails
to propagate the content type information to GNOME Shell, which acts as
the panel service on GNOME systems.

Fix this by checking for the validity of `object` before honoring the
result of `inputMethodAccepted()`.

Change-Id: I6b79ffc7c5f03ffc05527c29e52a0859f3594bfa
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 95b4cfb1af9aefe3ff3aa151804f464388329c63)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-01 04:11:33 +00:00
Yuhang Zhao
ec5370458f Proper clearing of WinRT factory cache in QWindowsTheme
I've checked the whole qtbase code base, this is the only
one that's left from the previous commit.

Amends commit ffb9dee1b0954e4d4f9e9791175609a80ecafc31

Task-number: QTBUG-103611
Change-Id: I76a9130654819d1336c27dac350f5ad56915ad81
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit acf3f063efd2e1600b59c217189481e158b0eb89)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-01 01:28:38 +00:00
Yuhang Zhao
1327536264 Windows QPA: suppress warning message when not needed
We have done the same thing when calling SetProcessDpiAwareness(),
but it's also needed for SetProcessDpiAwarenessContext(), otherwise
there will always be a warning message when the user uses a manifest
file to set the DPI awareness mode for the application (which is highly
recommended by Microsoft).

Change-Id: I31894d41c89581b6edd7826cb3dabad492f6c2a8
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 19857fda75d049e64e39ff353d7f5ed3bd342d61)
2022-12-01 09:28:30 +08:00
Alexey Edelev
210e036488 Add INTERFACE_LIBRARIES to dependencies of repo targets
Building repo targets may be incomplete as we skip adding
INTERFACE_LIBRARIES as dependencies. This leads to the missing
artifacts belonging to HEADER_MODULES. It seems reasonable and safe to
include INTERFACE_LIBRARIES in the list of dependencies of the repo targets.

Task-number: QTBUG-108815
Change-Id: I83f44018f42dcf2fb1e3299461e17ef53e79c2e5
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit ada76ac8b6ef6f4e8e6b60569c3d424aab335c3a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-01 01:24:07 +00:00
Alexey Edelev
e526d0116c Remove QMAKE_RANLIB and QMAKE_LINK_SHLIB from android/default_pre.prf
The values should come from android-clang mkspecs. The hardcoded
values don't work correctly with recent Android NDKs.

Fixes: QTBUG-108662
Change-Id: Ie153a50ee0c49bd4f0704b588a4e2c87a05c1063
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 49f62e8c5a8aef4c0b7fd6867a30e653d2f5dd98)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-01 01:24:05 +00:00
Alexey Edelev
303ee558dc Allow lists in the BUILD_OPTIONS argument of _qt_internal_test_expect_pass
Adding the list definition to BUILD_OPTIONS requires unpleasant
escapting. This avoids an extra expanding of the BUILD_OPTIONS
argument and allows using the bracket-based escaping for semicolons.

Change-Id: Ic5ff97c011fb67f61c66ad4e1a2ba43f44462932
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 6aab2a58e6bffb2c0e21e3e9ad64b9396a9d6a82)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-01 01:24:03 +00:00
Fabian Kosmale
518118991f Temporarily skip tst_qtcuncurrentrun::pollForIsFinished in emulator
This test causes instability in the CI, but so far nobody could
reproduce it outside of that specific CI environment. Skip it for now,
and investigate the root cause later.

Task-number: QTBUG-106906
Change-Id: Idbbc560236ac475fcb4fdd5980397393f7a95474
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit fbf55619daea26dadb600100e87da48eef3dc714)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-30 17:23:28 +00:00
Volker Hilsheimer
d63612a8ac Fix typo in documentation, silence qdoc warning
qdoc was telling us that it can't link to "Adding OpeSSL Support for
Android", because there is no such thing. Fix spelling of OpenSSL to fix
the link and silence qdoc.

Change-Id: Idb583b6b7360c4e37c7e79c3d70327e99d7189bc
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 41c5178c646f1eaf97453fb059e7330f89bcef38)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-30 17:23:28 +00:00
Thiago Macieira
45ab695415 QMutex: remove qmutex_win.cpp
It hasn't been used since 91f6460aff0a6ab5142f16d5f4fc1f559ca1c325, a
commit that added support for futexes on Windows. It defines
QT_ALWAYS_USE_FUTEX.

Change-Id: Ieba79baf5ac34264a988fffd172612892bd670d7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit b6e30e9fee98f9cdfec4c54c980864f65632519c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-30 17:23:28 +00:00
Eirik Aavitsland
a5be86897f Finish the undeprecation of the QColor(string) constructors
Fixes: QTBUG-108743
Change-Id: I826ae98a542516a5cf9a4e556d5e8830f9c47a86
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit fb35c54b1e8e02329a40e7a5c473bde56038206c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-30 17:23:28 +00:00
Eirik Aavitsland
ff52558530 Update bundled libpng to version 1.6.39
[ChangeLog][Third-Party Code] libpng was updated to version 1.6.39

Change-Id: I0113fb071d344049976953253adb4d898a1bb7c6
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit f6fefbc6caf2d7a8ab0b965626905efc1a32c397)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-30 17:23:28 +00:00
Friedemann Kleint
4f0bd0d4f9 Documentation: Fix information on how to iterate over lists
Remove the outdated code used for QStringList and point
QStringList and QList to the containers page.

Task-number: QTBUG-108687
Change-Id: I6fae6410ca759f91da85832ddb9f24e8a0ce202b
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 4a6ce541c59cfaabb5c68066d0e19912032e48df)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-30 17:23:28 +00:00
Friedemann Kleint
24da759c3d Documentation: Expand documentation on how to iterate Qt containers
Introduce a section on iteration and add range-based for and index.

Task-number: QTBUG-108687
Change-Id: Icb1ff55049361769f7c0b042d42f70148dd07c2e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 39d86e05e1acb228848d7e54163d2c856e029539)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-30 17:23:28 +00:00
Friedemann Kleint
8aeee132f5 Documentation: Modernize the Qt container doc snippets
Use auto and initializer lists. Avoid repeated instantiations
of end().

Task-number: QTBUG-108687
Change-Id: I8482638cda63e21feaa7ca21370e7947dfb4b606
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 56c8033d3e6b7874c046fdddc27e80e3ee3c0055)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-30 17:23:28 +00:00
Axel Spoerl
7b9f01e0f4 Stabilize flakiness in tst_QWidget::raise()
The test function raise() occasionally failed because of unexpected
paint events being counted.

This is due to a QTRY_VERIFY returning after consumption of the first
paint event. If more than one paint event got posted, it will be
delivered and counted when no more paint events are expected.

This patch ensures that all paint events are consumed before resetting
the count and expecting no more paint events.

Fixes: QTBUG-68175
Change-Id: I3e91a34e851da4bd01c7429e824d2b9101077a06
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit a45a1b8674d0982828d75440041a67fdb3da74f9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-30 14:29:12 +00:00
Axel Spoerl
08f754d923 Add simple palette to tst_QWidget
When a widget's palette has different active / inactive colors,
multiple paint events can occur. This makes tst_QWidget functions fail
when they expect a spcific amount of paint events and the platform
theme provides a palette with active / inactive differences.

This patch adds a function to populate test widgets with a simple
palette, to prevent multiple paint events.

Change-Id: If9b2faedcc5ca87ba24991cedd5e4ac927b02644
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 1576f827214cca8a2233f3c81e7d0e3d89eb8007)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-30 14:28:39 +00:00
Axel Spoerl
9f1d4b2e52 Stabilize tst_QWidgetRepaintManager on XCB platforms
When a widget's palette has different brushes in Active / Inactive
color groups, or it is pixmap based, multiple paint events are
triggered. This leads to unpredictable, double entries in
QWidgetRepaintManager::dirtyWidgetList().

This patch overrides event() of all test widgets and ignores
activation / deactivation events in order to make the entries of
QWidgetRepaintManager::dirtyWidgetList() predictable.

Change-Id: I164d7ab4148551590ac3c50fcc3b9f98c5ac0535
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 58b1984efc99d96a56f97bb9156a8c0f245b71ca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-30 13:49:13 +00:00
Andreas Eliasson
150b94d4d2 Doc: Remove qtestlib-tools section
qtestlib-tools is dead.

Fixes: QTBUG-107806
Change-Id: Ic479b9e133c1889a046d1b7483af9d8ad8ac4968
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit ef1c1132e677ba6a8a2d2e56be0e549978ad08e1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-30 13:49:11 +00:00
Giuseppe D'Angelo
afc4df5222 QStringView::split: doc tidies
QStringView is a borrowed range, so views into it are always valid,
even if the QStringView itself is destroyed. Clarify the comment.
Fix another typo (referring to the view as "string") as well.

Change-Id: I8a4f45494d44d5a47e3c1f764f12c899ad7ee83d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: hjk <hjk@qt.io>
(cherry picked from commit 3ccd1d2d835a623acff2b6ac52f8b1d5ec9ce108)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-30 13:49:09 +00:00
Andreas Eliasson
e97cc54f70 Doc: Fix typo and mismatch between code and description
Fixes: QTBUG-107675
Change-Id: I38140617a2b0525db417137aa41a52a389b3bea3
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit de7287be69b449b1da13148e62fbeef0406eb792)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-30 13:49:08 +00:00
Axel Spoerl
d982f5211b Blacklist tst_QWidgetRepainManager functions flaking on XCB
QXcbBackingStore::toImage() returns a QImage that differs from what
is displayed on the screen: After multiple moves of children within
their parent widget, the last move is not always properly reflected
on openSuSE 15.4.

This patch blacklists the test functions fastMove, moveAccross and
moveInOutOverlapped on openSuSE Leap.

Task-number: QTBUG-109036
Change-Id: Ideb505570df090b25d30762492d9c60beb6641ff
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 8071e3c2af77dbf77dd316e9b13b739f3835c3c4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-30 13:49:05 +00:00
Volker Hilsheimer
aa45401ffb QPalette: always increase serial number when modifying
After 109e088c7c5d0c9325966e88d55fd9f7a58f67ea, cache keys were unique
for palettes with different private or data instances, but the key did
not change when a palette without any shared copies was modified, as
that does not create new private data structures.

To fix this, always increase the counter for the private data structure,
also when not detaching from shared copies.

Augment test case with scenario that broke.

Fixes: QTBUG-108709
Change-Id: I606abfb8b1a03e515e46b10dc840a631eb31d496
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: JiDe Zhang <zhangjide@uniontech.com>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
(cherry picked from commit ef379f95c7621272933b06fb3edfe502b14bd145)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-30 13:20:35 +00:00
Axel Spoerl
e143664c91 Set simplePalette on staticWidget in tst_QWidget::optimizedResizeMove
It was forgotten to assign a simple palette to this object in
1576f827214cca8a2233f3c81e7d0e3d89eb8007

This patch adds the missing line.

Change-Id: I0acf765d9646ecc8d49791d96b5ea910e11997fe
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 612c8e428e2c4738bd9da029103921bef536f2ac)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-30 12:48:06 +00:00
Morten Sørvig
ca0f0a43e9 win: resolve theme fonts at 96 dpi
This code became out of sync with the changes to the
LOGFONT_to_QFont() implementation introduced in edb00660.

After that, LOGFONT_to_QFont() on longer adjusts the font size
according to the DPI for the primary display. This means that
the the code should also not get font metrics from the first
display, but instead get metrics at 96 DPI.

Fixes: QTBUG-105857
Change-Id: I5974a77593e1944d889a45a352923fb9aa9a0dec
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 64bb83f882391fbfd4bf88ce5673b3f1c82bfdf6)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-11-30 12:52:56 +01:00
Vladimir Belyavsky
192330439a QSystemLocale[Win]: Catch potential WinRT exceptions
Some Windows SDKs seem to throw an exception from winrt::check_hresult()
We need to handle this accordingly.

Fixes: QTBUG-108605
Change-Id: I14ad3b6dbd9b5fdf0120f9d3336a4d922167d169
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 7d7ed24f517aff2f4bf9f2e32a29603476af6c88)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-29 18:37:20 +00:00
Vladimir Belyavsky
d9c1ab0bf5 macdeployqt: Fix QtMultimedia plugins deployment
It was not updated accordingly after QtMultimedia redesign in Qt 6.
This wasn't a real problem because multimedia plugins were
eliminated in principle. But it was true only until Qt 6.4, where
plugins system for multimedia backends has been reintroduced.

Fixes: QTBUG-108742
Fixes: QTBUG-107057
Change-Id: I31be5fc20e5bdf8050c04a30492e80d96eb437fb
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
(cherry picked from commit 5cf72ee6abd27398b64cb3476a3690b93babdcec)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-29 18:37:14 +00:00
Ilya Fedin
30e09fce19 Fix QIBusPlatformInputContext leaks
QIBusPlatformInputContext re-creates various objects on ibus restart,
but never deletes them.

Sometimes this leads to multiplied input
(the same character entered multiple times).

Change-Id: I34a898bfe56b19f9d76752c649e3aa64c77ae11a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7ea689c613c77aba2fbb638804b449749de38dd8)
2022-11-19 01:26:55 +04:00
Marc Mutz
52ee7f9742 tst_QMap: remove unused std::as_const clone
Amends d273076b4474bb473d90e996960c4c773745761a.

Change-Id: Icfff438223ed10756f15e25ea52cccdf93dd47a2
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 0786405857d79f009136197d8c795750a28bf0d4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-18 17:28:51 +00:00
Marc Mutz
3a07c39184 Port from qAsConst() to std::as_const()
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally
starts to bother us (QTBUG-99313), so time to port away from it
now.

Since qAsConst has exactly the same semantics as std::as_const (down
to rvalue treatment, constexpr'ness and noexcept'ness), there's really
nothing more to it than a global search-and-replace.

This is a 6.4 re-run of the script we ran in dev, in order to avoid
conflicts between the branches when cherry-picking.

Change-Id: I5eca3df3179dfb2b2682c75a479ba9a4259cc703
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-11-18 13:59:41 +01:00
Marc Mutz
c5f3c61469 Port from container::count() and length() to size() - V5
This is the same semantic patch (qt-port-to-std-compatible-api V5
with config Scope: 'Container') as in dev. I've re-ran it in 6.4 to
avoid cherry-pick conflicts.

Like in dev, added two NOLINTNEXTLINEs in tst_qbitarray and
tst_qcontiguouscache, to avoid porting calls that explicitly test
count().

Change-Id: I9621dee5ed328b47e78919a34c307105e4311903
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-11-18 13:59:33 +01:00
Marc Mutz
4fd2c8fe1d QString: rename parameter clashing with member function of the same name
The size parameter shadows the size() member function, so rename it to
newSize.

Prepares for a follow-up change that ports from count()/length() to
size().

Change-Id: I0ca8af57d6351f85a568409a8d02b66371bb05e7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit e1d21fe813c4c9c3f53e59c08190f80b38e385da)
2022-11-18 13:59:17 +01:00
Dennis Oberst
04f6f4afa9 Update bundled zlib to version 1.2.13
zlib 1.2.13 has been available since October 13, 2022.
Also fixes CVE-2022-37434.

[ChangeLog][Third-Party Code] zlib was updated to version 1.2.13.

Fixes: QTBUG-108130
Change-Id: Iaa2a9486f1cbbcd6a23d48df632e01bc05b414d5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit f678893f8acd00bd0caca5101858e2a9fdf96a5c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-18 12:14:32 +00:00
Kai Köhne
19881238bf Doc: Normalize page names
qdoc does enforce lowercase file names for .html pages, and also
replaces underscore with a dash. Make sure that the original \page name
already is normalized, so that it's easier to search.

This was done by
  find . -name "*.qdoc" -exec perl -p -i -E "s/\\\page (.*)/\\\page \L\1/ && s/_/-/g" {} ;

Change-Id: Ib50b85af8ffd985edf06856266eefdebf8b328a3
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Luca Di Sera <luca.disera@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit 3834fee3d33fde303c0a1535c1ef0439aa05c6b0)
2022-11-17 16:31:12 +01:00
Fabian Kosmale
c2750da343 moc: Add basic support for nested inline namespaces
This improves moc's support for nested inline namespaces, so that code
containing them will not break compilation.
For simplicity, we allow nested inline namespaces even in C++17 mode
(the actual C++ compiler will reject the code anyway, and probably with
a better error message than moc could output).
moc still has no real awareness how inline namespaces work, but that is
a preexisting issue.

Fixes: QTBUG-106920
Change-Id: I7b415a99133575f101bc81d01d4670a5f752917f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5222df2be7d10bf44dfc2971774eadcb526b7a13)
Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
2022-11-17 11:19:11 +00:00
Alexey Rochev
0d6bff7d0f Fix build with -no-feature-settings
Change-Id: Ia79e5e616a1c35da299c00766e960789c7b60695
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit a0110f381907add3c8acabfa58c4b9357439fa39)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-17 07:30:39 +00:00
Axel Spoerl
4aeb2674e4 Replace warning with debug message in dockwidget high DPI mapping
When a dock widget is moved between high DPI screens, it's native
position is calculated and applied. The calculation falls back to a
mapping without high DPI, if the dock widget's initial position cannot
be mapped to a QScreen.

A warning was emitted in that case, to inform the user about a
potential screen misconfiguration (e.g. a physical screens not being
mapped exactly next to each other, leaving a gap). Despite of the
warning, the position calculation safely falls back to non high DPI.

The warning also kicks in when the dock widget's top left position
is located outside a screen, hence being invisible.

Since calculating an invisible top left position is possible without
high DPI mapping, this patch replaces the warning with a
debug message.

Fixes: QTBUG-108311
Change-Id: I692034e5aeb5f7a94cca519ce055795fa72ea216
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit d655391d010952c75674c7adb8303d5f0375610d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-17 06:52:35 +00:00
Jani Heikkinen
e82a996abf Revert "Add binary compatibility file generated against 6.4.0"
This reverts commit 6b4265454a2526cad4edffbe20ecc5d4cddcb2cc.

Reason for revert: QTBUG-108470

Change-Id: Id9574846adebddcb2d582373a01b1e9ede0a311b
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2022-11-17 06:25:28 +00:00
Alexey Rochev
31e31b6fb0 Core: always link with CMAKE_DL_LIBS
`dlopen` feature is used in qlibraryinfo.cpp without `library` feature.
Change condition that adds libdl library to make sure that we can build without `library` feature.

Change-Id: I5051e6b2e0a8daae5f7e269ed8980df99ecaa192
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c083cf9309a152d8d119e6ff26693b098189322e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-17 00:25:33 +00:00
Thiago Macieira
0ff4e7d4a3 QLocale: make qstrnto(u)ll not have output arguments
That is, return everything in the return argument. On the SysV ABI, that
means everything gets returned in registers, in both 32- and 64-bit
platforms (unlike QtPrivate::ParsedNumber). There's a minor but
perceptible performance improvement in parsing strings and byte arrays.

Before:
Parsed string   "42"    "1234"  "-1548860221"
Clock (ns)      16.673  18.878  25.517
CPU cycles      46.548  52.704  71.243
Instructions    201     233     331

After:
Parsed string   "42"    "1234"  "-1548860221"
Clock (ns)      15.577  17.998  24.198
CPU cycles      43.491  49.942  67.552
Instructions    179     211     308

On my Core i7-1165G7 @ 2.80 GHz, the 22-23 instruction gain per
iteration results in half the expected clock gain in runtime (22 /
2.8 GHz = 7.8 ns) because of a slightly lower instruction per cycle
rate. That's acceptable because we need less speculative execution.

Task-number: QTBUG-107788
Change-Id: I07ec23f3cb174fb197c3fffd17220fd64d473cc0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit d50d34e5de7f5cf5e34243210e3df519974d7794)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-17 00:15:43 +00:00
Thiago Macieira
1f92a4005c QString: rewrite toDouble() and toFloat() using QStringView
The implementations are identical. Just reuse them. And move the two
QStringView functions closer, instead of where they are today which
lacks apparent motivation.

Change-Id: Ieba79baf5ac34264a988fffd172675ac3584f94b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 308f9ae8f041e0cac47fdca55f1172a7d3ea892d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-17 00:15:42 +00:00
Timothée Keller
b54689f8a8 Update list of windeployqt modules
Added QtMqtt and QtPdf to the windeployqt module list

Task-number: QTBUG-105135
Change-Id: Ic8a8a0c157663088341ed5a1a417dcb57a717286
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 1498c820738577e19659d8feec0d61a131bbdd92)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-16 12:07:42 +00:00
Christian Stenger
eea9bf2e89 Widgets: Fix high dpi hover icon
Amends aa5a595a98f.

Change-Id: I4ba7744e70d7d9de2d0b562a67b3828a72940306
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 84cc3b3cad9eff4a9087f6f301b49268eee7c721)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-16 10:47:41 +00:00
Mårten Nordheim
afd88fba7d QNetworkInformation[win]: Capture another potential exception
As reported by a user.

Fixes: QTBUG-108382
Change-Id: Ic94c65d533edd84c8fda5d713d9579a9492b88ae
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit da0587c43a611cd5d74119ee4a62d0a8767b4d8e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-16 06:47:34 +00:00
Edward Welbourne
7cb3fa767d Add benchmarks for QLocale number parsing
Based on those for QString, but with locale variation and exercising
some of the locales with multi-character signs and exponents.

Change-Id: Id0253449f9abcc154285f89337aa0e26dd69900d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit cf36db4df9d4f760f6cb41f49921aee64f06ef10)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-15 14:18:13 +00:00
Edward Welbourne
10afd65138 Add benchmarks for QString number parsing
Based on the tests for QString::number(), but run in reverse, with
some embelishments. Also moved some shared code from number_*_data()
to their shared number_integer_common template.

Change-Id: I74e7082372166c3cdbcd6bcbc31f9003e07cbcbc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 7fef433004f7ebde47c1ac80d98c6abac82f2eea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-15 14:17:49 +00:00
Santhosh Kumar
3ce2e00891 Apply system background color for top level window
Repaint top level window with system background color when it shows up
first time. The system background color will be affected by dark or
light mode settings in windows

Fixes: QTBUG-106583
Change-Id: I9205335540e74e90bb068e30fc3d4db037fd580f
Reviewed-by: Yuhang Zhao <2546789017@qq.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 2991c66b75612dfb11dbba166dd08b2376b42102)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-15 14:13:33 +00:00
Lorn Potter
13917772f0 wasm: unblock virtual keybaord
QtVirtualKeyboard can be used for non touch apps as well. We were not
taking this into consideration and only allowing touch devices to
access it.

Change-Id: I17fcb360b6655ace4fba7447eb85561ba75338a5
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit a9f94d078a94ca15adf4d8143cba52c4369d45d5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-15 02:03:15 +00:00
Johannes Kauffmann
f6ce72849b tests: fix build with -no-feature-concurrent
Change-Id: I91602931bfb63e7d6659599a26e00e0bc4f854ab
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit c958e5daf18b069f5f1f40c71e3e45fe68d30d03)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-14 20:03:34 +00:00
Laszlo Agocs
d58ac206a8 Fix rhi flush eval perf. and native window problems
This effectively reverts a4a51f6a641f4bf0a863251d6d3e026d81de6280
while solving the problem that change intended to fix by an
alternative approach: Swap the order of checks for rhi-based
flushing. Checking the widgets' wishes first was a mistake.  We should
first check what is forced, e.g. via the env.vars.  Then only move on
investigating the child widget hierarchy if there was nothing specific
requested.

This way having a QOpenGLWidget in a window and running with
QT_WIDGETS_RHI=1 QT_WIDGETS_RHI_BACKEND=vulkan will prioritize the
forced request (Vulkan) and so the QOpenGLWidget will gracefully not
render anything while printing the expected warning to tell what's
going on.

The expensive recursion plaguing the construction of larger widget
hierarchies is now avoided, that should no longer take seconds due to
walking the entire widget hierarchy of the top-level window every time
a new widget is added to it.

However, this then uncovered a set of problems concerning native child
widgets. The repaint manager seems to have an obvious mistake where
the usage of rhi (and so textures and whatnot) is decided based on
'widget' (which is either a top-level or a native child) instead of
'tlw' (which is the top-level with the backingstore). The usesRhiFlush
flag only really matters for a real top-level, not for native child
widgets.  The rhi-based flushing is tied to the backingstore, and the
backingstore comes from the top-level widget.

Finally, make the qopenglwidget autotest to actually exercise
something when it comes to QOpenGLWidgets (or their ancestors) turned
native.  The original code from a long time ago does not really test
native child widgets, because it turns the top-level into native which
is quite superfluous since the toplevel is backed by a native window
(and a backingstore) anyway.

Task-number: QTBUG-105017
Fixes: QTBUG-108344
Fixes: QTBUG-108277
Change-Id: I1785b0ca627cf151aad06a5489f63874d787f087
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 244daf4cfc44587c8c7c87e481688e840cc21c77)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-14 15:26:43 +00:00
Shawn Rutledge
852c40f290 QTextDocument::loadResource(): invoke parent via direct connection
If QTextDocument::loadResource() gets called from a different thread
than the thread that the QTD object (and *necessarily* its parent, if it
has one) live in, we would get the warning "Unable to invoke methods
with return values in queued connections". Rather, ensure that it's
invoked only via a direct connection.

Amends ac300a166f801a6f6c0b15278e6893720a5726f8

Task-number: QTBUG-35688
Change-Id: I35644f7cd54b1f40362d3d45c2a120883f7a2e61
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 963f3c678ca8282bd3e1d8af5f8669baaddb1686)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-14 08:04:20 +00:00
Volker Hilsheimer
bc9b03a43b Windows: Inform accessibility system about the focused child item
When a complex object (i.e. one with children that are themselves not
fully exposed objects) gets focus, then we need to inform the
accessibility system about which child object actually has focus. This
was only done for item views, but not for other complex widgets.

An editable QComboBoxes is the focus proxy for its line edit. The line
edit never gets focus itself (QComboBox forwards relevant events),
and is the accessible child item with index 1. So when an editable
combobox gets focus, it needs to raise the automation event for the
line edit child.

Implement QAccessibleComboBox::focusChild to return the interface to the
lineedit for editable comboboxes so that the UI Automation bridge can
correctly notify about the focus being moved to an editable text input
field.

Fixes: QTBUG-107572
Change-Id: Id60e2791ec859365255baa9bfd01547979cd2b44
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit b58876c296a5a87f50d5e554afc277e5bc752a16)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-13 13:47:32 +00:00
Thiago Macieira
fe0bee6f9f Gtk3: fix stack smashing on mismatch between bool and gboolean
Glib is written in C and predates C99 (though not really, glib 2.0 was
released in 2002), so it defines gboolean as int, a 4-byte type. C++'s
bool is a 1-byte type, so this caused a buffer overflow.

Problem introduced in 2b77e779ce43386d14bdd2d1109ee182bcd0d047
("QGtk3Theme: implement appearance function to detect dark themes").

Change-Id: Ieba79baf5ac34264a988fffd172650701fa54da8
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 28d9f05fa1593b252e98965c8a4c6c4c7c2cf4a7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-12 16:58:06 +00:00
Marc Mutz
200b9d2e81 [doc] QRasterPaintEngine: remove docs for QSpan
Nothing in this class uses it, so there's no reason to document the
typedef. It will just confuse both the compiler and the user when we
add QSpan (a std::span implementation).

Task-number: QTBUG-108124
Change-Id: Iff0249d2e12a05fca15998a046a0b1bf607b60be
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 735048051933bc30a3a0398ba40f86e4b6ba72d2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-12 11:55:20 +00:00
Mårten Nordheim
21b8d6ae32 QNetworkInformation[Win]: Fix potential use-after/during-free
The WinRT NetworkStatusChanged callback may happen during or slightly
before we unregister our token, which we usually follow up by destroying
the object. So we have to avoid potentially doing work on a deallocated
object.
Do this using the old QPointer-trick. Neither me nor reporter can
reproduce it locally, so this is only a best-measure.
Further problems may be that the storage for the lambda has already
been destroyed and repurposed, in which case the pointer may be valid,
but junk, which would lead to another crash. But this is unavoidable as
long as MS does not synchronize callbacks with (un)registering new
callbacks. To attempt combatting this we hold our own lock around
unregistration and the "meat" of the callback.

Fixes: QTBUG-108218
Change-Id: Iacf8b8f458cca3152ff395e9a38e8df193534f46
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 7898de4258e06671feb84cfd0b746009b64f7f0d)
2022-11-12 10:22:17 +01:00
Milla Pohjanheimo
6b4265454a Add binary compatibility file generated against 6.4.0
Generate bc file using the "new way".

Task-number:QTBUG-106331
Change-Id: I70d2c0e5026636deee1b8389f50f51e075187b76
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit e36abea63bd6732e2d9bacbe155ec547c3367377)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-11 08:30:11 +00:00
Tang Haixiang
0fecbc0f4b QTextLayout: Reconsider cursor drawing on TextObject
Revert: e99a883bd382ca950192bd66cafb2a1de6394ce7
Revert: 33238ea2c63b372ee8795eaafbfc5a859a778f8d

These two commits made the drawing of the cursor incomprehensible,
but their purpose was to fix the problem of abnormal cursor drawing
when QScriptAnalysis::Object is present. Because objects require
some special handling, they can be specially aligned or floated.

Anyway, the alignment is already reflected by ascent and descent,
and when drawing, y = position.y() + (sl.y + sl.base() - base).toReal();
works fine. So roll them back now.

We just need to specially consider the case where the QScriptItem is a
QScriptAnalysis::Object, keeping the base and descent the same as the row.

Task-number: QTBUG-92468
Task-number: QTBUG-86823
Task-number: QTBUG-96288
Change-Id: I6d9a0e00fbc3823e0cc8e0e8bd061da5782d1f8a
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit de16300661bc498eb02d8d5b36ccc07ebe595ca2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-11 08:30:11 +00:00
Laszlo Agocs
9aa0e21db9 Remove unused internal rhi backingstore parameters
There is no user for these at this point: QOpenGLWidget does not
need any of these by nature, whereas QQuickWidget is also currently
in the works-as-is category, it has no need to communicate the need
for additional Vulkan device extensions for example.

Task-number: QTBUG-108277
Change-Id: Idc09552027377a21a0e904fbb9bfbd95c3d0e0a1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 3916c57718239793d0e5cad67f04bc9155b58408)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-11 08:30:11 +00:00
Fushan Wen
bad9d473d3 Send accessible focus event after list view has focus
QListView::currentChanged sends an accessible focus event even if the
list view doesn't have focus. For screen readers like Orca, accessible
focus events will be ignored if the target item does not have focus
when screen reader receives the event.

This corrects the behavior by calling QAbstractItemView::currentChanged
before sending an accessible focus event.

Change-Id: I71732f62e2f27d7856b4781b268495b88b24b715
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit 2cf5253b91d5269e387c68d06f58f00ec36e80c0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-11 08:30:10 +00:00
Volker Hilsheimer
32af1fe7d3 macOS: delay initialization of small font
During construction of a QStyle, QApplication might not yet be
initialized, e.g. when calling QApplication::setStyle("macOS") before
constructing QApplication. In that case, we cannot access the platform
theme.

We don't just want to skip initializing the small font either though.
Store the smallSystemFont as a std::optional so that we can initialize
it once, when the first widget gets polished.

As a drive-by, remove the unused miniSystemFont variable.

Fixes: QTBUG-108047
Change-Id: Id750770a563611fdbc6c7031fe102a99ea692be7
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
(cherry picked from commit 2bdc027f5c6be9c551d40c80e510b19b6e2939a7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-10 22:38:26 +00:00
Alexey Edelev
f71c4df4b2 Make sure that module can be imported by the provided QML import path
When resolving QML module dependencies we scan the produced by the
build system import paths for the required QML modules. Previously the
check in androiddeployqt only was confirming that the required import
starts with the one of import paths. This worked well unless the
required import is nested in higher level import path. In the situation
when we have the following build structure:
  build_dir/
    imports/
       MyModule/
          ...
and both 'build_dir' and 'build_dir/imports' directories are in QML
import paths, the MyModule QML module is resolved by the
'build_dir/imports'. But androiddeployqt assumed that it's found by
'build_dir' import path and copied the whole 'imports' directory as
the 'MyModule' QML module. The resulting bundle then had the
following content:
  qml/
    imports/
      MyModule/
        ...
  ...
instead of the correct one:
  qml/
    MyModule/
      ...
  ...

This checks if import path contains the required url-based module
path before using it as the base directory to copy the module.

Amends 0a73fb10005053945571e6cdb0b03d916715c112

Fixes: QTBUG-108194
Change-Id: I79e1a8a67f62e5ae4a899ba1a4f49ee4ad44ebf9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Dominik Holland <dominik.holland@qt.io>
(cherry picked from commit 10372c074bf2975ccb5e4afd3bba0f2738e0a1d5)
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
2022-11-10 12:22:49 +01:00
Tor Arne Vestbø
105e53b62b tst_QGraphicsEffectSource: Reset effect repaint count after flushing events
Follow-up to 8222e06d12a4e2a84ce1161abd0ceb58622c740b, which only reset
the item repaint count.

Flushing the queued paint events will bump numRepaints, and the whole
point of calling reset() is to prepare a consistent state before the
next test, so we need to call it after flushing the events.

Change-Id: Id1fe840c14c0940d7020cf8f8cc6a3aeceaa5fb5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit fe67c69643ff72be0a32ed8bbb4f8ca827ce53c7)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-11-10 12:10:05 +01:00
Tor Arne Vestbø
be36a0e284 tst_QGraphicsEffectSource: Reset repaint count after flushing events
Flushing the queued paint events will bump numRepaints, and the whole
point of calling reset() is to prepare a consistent state before the
next test, so we need to call it after flushing the events.

Change-Id: Iaefc9854caafe82c65c9587e18fd081439e8dda6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 8222e06d12a4e2a84ce1161abd0ceb58622c740b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-10 12:10:03 +01:00
Bartlomiej Moskal
1b9efeddb5 Android: Do not override app_pal by AndroidPlatformTheme
It may happen that other styles (especially QtQucik styles) apply
different palette for applications. In such case AndroidPlatformTheme
should not override it when Light/Dark mode is changed

Task-number: QTBUG-83185
Change-Id: I6a3b7ee047fcd729be03271a7202cd260360f83b
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 153a3245dcd5a986f5a2f4453d8d16da04663013)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-08 15:47:01 +00:00
Jan Grulich
1958c523e9 Gtk3Theme: set XCURSOR_SIZE and XCURSOR_THEME for wayland sessions
GNOME doesn't set these for Wayland session and without those env
variables set users might experience broken cursor with Qt apps
as QWayland reads them to setup QWaylandInputDevice.

There is no cursor protocol available on Wayland yet, see also
https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/58

Qt Wayland QPA plugin still tries to load from those two envs.

Fixes: QTBUG-67579
Fixes: QTBUG-87778
Change-Id: I4e7f6871b56599170b12e796858238b1df6d47d1
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit c0b0c7bebb73e1aa609196ce33668a54bd5e0aef)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-08 14:04:42 +00:00
Timur Pocheptsov
c28ad246d1 getProxyAuth: stop using deprecated API
A new SDK marked several functions in SecKeychain family as deprecated.
Fortunately for us, Security framework on the whole is not deprecated
and thus provides an alternative API to inspect keychain items, and also
much nicer one - instead of having a function with 15 parameters, those
parameters are 'collapsed' into one, the 'query', which is a dictionary.

Fixes: QTBUG-108196
Change-Id: I602d1a846ff9683cac724859a776de2b901f5c1c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 02b9033d50def3b4c70a4f0504b5894d4249be1b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-08 14:04:42 +00:00
Tor Arne Vestbø
1c0652da28 tst_QAccessibilityMac: Wait for accessible window to become available
It may take some time before the shown window is available through the
accessible hierarchy, so do an asynchronous test for that to happen.

Change-Id: I3f312ae636505b805899973678b1bf10a65f96b3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e4147992df243dbd2e7049a109b840928c4f256a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-08 10:12:15 +00:00
Tor Arne Vestbø
9e31cca206 Merge Objective-C++ parts of tst_QAccessibilityMac into main source file
There's no need to split it, we can use the -x compiler flag to build
the .cpp file as Objective-C++, or, as done here, just rename the file.

This allows us to use QVERIFY and friends, giving more precise failure reporting.

Change-Id: I6fb1c4454335082c8a39010c5b75c59e6ec6561b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit 16b9f9a9aaf7455fe3134d4517511c280aad3ee9)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-11-08 11:12:15 +01:00
Jani Heikkinen
a120999765 Bump version to 6.4.2
Change-Id: I2c5b54e16117810e9d6bc73f76d75e7e0a89cc49
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2022-11-08 12:12:15 +02:00
Samuel Mira
50a426ddc1 Android: Fix incorrect fullscreen dimensions
The insets used to calculate the correct height were not the best
choice. It used display cutout insets which would work correctly on
most devices, but in the case of an emulator or a device without a
camera, it could fail to calculate correctly.

Task-number: QTBUG-107604
Task-number: QTBUG-107709
Task-number: QTBUG-107523
Change-Id: I8c4da83ae7359a0c133dbeb02dbd2cd260565f78
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit d53ea82950e0662b8265642b840a12d9f9556888)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-07 14:22:20 +00:00
Timothée Keller
0541b9769f Update list of windeployqt modules
Added QtCharts, QtDataVisualization, QtRemoteObjects, QtScxml, and QtNetworkAuthorization to the windeployqt module list

Task-number: QTBUG-105135
Change-Id: I16f2897583518c4577eeeda2dc0a6f413fef9794
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit cbd688d4102c4df2e6e49fc2b287594c34ee23fb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-07 14:22:18 +00:00
Mårten Nordheim
a065ef89f3 QMetaType: Document the default ctor
It wasn't showing up in documentation.
Amends 33cd680ddbaccf6139e215d851a39e657ae36394.

Change-Id: Ifb5d38fd3d4eb2ecd109ce53809fae5382916dff
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 47576af3489690551915b3ee3d15affd5f8fb579)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-07 11:26:24 +00:00
Thiago Macieira
9b210c6ce2 QByteArray: move the high-memory-using and slot tests away
Otherwise, tst_QByteArray takes 97 seconds on my laptop to run. Makes
design iteration difficult.

Change-Id: I07ec23f3cb174fb197c3fffd17220e6737907415
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f642bdf69e2cc53680f139b56b0b64b0fd74fd5d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-06 03:36:19 +00:00
Volker Hilsheimer
28324c0a0b Fix focus chain with compound widgets if created out of order
When a compound widget is created not directly before its children,
then another widget will be in the focus chain between the compound and
the compound's first child. If one of those children is then made the
focus proxy of the compound, then the widget in between becomes
unreachable by tabbing.

To fix this, detect that we set the focus proxy to be a descendent of
the compound widget, and then move the compound widget directly in front
of its first child in the focus chain. This way we can't have any gaps
in the focus chain.

Augment the test case with a corresponding scenario. As a drive-by, move
the debug helper up in the code so that it can be easier used, and set
object names on relevant widgets.

Fixes: QTBUG-89156
Change-Id: I17057719a90f59629087afbd1d2ca58c1aa1d8f6
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 46648436d4dae529b81f5d7a987c0016cf54bf6d)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-11-05 12:23:58 +01:00
Mårten Nordheim
a009aa97b1 QNetworkInformation[Win]: Catch potential exceptions
Some Windows SDKs seem to throw an exception (sometimes?) when
calling ConnectionProfile::NetworkAdapter.
Catch the exception and ignore it, we would return Unknown anyway.
And just in case it is needed, do the same for GetConnectionCost.

This requires enabling exceptions for the plugin.

Fixes: QTBUG-108156
Change-Id: Ie6c5adb3715578aa94ef3391afae79d9aecdc5d3
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 35e54f9b7bba9ad7b1757e0b8f7d03859a694b34)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-04 21:39:46 +00:00
Eirik Aavitsland
7f2fecba4f Handle allocation failure in QImage rotate 90/180/270 functions
Fixes: QTBUG-108186
Change-Id: I354e75d9f063cdea0340b84e9585a61651a7c70f
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 7c4b3648cad7faf990397af0b8a81664658c2d4f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-04 21:39:31 +00:00
Tor Arne Vestbø
c3fd2da7fb Apple: Add CFBundleAllowMixedLocalizations=YES to Info.plist files
We currently don't have any machinery for qmake or CMake to map
translations declared via TRANSLATIONS += or qt_add_translations
to the Info.plist CFBundleLocalizations key.

This results in macOS and iOS falling back to the development region,
CFBundleDevelopmentRegion, as the only supported localization of the
app, which is in most cases set to 'en'.

Unfortunately this doesn't work well with the behavior of iOS 11+
and macOS 10.13+ where the OS will set the locale of the app to
the best match between the app's supported localizations and the
user's preferred language.

https://developer.apple.com/library/archive/qa/qa1828/

Since we only support a single localization, the development region,
the locale always ends up as 'en_<REGION>', which after QTBUG-104930
is also reflected in the QLocale's uiLanguages(), resulting in the
QTranslator machinery always picking English translation for the app.

As long as we don't explicitly declare CFBundleLocalizations we need
to opt out of the system's behavior of finding the best match between
the app's declared localizations and the user's preferences, which we
can do via the CFBundleAllowMixedLocalizations key.

Fixes: QTBUG-63324
Change-Id: If7586d342148cbbb1d2a152cef039aad4448b13c
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 4709c938dba72b69a91b584bfe34010fec9e2d43)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-11-04 09:09:57 +00:00
Niclas Rosenvik
74f8266e33 corelib: Support ELFOSABI_LINUX in qelfparser
ELFOSABI_LINUX is the old name for ELFOSABI_GNU
and some systems (NetBSD 9) with an old elf.h
still use that define instead of ELFOSABI_GNU.

Change-Id: I3d18efe117ea21f13831df5293b4efce99694294
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ded2fd9ff4fea06af881229bacaeff5d0ecfa6de)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-04 02:04:03 +00:00
Liang Qi
f4eb4c5f30 xcb: Flush Display when processing xcb events
Only calling xcb_flush() is not enough when users use xlib calls
to paint with the Display, for example in QWidget::paintEvent(),
and not call XFlush().

This fixes a regression since Qt 4.x.

In Qt 4, we use XNextEvent() in x11 event dispatcher which
implicitly called XFlush(). In Qt 5 and 6, we use xcb calls.

See also https://www.x.org/releases/X11R7.5/doc/man/man3/XFlush.3.html

Most client applications need not use this function because the
output buffer is automatically flushed as needed by calls to
XPending, XNextEvent, and XWindowEvent.

Fixes: QTBUG-46681
Fixes: QTBUG-100085
Change-Id: I08dc0800ad0e23f0c2293d0d4e4bd29d92155752
Reviewed-by: JiDe Zhang <zhangjide@uniontech.com>
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 71c3aab7baae9220b37178711a49746f66975d63)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-04 00:22:04 +00:00
Liang Qi
5bd9843b10 xcb: Add xlib wrapper for XFlush()
Also avoid to include xlib headers directly.

Change-Id: Id60a9b39a9d8284d5d0ab3df1ed61f844f1e68e4
Reviewed-by: JiDe Zhang <zhangjide@uniontech.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit be4d339ce784921e0d1b127a86e025a1274e25b4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-04 00:22:04 +00:00
Volker Hilsheimer
5faba47f95 Revert "Accessibility: don't emit focus change when reason is window activation"
This reverts commit 79a11470f3c4c61951906223f97001a77ce36500, which
resulted in QTBUG-105735. The new behavior is worse and affects multiple
screen readers, while the old issue is isolated to Windows Narrator and
could be considered a narrator bug.

Task-number: QTBUG-105735
Change-Id: Ic8be1dbd592a3fdf2c3219ec4c5524bc2c7f0f6a
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit d300a0fe765259d490c3510c9e2a8bac58e0aa15)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-03 17:47:47 +00:00
Thiago Macieira
9c3434c4e7 QLocale: remove unwise early return in bytearrayTo(Uns)LongLong
Optimize the code for non-empty strings, which are the vast majority of
the conversions. Plus, qstrnto(u)ll operate just fine on empty strings.

This saves 4 instrctions per call on my laptop for any non-empty input,
and up to 4 cycles of execution.

Change-Id: I07ec23f3cb174fb197c3fffd17220b846a026b55
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 826dc56d3a941447d02fad48a47441f2329af0bf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-03 14:44:14 +00:00
Tor Arne Vestbø
d056a3234c macOS: Provide more details when failing to parse ICC profile data
Task-number: QTBUG-108175
Change-Id: Ic9191a659ef1699701a26d90384285364eaef41b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit d59ae19c49853fa97ff5b410717e69e35e27d867)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-03 14:44:09 +00:00
Thiago Macieira
31e4d6403c QString: skip QLocale::numberToCLocale for C locale inputs
QString inputs are required to be in the C locale, so we can simply use
qt_to_latin1() in qstring.cpp to do the conversion from UTF-16 to US-
ASCII. There's no need to operate on QLocaleData.

Benchmark of QString::toInt() on "42"; before:
 152.8176 ns task-clock:u                     #    0.999 CPUs utilized
 425.904     cycles:u                         #    2.787 GHz
1550.992     instructions:u                   #    3.64  insn per cycle
 363.998     branches:u                       #    2.382 G/sec

Now, with a slightly optimized qt_to_latin1:
 19.3383 ns  task-clock
  54.005     cycles:u                         #    2.793 GHz
 238.000     instructions:u                   #    4.407 insn per cycle
  55.000     branches:u                       #    2.844 G/sec

And with AVX512 256-bit qt_to_latin1:
 20.6798 ns  task-clock
  57.748     cycles:u                         #    2.793 GHz
 237.000     instructions:u                   #    4.104 insn per cycle
  50.000     branches:u                       #    2.418 G/sec

For comparison, a QByteArray::toInt() on "42" produces:
 17.2310 ns  task-clock
  48.081     cycles:u                         #    2.790 GHz
 205.000     instructions:u                   #    4.264 insn per cycle
  49.000     branches:u                       #    2.844 G/sec

Fixes: QTBUG-107788
Change-Id: I07ec23f3cb174fb197c3fffd1722042b9ccbacbf
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 885ae61c6378e06a965f543d2ecbd162c6224347)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-03 14:44:08 +00:00
Mårten Nordheim
43f9f953bc QHostAddress: Fix incorrect comparison against 'Any'
When 'this' is IPv6 and 'other' is Any then there is no point in testing
'other's IPv6 address.

Added extra tests against QHostAddress::Any*.

Fixes: QTBUG-108103
Change-Id: I09f32b1b147b1ec8380546c91cd89684a6bebe2e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4d3f5ac0cc731a1120154f707bceb57eb4ddabe2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-03 09:31:25 +00:00
U-GER\tjmaciei
70a4ff8d35 qsimd.h: add two more CPU feature macros that MSVC doesn't define
Ivy Bridge added RDRAND and Haswell (x86-64-v3) added MOVBE.

Change-Id: I3d74c753055744deb8acfffd1723e5b9bdfaaafb
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 3a8980304f313bc82f0a079bc0239172036ba3ea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-03 02:49:32 +00:00
Alexandru Croitor
9c027ac7ab CMake: Fix qt_add_resources missing dependency regression
Adding target dependencies instead of file dependencies to the
qrc processing custom command broke regeneration of the qrc
file when translation source files were touched, as well as caused
flaky build failures.

Originally, the target dependencies were added to work around an
issue with the Xcode generator (a custom command needing a
common target).

Limit the usage of target dependencies 'approach' to the Xcode
generator only.
This fixes the regression for non-Xcode generators, but will still
cause issues for iOS + Xcode.
A proper fix for Xcode will need more research.

Amends 5b0e765ab0dddba86662925cb44aeac748a286b7 in qttools
Amends cfd5485d41b2bf519d5b3c5162726cce195782ac

Fixes: QTBUG-107687
Fixes: QTBUG-108113
Task-number: QTBUG-103470
Change-Id: Ibddd05726deba2103c9c3c85a3fefd6d55798020
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit c2aa05991d79df57f826606157056c658c6de797)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-03 01:01:20 +00:00
Mikolaj Boc
dbbb779834 Use offsetX/offsetY for pointer events
qtwasmcompositor expects coordinates relative to the canvas. Provide
that by using pointer events' offsetX/offsetY instead of the viewport
x/y.

Fixes: QTBUG-108128
Fixes: QTBUG-106031
Change-Id: I76c553b7b7e350fd873b18c775848217a4905f3d
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 899e540d46adb72f212091ffb5fd3bf2262a556c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-02 16:21:39 +00:00
Niclas Rosenvik
c736528086 Fix redefine of QT_NO_VERSION_TAGGING warnings
If a user requests no version tagging by
defining QT_NO_VERSION_TAGGING a lot of
redefine warnings will be output from the
compiler when building corelib.
So only define QT_NO_VERSION_TAGGING if it
is not already defined.

Change-Id: I56609b3589184bda7bec52d168d9fd11e2f14a2c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 265b1369a397efd47fc13dbcb76a3439cccfe207)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-02 15:50:17 +00:00
Ville Voutilainen
772730f5c4 Android: Fix signing of APKs that are generated when an AAB is also built
To simplify matters, this removes the support for signing APKs with
just jarsigner. apksigner is always used for APKs, and jarsigner is
used for AABs. I consider that to be just fine, you _have_ to start
using apksigner eventually, and the time for that is long past.

Task-number: QTBUG-91255
Change-Id: I211ae796db0f2619265deb1f30ab3cc5d1ecfbc9
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit b82c5f9b7f21ddfe5d7f3053dd422c38ccd3187d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-02 15:50:17 +00:00
Mårten Nordheim
f3e718573a QSsl[OpenSSL/Android]: Fix hardcoded 1_1 suffix
Since we support 3 as well now we should not always use 1_1.
The suffix will change depending on which OpenSSL version was used when
Qt was built.
This only affects Android.

Change-Id: I2e443b12daa5e79190f1b3367e21ba0fa6a1dcd4
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 528b03d6b64cbcee14d9324f77588a102d57b57f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-02 15:50:17 +00:00
Johannes Kauffmann
6a9db15cbc examples: fix configuring with -no-feature-widgets
It also fails for -no-feature-gui, but since the example depends on
QtWidgets, which implies depending on QtGui, we only check for
QtWidgets here.

Change-Id: I777e540e6c2101ce8f08a5f80ba01b37ff858373
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 5143670855174d5c86768daf2a4a43c6a0302727)
2022-11-02 13:02:13 +02:00
Heikki Halmet
9506c263ef BLACKLIST: tst_QApplication::sendEventsOnProcessEvents for RHEL 9.0
Task-number: QTBUG-87137
Change-Id: I47d7465efe61a74fd2ae3b377442ca74984344de
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit c45cb7f0ccf4aba7973a8350f2d0ec832d2ba3ca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-02 09:49:04 +00:00
Bartlomiej Moskal
3884635189 Android: Handle light/dark mode changes
Update Theme's style according to current UiMode.

New style.json file for dark mode was added (stored in separate
subdirectory 'darkUiMode/'). Theme_DeviceDefault_DayNight[0] is used for
extraction for API 29 or higher. Style is updated each time when UiMode
is changed.

[0]https://developer.android.com/reference/android/R.style#Theme_DeviceDefault_DayNight

Task-number: QTBUG-83185
Change-Id: Id26059231f41761d822d494ac6c641bf3cba3322
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit b4a9bb1f6a40e6d504c1f48f0d9ea2b70ab1a9f0)
2022-11-02 08:50:55 +02:00
Edward Welbourne
96b3382ec7 Restore lost documentation for QString::append(QStringView)
Lost in commit 2766322de37adba37e0d0d4b0054e55edff01c6c (at 6.0) as it
was buried in the midst of a lot of QStringRef documentation. This
commit restores the documentation originally added in commit
3238445b270d5fb98f4008cb10a8adcc2d35165c, but locates it among the
other QString::append() overloads and adds a \overload directive.

Change-Id: If7b98f1ae9ae8144c421a048c8a35be8474558c7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit eb5f33c7a18f93002f64948a1c78b32fc678a5af)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-01 19:17:32 +00:00
Edward Welbourne
8b701829f6 Port QDir's implementation to use Q_D() and d_func()
It had the d_func()s it needed, but wasn't using them.
This prepares the way for QEDSP-ification.

Task-number: QTBUG-105753
Change-Id: I8b7ba79818f27ae6a2281b276b95b94673f05648
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 62a4fe434d4d9cb27a6285778fdab7e2ce43b61b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-01 17:14:27 +00:00
Balazs Erseki
8a4f8de3c9 Fix documentation of QPartialOrdering::Greater
When it was added, Greater's description was the same as
Equivalent's. This commit solves it by a proper description.

Fixes: QTBUG-106983
Change-Id: I9d9b71572921edb8c33209a0b37a138fff3cf962
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 7a6f43b7c2afe91dbbc23cc759555ce6fe789889)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-01 14:52:21 +00:00
Morten Sørvig
45358c29d5 Port default font resolve to SystemParametersInfoForDpi
We were getting font metrics for the primary screen and then adjusting
for the screen DPI get a screen-independent font size.

This could fail in edge cases where the screen DPI was changed after
app startup, but before the first window was shown. See QTBUG-105857.

Use SystemParametersInfoForDpi() to query for font info at 96 DPI instead,
which removes the need for tracking primary screen DPI.

LOGFONT_to_QFont() still has one usage (qwizard_win.cpp) which provides
a custom DPI for scaling, so we keep that function as-is.

Fixes: QTBUG-105857
Change-Id: I1adf0ab3bf2c309e8fcb58093e86214fa11a2da8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit edb00660e47a82ac24048841100d7d7e59a7805e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-11-01 14:12:32 +00:00
Fabian Kosmale
ef581555b3 QProperty: only use MSVC bug workaround on MSVC
The fix for QTBUG-106277 appears to cause issues with older gcc versions
in C++2a mode (for instance used in our headers check).
Thus, use the old code for all non-MSVC compilers, which never had
problems with it.

Fixes: QTBUG-108039
Change-Id: If6a0ce6e8f41e9dc752614557e96c555ca0fe75c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 62a2951795f117ff10a6d85bcff8d93a71fd58da)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-31 18:44:58 +00:00
Mårten Nordheim
7484585ffa QByteArray: in/deflate: compare different types as size_t
Compiling for android a certain configuration warns about comparisons
between types of different signedness.
On 32-bit we cannot cast the unsigned type to qsizetype and on x64
we cannot cast the qsizetype to Zlib's type (both potentially truncating).
So, cast both to size_t before comparing

Change-Id: I0dd40c875b1a61a64f0574f0209a8549fc73164a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit c4cb464d74fb703d20b1bf53b3738531f92feae4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-31 18:32:47 +00:00
Alexey Edelev
9c533df1e0 Add flag that skips Qml import scanning to android deployment settings
If Qml module is not found it doesn't make sense to run any
functionality that is related to Qml inside androiddeployqt. Add the
deployment setting option that indicates this explicitly and set it
to true when Qml module is not found by CMake or by qmake.

Task-number: QTBUG-106939
Change-Id: I1e6cffbdd230007feffe7448617097c10238a6c9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 720d5cc1a47ad0702d51548009bdcf229368d6fc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-31 13:39:24 +00:00
Laszlo Agocs
4b146bf4f3 rhi: gl: Skip the prim.restart enable on WebGL2
Doing so generates an error as this value for glEnable is
invalid with WebGL 2. The behavior is always as if this
was enabled. (unlike in GLES 3)

Task-number: QTBUG-107780
Change-Id: I3fc34329fc573a6fac8e4265d90ca93520e4e2ee
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
(cherry picked from commit 062efb305e1866482c03717ed1cf9717f45e5abb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-31 11:44:51 +00:00
Andreas Buhr
7b7c9c6996 Proper clearing of WinRT factory cache
If we use winrt's factories we have to make sure to to clear the factory
cache when one of our dlls is unloaded or we will run into dangling
factory entries which might result in crashes. So we have to make sure
that winrt::clear_factory_cache is called on every dll unload.

In order not to increase compile times and dependencies too much
qfactorycacheregistration_p.h needs to be included in Qt code whenever
we use winrt's factory cache. A rule of thumb being: Include
qfactorycacheregistration_p.h whenever including winrt/base.h.

Other Qt modules which use winrt's factories need to be updated too.

Fixes: QTBUG-103611
Change-Id: I7ab24e4b18bffaca653c5b7f56a66ce99212e339
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ffb9dee1b0954e4d4f9e9791175609a80ecafc31)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-31 11:02:42 +00:00
Mitch Curtis
ebd259fbbe Doc: link to the testlib tutorial section on skipping
Short of expanding Qt Test Best Practices to have a section about
QEXPECT_FAIL, we can link to some existing documentation that briefly
covers it.

Change-Id: I37bf2672e4b5b6e7315e009f86d03eeb7937d50e
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
(cherry picked from commit c30c76c84473b8b117b1542e75239973a7bcaf06)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-31 09:56:58 +00:00
Sérgio Martins
1005cc3aad eglfs: Improve z-order handling
In 9ccbbeecbd we've added basic z-order handling, so main window
always stacks behind tool windows. After extensive testing we found
more basic cases to be handled:

- Modal windows go on top
- Qt::Popup goes on top of Qt::Tool

Fixes: QTBUG-105707
Change-Id: I00eba330864c7abc31652226d55f66f4b7f44dc0
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 732581885fbf95f367c3fe7ee8d71e490cc6cfe3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-29 21:05:42 +00:00
Laszlo Agocs
dddd08e1e7 eglfs: kms: Make screen cloning functional by default
It is not necessary to disable the thread-based drm event reading
(QT_QPA_EGLFS_KMS_NO_EVENT_READER_THREAD) anymore when using screen
cloning.

Amends 820775166132b073a941f2389fba81db49619688 and
14bb413309092adc53e8451daff5690c4698c07d

Note that this does not work when atomic commits are enabled. (i.e.
running with QT_QPA_EGLFS_KMS_ATOMIC=1 and attempting to use screens
that clone will not function as expected, regardless of which event
reading method is used - that needs a rework of how atomic requests
are handled, and is not something we are going to invest into given
that atomic is not even used by default)

Fixes: QTBUG-91882
Change-Id: Iba83688c7790d7e721db3704d422034b654a8d8a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 91d1ec3589b84e7f5d6611edd7e8f82cbfd38afb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-29 04:18:46 +00:00
André de la Rocha
97c95f606f Windows QPA: Remove tablet->mouse synth and fix Drag&Drop with touch/pen
This patch avoids synthesizing mouse messages in the QPA for touch/pen
input, and lets the GUI do mouse event synthesis for unhandled touch/pen
events, if required, like in other platforms. This requires a workaround
to avoid breaking drag and drop with touch/pen (or making it worse). DnD
on Windows is based on the DoDragDrop() Win32 API, which does not work
with touch/pen input, which in some cases cause a DnD operation started
with touch/pen to hang until the mouse is moved. To avoid it we process
pointer messages for touch/pen and generate mouse input through
SendInput() to trigger DoDragDrop(), which then seems to work as
expected.

So now we inform QtGui that the Windows platform no longer sends
synth-mouse events after tablet events (unsetting the flag added in
f931e5e72d4617023bbea46cba2c0d61bb1efa4f); this completes what was
attempted in 8ada0633cd58e0608df2e16880f1293286025504.

Fixes: QTBUG-106368
Fixes: QTBUG-57577
Fixes: QTBUG-100788
Task-number: QTBUG-77414
Task-number: QTBUG-104594
Change-Id: I46db3c74be2a95cf2d94ba930398e58dc930d2db
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 31e7790102b260344893eaa8bf8b7b1a0f95e3b7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-29 04:18:32 +00:00
Paul Wicking
1515422d68 Doc: Fix typo in container documentation
Change-Id: Ia36cdff5554955e5193a10b9f0e4aab3c61e5f09
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7943cdcde7ec6d3203aefac2964444bba4c41f98)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-29 04:18:12 +00:00
Timur Pocheptsov
0c5f294217 qnswindow (-backgroundColor) - return 'clear color' for Qt::Popup
That's what we initially did for borderless windows and we need it in order
to draw rounded corners for context menus.

Fixes: QTBUG-106108
Change-Id: I6e4254b714ad7a094aa295546d5ac7fba5e21b13
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 6a839e0ae4cb1eddd290d64b152a2571f3586ed2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-29 04:17:59 +00:00
Tor Arne Vestbø
12968a819a macOS: Don't include QSystemTrayIcon windows in Dock menu window list
As of 3fcdb6cb6e35a37f9b511ec2705336102c194d6b we now have a hidden
Window menu, which results in macOS also populating the Dock menu
with the application's windows.

But since the AppKit logic for populating the window menu happens when
the window is shown, and we create the menu after many windows have
been already shown, we had a workaround to add the shown windows
manually.

Unfortunately this workaround didn't take into account the NSWindow
excludedFromWindowsMenu property, nor did it include various other
checks that AppKit itself uses to decide if a window should be
included in the window list, resulting in adding the NSStatusBarWindow
that AppKit uses to manage the status bar items.

Instead of trying to replicate the AppKit logic, we toggle the
excludedFromWindowsMenu property back and forth, which triggers
AppKit to reevaluate the situation for each window, and add it
to the window menu if necessary.

Fixes: QTBUG-107008
Change-Id: I6c7f61c1f4610fec9ce1f814fcea2b6140230602
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 737011dd026018986c74e4155b2470777b676baa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-29 04:17:33 +00:00
Thiago Macieira
1980923bd3 QString::asprintf: fix handling of a present-but-empty precision
%.f should be handled like %.0f. You probably don't want it for strings,
though.

Fixes: QTBUG-107991
Change-Id: I07ec23f3cb174fb197c3fffd1721a941fbcf15e1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit bdee2c9760109d8e483c3b0e5c99fabc48bf21f5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-28 23:45:37 +00:00
Mårten Nordheim
bc6e0d1e00 QOperatingSystemVersion: Add macOS Ventura (13.0)
Altered cherry-pick slightly to accommodate documentation suggestion for
6.4.

Change-Id: I9504b41b743b9874fcc6324d98b66a9c5160e845
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 486651db3c2d5cce4399dc4f58ce7d78a94ef950)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-28 16:51:09 +00:00
Mårten Nordheim
3a08518224 tst_qapplication: Add dependency to helpers
It's convenient.

Change-Id: I1877754bee038e0313765efe2dc845ea5504cc61
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit d1e8a9978bfc2c10c19e17512136460bac9d6665)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-28 16:41:29 +00:00
Morten Sørvig
315a5e3257 wasm: convert and propagate filetype accept list
Backport the LocalFileApi::Type::fromQt() function from the dev
branch, and adapt it for use with the <input type=file> file dialog
API, which expects an accept string in a certain format (see code).

A similar change will be made for the dev, with adaptions
suitable for that branch.

Change-Id: I11585ae3d445634e123ce6394cada7b34af4d85a
Fixes: QTBUG-105472
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-10-28 12:57:43 +00:00
Tor Arne Vestbø
688eee2821 Apple: Use 'en' instead of 'English' as development region
This is consistent with what $(DEVELOPMENT_LANGUAGE) reports, as well as
the Apple Locales Programming Guide which states that "Locale names such
as “English”, “French”, and “Japanese” are deprecated in OS X and are
supported solely for backward compatibility."

Change-Id: I99779d678ef9d4ea90249572f2f977e9b4df6c62
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit d84ddf5905ce9f68612519b72cdd077077bd0419)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-10-28 12:38:37 +00:00
Amir Masoud Abdol
b6eabe613f Fix a bug in detecting system
Since QtAutoDetect is called before the project, we still don't have
access to our IOS, WATCHOS, TVOS variables, and we must use
CMAKE_SYSTEM_NAME variable instead.

Change-Id: I61afe216baec85b3fcd489957f4b6774134f8078
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 626ebf4738ca0df93d0b9e5ccdb305cb1dfa0839)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-28 11:10:16 +02:00
Bartlomiej Moskal
7d372f6e7a Android: Light/dark modes detection
After commit: 2248487c6ca9d5459c70a16868d5aeee07d96157 light/dark mode
detection is supported by Windows and macOS. This commit add similar
implementation on the Android side.

Task-number: QTBUG-83185
Change-Id: Id1ece98e91a31759b58d651ef62b3715ea25d85f
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 76abdaafb540be90e87c6689cc64040e95147777)
2022-10-28 05:51:40 +00:00
Johannes Kauffmann
85e0298e9c qlogging: avoid C-style casts
Amends e38a48200b7e0d20c0ab564bb59bd978d72677b7.

Change-Id: I053cb676398ae3ebc2ba68f0bf7359a0870303bc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 6707b881cfdc4ef3bd954f8d91e04c00f69b816e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-28 04:32:40 +00:00
Timothée Keller
015bd7e193 Windeployqt command line module expansion
Added command line option for passing core5compat module in windeployqt

Task-number: QTBUG-104845
Change-Id: I6a0e13532edac4580e03d83be79f7db4ac54e3bf
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 61a4880cb39e145d9b8e6f78fa70bfc0d69d4904)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-27 21:48:19 +00:00
Volker Hilsheimer
a11fcb6b25 Windows 11: draw checked menu items with an explicit background
On Windows 11, the UXTheme API draws both MBI_PUSHED and MBI_HOT in the
exact same color as the icon grove. For menu items with icon, but with
no explicit "On" icon, that makes it impossible to see whether the item
is checked.

Work around this problem by drawing the background in a light version of
the highlight color, which simulates the style on Windows 10.

Note: In modern Windows 11 menus, checkable items with icons render both
the checkmark, and the icon next to each other.

Fixes: QTBUG-98354
Change-Id: I830eca5cdb3317f69dd5c863586e0b0eaa8774d2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit b3ce494bac20aae52a530bcd990b027f37fc3464)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-10-27 20:48:01 +02:00
Thiago Macieira
e0fea817a5 QBenchlib/Perf: don't try to benchmark the kernel
The kernel has become more paranoid since 2013, when I originally wrote
this code. The kernel.perf_event_paranoid sysctl controls the paranoia
level[1]:

===  ==================================================================
 -1  Allow use of (almost) all events by all users.

     Ignore mlock limit after perf_event_mlock_kb without
     ``CAP_IPC_LOCK``.

>=0  Disallow ftrace function tracepoint by users without
     ``CAP_PERFMON``.

     Disallow raw tracepoint access by users without ``CAP_PERFMON``.

>=1  Disallow CPU event access by users without ``CAP_PERFMON``.

>=2  Disallow kernel profiling by users without ``CAP_PERFMON``.
===  ==================================================================

Since the default is 2, we QBenchlib has been failing with EACCESS:

PASS   : tst_MyClass::initTestCase()
QBenchmarkPerfEventsMeasurer::start: perf_event_open: Permission denied

[ChangeLog][QtTest] Fixed support of Linux performance counters for
QBENCHMARK, which used to fail with "Permission denied" errors in
default configurations. Now, QtTest will automatically fall back to
profiling only userspace, like the perf(1) tool does.

[1] https://github.com/torvalds/linux/blob/master/Documentation/admin-guide/sysctl/kernel.rst#perf-event-paranoid

Change-Id: I3c79b7e08fa346988dfefffd171f897be7794935
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit e1089e0520482e62336a8d6efa40e064fd9796d8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-27 16:15:55 +00:00
Thiago Macieira
3bafb629f1 QLocale: merge the code for some system locale queries
QSystemLocale is now defined for QT_NO_SYSTEMLOCALE builds (bootstrap),
but no implementation will be present. That's just to get the enum
declarations.

Change-Id: I3c79b7e08fa346988dfefffd171fa00fde8ab080
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 089bbfc30758265d3fce804b950f56a15225e32c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-27 16:15:55 +00:00
Thiago Macieira
10698b3138 Bootstrap: fix MinGW build with -maes
In bootstrap mode, we don't build qsimd.cpp and don't check for CPU
features, but specifying -maes in the compiler command-line can still
enable the AES hash support in qhash.cpp. This has probably been broken
since Qt 6.4 with commit 4be85491e069081cbc9dc29202a25d0771b61f06.

qhash.cpp:(.rdata$.refptr.qt_cpu_features[.refptr.qt_cpu_features]+0x0): undefined reference to `qt_cpu_features'

Change-Id: I07ec23f3cb174fb197c3fffd17216241cfd1ab19
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 11cc74b0661bdad122857e0405cced57d9a6bad7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-27 16:15:54 +00:00
Thiago Macieira
2f7596e1bb Tests: fix namespaced build on Windows
Amends 371214dea7f92b3170d0239b3d9944275adf951a.

tst_qfile.cpp:401:9: error: reference to ‘QTest’ is ambiguous
qttestglobal.h:27:11: note: candidates are: ‘namespace TestNamespace::QTest { }
filesystem.h:28:11: note:                 ‘namespace QTest { }’

Change-Id: I07ec23f3cb174fb197c3fffd17215c1eeeadf7fd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d18d34134115d003808a7284c095bed694ebf685)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-27 16:15:53 +00:00
Amir Masoud Abdol
54e855b0f2 Cleanup the watchOS and tvOS References from CMake files
In addition, I simplified some of the routines as we don't need the
extra check for them.

Task-number: QTBUG-107903
Change-Id: Idaf6ab1338a54bc1a9f242fcc8400ae200174beb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit f157e223c21c79ebaf7e5e1a23dbdb3d8da1a59e)
2022-10-27 11:26:23 +00:00
Rob De Reycke
acee56691f xcb: Fix segmentation fault on destruction of QXcbConnection
The same screen was detected twice.

Fixes: QTBUG-104319
Change-Id: Id1f93d68de0306604f2e6a9104962a1d3b0db366
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Jonas Kvinge <jonas@jkvinge.net>
(cherry picked from commit e39ca06dbc3051c8e82c458ccd7314a2adbff27e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-27 08:57:43 +00:00
Laszlo Agocs
1ddfee7ae8 rhi: gl: Make sure stencil write is enabled when clearing
If the last pipeline had a different stencil (write) mask, that
would affect the clear. That is not ideal.

Exercised by the upcoming stenciloutline manual tests.

Change-Id: I925e85a2b7fb884e5ae9ed327b4b05c9bf36484b
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
(cherry picked from commit 06a5118a4a2b76df2c2c4190ac57fa15857ecf8c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-26 19:26:47 +00:00
Thiago Macieira
5487b54302 QStringConverter/AVX2: fix build with MSVC 2022
It doesn't like 0x80 passed to a char, causing a warning

qstringconverter.cpp(196): warning C4309: 'argument': truncation of constant value

Change-Id: I07ec23f3cb174fb197c3fffd17215b6f83476ebf
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
(cherry picked from commit 9968efb3cf6124606ee412f0b9e64c98113ab668)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-26 18:51:14 +00:00
Amir Masoud Abdol
5797796a9c Remove the Unnecessary CMake Module, include(CMakeParseArguments)
From CMake 3.7 both flavors of `cmake_parse_arguments` are natively
available in CMake, and loading the
`CMakeParseArguments` module is not needed anymore.

Fixes: QTBUG-107574
Change-Id: I7c8a6c5871cdb2f92a4aa43932b6f2ee99e1f57f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 10d5c0adafb7989c44794caef14a192cce9673a7)
2022-10-26 12:48:52 +00:00
Mårten Nordheim
571344c2c7 QWindowsFontDatabaseBase: Override both fontEngine functions
MinGW-clang gives warning(-as-error) because the overridden function
which is there shadows the other overload, making it inaccessible.

Change-Id: Ie5684b60a13d71966b9741fcfcdacbd37fe0df85
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 6c832731304414932fafa10c300707192e11e751)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-26 12:48:51 +00:00
Mårten Nordheim
a9771f2b8c QSctpSocket: Update windows-note to specify 'class'
When we say 'this feature', it can be misunderstood to mean
the subject of discussion in the immediately preceding paragraph.

Fixes: QTBUG-107720
Change-Id: I726c7a591f01e59c3c36c802abeb17b51abf0777
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 4c7524cbe8f7d53faeda8d4ecb65ee050f209e8b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-26 12:48:51 +00:00
Alexey Edelev
df8ef04229 Specify source and build directory explicitly for multi-ABI external projects
When building Android multi-ABI application in source tree the
ExternalProject_Add call generates a ninja rule that looks as
follows:
  cd <BINARY_DIR> && cmake <CMAKE_ARGS> <SOURCE_DIR>
In general case the rule works correctly unless SOURCE_DIR contains
CMakeCache.txt. In this case the cmake call uses the existing
CMakeCache.txt as the reference and tries to reuse the build directory
of the main ABI. It leads to the inconsistency for multi-ABI builds
and rewriting CMakeCache.txt. Passing both '-B' and '-S' arguments
explicitly avoids using CMakeCache.txt from a main build/source
directory and fixes in-source multi-ABI builds.

Fixes: QTBUG-107843
Change-Id: I010b47bff81052401aebe459e7893838a9b99bc1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 97007e1aced516e178b8b6891b5fd1a4d26af2bb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-26 12:48:51 +00:00
Mårten Nordheim
6b2bd76fca FontEngine[DirectWrite]: Mark interface functions noexcept
MinGW-clang warns(-as-error) that the overridden functions are not
marked noexcept like in the original class.

Change-Id: I7c5663b82e0f4449e27fd3842f7b37015fd5f4ea
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 6d46788e43b3c949d8c5b5946dead7e7a6a54735)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-26 07:57:53 +00:00
Assam Boudjelthia
b9e37ee852 Android: fix include statement for Android Extras classes
use \inheaderfile QtCore/private/qandroidextras_p.h to override the
default include statement.

Change-Id: I6ab691fc23d04b5f174729e9828039153bc05d1e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit 89e92a11e7b43a4f99c5a45f2cc641b3b59f5bcc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-26 01:15:41 +00:00
Johannes Kauffmann
c3d87de971 qfilesystemengine: port to qsizetype
Task-number: QTBUG-103525
Change-Id: If17227630d48f8170c5ec08ba6bed6baaad5582b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 60de00cb2fccbb407933b04b5236b2dc22b47dfd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-25 14:57:19 +00:00
Johannes Kauffmann
564471f9d2 benchmarks: fix configuring with -no-feature-sql
With -no-feature-sql, CMake would error out because the target Qt6::Sql
didn't exist. Fix this by checking if the target exists.

Task-number: QTBUG-102480
Change-Id: I411631acfd336ea699833954f86711067d160c04
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 30eac4a4f9df0b7402fe70499be9385e7ee8737e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-25 14:57:19 +00:00
Johannes Kauffmann
3fc5c9b6b6 qlogging: use qsizetype to fix Wconversion warnings
While the strlen() calls don't raise warnings themselves, it seems like
they were artifacts of indexOf() returning int instead of qsizetype.

Task-number: QTBUG-103527
Change-Id: I32fbf69feca38a5977dde084bef9993f24843ccf
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit e38a48200b7e0d20c0ab564bb59bd978d72677b7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-25 14:57:19 +00:00
Morten Sørvig
0bd5fc3281 wasm: disable run-time check for specialHTMLTargets
Recent versions of Emscripten may abort if module_property()
is used to look up specialHTMLTargets, which makes run-time
checking impossible. The abort is implemented on the JS property
getter on the Module object, which means that it's not possible
to bypass this by using e.g. EM_ASM instead of the C++ API.

Disable usage of specialHTMLTargets on emsdk > 3.1.14 for now,
until we can add API (or find some other means) for opting in.

This commit also adds functions for comparing Emscripten
versions.

Change-Id: Ibe5d1a82f267fa95dd62cdfc66595bc23036933f
Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit 4711f078b77011f389a3a5af368e76c72799bb9b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-25 14:57:19 +00:00
Patrick Stewart
53edbb330d Use consteval in QT_PROPERTY_DEFAULT_BINDING_LOCATION
Adds a consteval QPropertyBindingSourceLocation::fromStdSourceLocation
to make sure the QPropertyBindingSourceLocation is created at compile
time.
This is a workaround for what seem to be bugs in MSVC 2019 and 2022,
which otherwise don't regard
QPropertyBindingSourceLocation(std::source_location::current()) as a
constant expression.

Fixes: QTBUG-106277
Change-Id: Ic2379987b278cc0c43c1eb929120c99f5cd95fdf
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 7979665362fe3f86f2ca9cc2a669cce262bd7322)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-25 14:57:19 +00:00
Mårten Nordheim
a3d7619ce6 Allow specifying different linkers for MinGW
Locally I cannot build Qt with the default ld linker.
Only enabled bfd and lld because mold and gold is not available
for Windows.

Change-Id: Ib57562b07219acc47f53fe5b0944f54d9c2a6ba6
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 481fb5a06a139ea47342ad1e0aa334484bb5104b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-25 14:57:19 +00:00
Mårten Nordheim
b3f15cae22 qtwindowsglobal: Fix mixed-enum operations warning
With c++20 doing operations between different enums is
warning(-as-error).
Declare operator-overloads for a particular pair of enums to make this
compile again. Requires giving one of them a name as it was previously
unnamed.

Change-Id: I23296117b6d9a84273da6639582e075d631e5602
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit ba4710a33f408508772464c1e98ecab4378e4ecc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-25 14:57:19 +00:00
Mårten Nordheim
5e049224db qwindowstheme: Remove unused function
Causes warnings(-as-errors).

Change-Id: I77a40d9427cba277012a8343d6badd2c932798af
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 70d2437e6f9c488483e478f3c67f40db7cc4f2b3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-25 14:57:18 +00:00
Mikolaj Boc
04eff75189 Make Qt on WASM correctly draw windows with QT_SCALE_FACTOR
The GUI scale factor was taken into account twice, once in
QBackingStore::resize and then again implicitly in
QWasmBackingStore::resize, through window()->devicePixelRatio(),
which contains it as one of its multipliers.

Fixes: QTBUG-80992
Change-Id: I75ac8d85c14230207379b789834256de4254811b
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit d553ec049d3496240a2af6b04be14cf124cb1a4d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-25 09:32:00 +00:00
Jani Heikkinen
ffbf6b9ad4 Revert "Android: fix Android assets handler not listing dirs with only sub dirs"
This reverts commit 875e90d249820c6210bdc2beebe61d0224e37b93.

Reason for revert: QTBUG-107879

Task-number: QTBUG-107627
Fixes: QTBUG-107879
Change-Id: Ie593c973928758657305d1b2241a0480546ccb79
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-10-25 09:32:00 +00:00
Thiago Macieira
03c87b0792 QBenchlib/Perf: remove ioctl(FD_CLOEXEC)
Commit 8995045c62bb673af1e74bce79e3c500e0217bae forgot to remove this
portion.

Change-Id: I3c79b7e08fa346988dfefffd17202b19665ddc8a
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit ef6b5fe63f72c8103fd059169459b9d667b363a4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-25 04:00:29 +00:00
Thiago Macieira
8523d212ce QBenchlib/Perf: use WalltimeNanoseconds for the task time
Avoids the special case in the code and removes the need to run a large
number of iterations to get any useful result, plus makes it's more
readable:

From:
    0.00002125 msecs per iteration (total: 2,125, iterations: 100000000)

To:
    22.082 nsecs per iteration (total: 22,082, iterations: 1000)

Change-Id: I3c79b7e08fa346988dfefffd171facc98af9e9fc
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit e693a5ccafeace28bd1b60c21f19b9b8ada51366)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-25 04:00:20 +00:00
Volker Hilsheimer
49392b41a4 StyleSheet: use item background rule when filling row backround
QTreeView draws the different sub-rects of an item's background over
multiple calls to drawPrimitive(PE_PanelItemViewRow). The item row is
not separately stylable, but the item might have a styled background
property. To get a consistent background, we must use the item's
background rule when filling the item's row background.

To fix that, delegate the filling of the branch background to
drawPrimitive(PE_PanelItemViewRow), and implement PE_PanelItemViewRow
handling to render the rule for the ViewItem pseudo element if there is
a background rule defined for it.

Add a baseline test stylesheet for this scenario. Note that the selection
in an item view is better styled via the selection-background-color
qss property.

Task-number: QTBUG-73251
Task-number: QTBUG-106227
Change-Id: I5d0c170f78009fe5015dd749975e6df27485b3b8
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 483ae6c448ff95354c22e7d6e71117a9f9c40421)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-25 03:16:36 +00:00
Volker Hilsheimer
eed3f07e02 Baseline: add stylesheet setting show-decoration-selected for treeview
The fix for QTBUG-73251 in f4976f86cd265d7505da449dafe15c51e3c8cdc0
resulted in QTBUG-106227. Add baseline test coverage for the respective
configuration to make sure we don't regress.

Refactor mapping of index to configuration to make accessing of subitems
more robust.

Task-number: QTBUG-73251
Change-Id: I530ecd67fa5663f219884f641bc5e25c7ac5fe73
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 6f9d31be493dfe72bd8332881b325f811c79523d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-25 03:16:26 +00:00
Eirik Aavitsland
51881862eb Initialize flag memory in raster paint engine to avoid valgrind warning
After a new flag bit was added in 6.4, so that the flags no longer
exactly fills a byte, valgrind will sometimes give a "... depends on
uninitialised value" warning.

Fixes: QTBUG-107649
Change-Id: Iaaf5ae7bba3ce2476be5b2277839cad1d18aa55f
Reviewed-by: Christoph Cullmann <cullmann@kde.org>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
(cherry picked from commit 273b13dbd151477d46a642a06e62c6029edd7e15)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-25 00:59:03 +00:00
Volker Hilsheimer
aebfcbc556 QTreeView: fix drawing of background for alternate rows
After f4976f86cd265d7505da449dafe15c51e3c8cdc0 we never called the style
to draw the background of rows, unless ShowDecorationSelected was set.
This broke rendering of alternate row backgrounds, as painting that
background for the item's decoration was done by the style function that
was no longer called.

QStyleOptionViewItem::showDecorationSelected should store the value from
the widget's style and be used by the style when rendering. This avoids
that a style sheet is ignored when we are already in the virtual table
of the parent style. However, in that style option we conflate both the
style hint, and whether the entire row should be selected when the
selection behavior is SelectRow (as we then need to draw selection in
the first column all the way to the second column, not just around the
text).

To fix this, override the showDecorationSelected back to the style hint
value while we are only painting the background, and reset it back
before calling the delegate to draw the rest (including the selection).

This reverts f4976f86cd265d7505da449dafe15c51e3c8cdc0.

Fixes: QTBUG-106227
Change-Id: I5c1ecdf0a0e07b156f35f4e5614593a984754a34
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 16e0e7c779fea47c52a291f175654e6929fa8987)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-24 16:44:08 +00:00
Volker Hilsheimer
8ebe8d0747 Baseline test: add coverage for treeview with alternate rows
After f4976f86cd265d7505da449dafe15c51e3c8cdc0, alternate rows are no
longer painted all the way, as the code is never called for styles that
don't include the tree item decoration in the selection, such as the
Windows styles.

Add a baseline test to record the appearance of such trees.

Task-number: QTBUG-106227
Change-Id: If21076393fdf65205cab91299f8e557dbe9c4ea9
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 94039c9a6a700d65f915171067852310ff1ae62b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-24 16:44:08 +00:00
Tor Arne Vestbø
d76dd6148f QCoreTextFontEngine: Mark CGAffineTransformConcat as unused
We don't know at this point why the result isn't assigned back to
cgMatrix, but for now mark it as unused to fix warnings-are-errors
builds.

Change-Id: I6b32bbc42b2147b5304e1c72026e39d3e1eb8a4d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 87f8159c6a230e3ec1b8a628a20b04cc308d9fcf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-24 13:35:12 +00:00
Shawn Rutledge
a1dd185539 QApplication: send QHoverEvents with correct scenePosition()
The QHoverEvent ctor takes two points: pos and globalPos; pos is then
passed as both the scene and global pos to the QSinglePointEvent ctor,
which calls QMutableEventPoint::setScenePosition() on the persistent
QEventPoint instance and then detaches befeore setting ephemeral state.
Therefore, we must construct QHoverEvent with scene position first, not
local position, so that the right value is persisted; it's better to set
local position after the detach(), whereas it's too late to fix the
persistent point then.

Fixes: QTBUG-106918
Change-Id: I45726a9ec05bba2fe0cde6f5fb87c269105caca6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c3e2a624fbaa63979eecfc0b9346f4b54cb65264)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-23 09:57:55 +00:00
Marc Mutz
93aa02e671 Port qCompress() to zstream/deflate()
The zlib convenience API we've been using so far has two problems:

- On Windows-64, where sizeof(long) == 4, the use of ulong for sizes
  meant that we could not compress data compressable on other 64-bit
  platforms (Unix). While zstream also uses ulong, being a stream API,
  it allows feeding data in chunks. The total_in and total_out members
  are only required for gzip compression and are otherwise just
  informational. They're unsigned, so their overflow does not cause
  UB. In summary, using zstream + deflate() allows us to compress more
  than 4GiB of data even on Windows-64.

- On all platforms, we always allocated the output buffer in such a
  way as to accommodate the pathological case of random, incompressible
  data, so the output buffer was larger than the input. Using zstream
  + deflate(), we can start with a smaller buffer, then let zlib pick
  up where it left off when it ran out of output buffer space, saving
  memory in the common case that compression meaningfully reduces the
  size. To avoid the first few rounds of reallocations, we continue to
  use zlib's compressBound() for input less than 256KiB.

This completely fixes the compression side of QTBUG-106542 and
QTBUG-104972.

Fixes: QTBUG-104972
Fixes: QTBUG-106542
Change-Id: Ia7e6c38403906b35462480fd611b482f05a5c59c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 2fd990b386c3555cf66cd3efff0d6a47cdc63763)
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-10-23 09:02:03 +02:00
Marc Mutz
1eff7844a5 Port qUncompress() to zstream/inflate()
The zlib convenience API we've been using so far has two problems:

- On Windows-64, where sizeof(long) == 4, the use of ulong for sizes
  meant that we could not uncompress data compressed on other 64-bit
  platforms (Unix). While zstream also uses ulong, being a stream API,
  it allows feeding data in chunks. The total_in and total_out members
  are only required for gzip compression and are otherwise just
  informational. They're unsigned, so their overflow does not cause
  UB. In summary, using zstream + inflate() allows us to decompress
  more than 4GiB of data even on Windows-64.

- On all platforms, if the size hint in the header was too short, we'd
  double the output buffer size and try again, from scratch. Using
  zstream + inflate(), we still need to reallocate, but we can then
  let zlib pick up where it left off when it ran out of output buffer
  space. In all but the most pathological cases, copying the
  already-decoded data instead of re-decoding it again should be
  faster, esp. if QArrayData uses realloc() instead of malloc() +
  free() to grow the buffer.

We also now directly allocate at least as much output buffer as we
have input, to cut the first few rounds of reallocations when the
expectedSize was created, as qCompress still does, using modulo
arithmetic mod 4GiB instead of saturation arithmethic.

Factor the growing of the output buffer into a wrapper function,
flate(), which can be reused when porting qCompress().

This completely fixes the uncompression side of QTBUG-106542 and
QTBUG-104972.

Task-number: QTBUG-104972
Task-number: QTBUG-106542
Change-Id: I97f55ea322c24db1ac48b31c16855bc91708e7e2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit bda3628402d04ed6fc244616791e1170a0cb61d0)
2022-10-23 09:02:00 +02:00
Thiago Macieira
164f4f1c00 qnumeric_p.h: fix comparison of signed to unsigned in saturation
qnumeric_p.h:343:18: error: comparison of integers of different signs: 'int' and 'const unsigned int' [-Werror,-Wsign-compare]
   note: in instantiation of function template specialization 'qt_saturate<unsigned int, int>' requested here

Task-number: QTBUG-104972
Task-number: COIN-928
Change-Id: I810d70e579eb4e2c8e45fffd171992a457a139dc
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 6be8efb8535058beb276fa901e31587c25864e46)
2022-10-23 09:01:56 +02:00
Marc Mutz
d9be1459de qCompress: use saturation, not truncation, for the size header
This provides a better size hint than the pseudo-random mod 4GiB
number used before. In particular, it will make the Qt 5
implementation fail fast, because UINT_MAX will be recognized as a
non-representable size right away.

Task-number: QTBUG-104972
Change-Id: I6010f558eb71bbf02fb0f71bee1b3b1a15ec6e3f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit fb9213e640b9b5612fd198b1d859d00a28642672)
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-10-23 07:01:53 +00:00
Marc Mutz
ebf3bc689c qCompress: return null, not empty, for OOM
While this is a behavior change, we never documented that we'd return
an empty instead of a null QByteArray in this situation. Indeed,
returning bazip, with its fully-preserved capacity, is an expensive
way of signalling an error condition.

Conclude that this is not what the original author wanted and return a
default-constructed byte array instead, leaving bazip and its excess
capacity to be destroyed before the return from the function.

Task-number: QTBUG-104972
Task-number: QTBUG-106542
Change-Id: I2ee1fc6fdbb9da28f1987b16915516b51bb348c3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 98d9cfabc19984d75951f7ee66037331da63c0b8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-23 09:01:50 +02:00
Marc Mutz
11064b948b qUn/Compress: reject negative lengths
In qCompress, we've been calculating postive len values out of them,
only to fail at random points later, possibly running into UB. Fail
early instead.

In qUncompress, we've been catching negative values, and reported them
indiscriminately as "invalid data". Use a better warning message
instead.

By rights, nbytes ≥ 0 would be a precondition of both functions (which
we would Q_ASSERT() on), but seeing we're picking this back into LTS
branches, I found it prudent to use a non-fatal way to signal the
precondition violation.

If and when we keep these functions for Qt 7, it will be as an
overload that takes QByteArrayView, in which case nbytes ≥ 0 enters as
a hard precondition via the QByteArrayView constructor, so there
appears to be no need to pre-program a Q_ASSERT() for Qt 7.0.

Task-number: QTBUG-104972
Task-number: QTBUG-106542
Change-Id: I6a1b25fe12d31e3d4c845033cad320832976f83c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit bbd1f576f70fb52187185b79636e6591cd17e9b5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-23 09:01:46 +02:00
Marc Mutz
347d94b016 qUncompress(): introduce more functions a la invalidCompressedData()
... and use them consistently instead of naked qWarning()s.

As a drive-by, fix the warnings we generate on failures, which
all-too-often was "invalid data".

Code for minimal size by DRYing what the compiler can't, and using
Q_DECL_COLD_FUNCTION to avoid excessive inlining.

Left the one qWarning() in qCompress(), for now, because that would
have changed the return value from an empty to a null byte array.

Move invalidCompressedData() to where the others are defined, too,
because it's required by a follow-up commit.

Task-number: QTBUG-104972
Change-Id: Ia43aa315960b06530e98c1d7525ccf0e7f71bb5c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 6472616e6c98efe7b983ce2f1677dcada9c50321)
2022-10-23 09:01:43 +02:00
Marc Mutz
58219f859f DRY qCompress/qUncompress: introduce CompressedSizeHint_t
... and use it to remove the associated magic number 4 from the code
base.

As a drive-by, replace a naked qWarning() with the existing
invalidCompressedData() helper function, and a C-style cast with
reinterpret_cast.

Task-number: QTBUG-106542
Change-Id: I35004757e01bfc0747f7cc65bdf6eb243225caad
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 3cb00e415d72f466a1f235490cfae029169ce7ae)
2022-10-23 09:01:39 +02:00
Marc Mutz
ede290fbd9 qCompress: use qToBigEndian() to write the length prefix
Better explains what the code is doing, esp. now that qUncompress() is
using qFromBigEndian() for the inverse operation.

Task-number: QTBUG-104972
Change-Id: Ic885fd31bd80dc3939c7e4ef0c0e53b9e6b185b3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 368905bce36a503e53e1567d8453277e0a6d30fa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-23 09:01:36 +02:00
Marc Mutz
551898e63d Fix qUncompress for BE LLP64 platforms
Partially reverts 50661a9558ca3fe93bf569cc572b0fb2def5589d.

On big-endian, when long is 32-bits, but size_t is 64-bits, the
reinterpret_cast<ulongf*>(&len) from a size_t len is addressing the
MSBs of len, which, by construction, are 0.

I'm not sure such platforms exist (Windows is LLP64, but always LE
these days, all Unixes are LP64), but the reinterpret_cast is a code
smell, so do the length calculations in uLongf, which is zlib's
interface type, and avoid the cast, so the compiler can complain if we
get the type wrong, which it promptly did:

The static_assert I added a few commits back now informed me that the
doubling of len started to overflow, so replace the unconditional len
*= 2 by saturation arithmetic: if doubling would overflow, use
MaxDecompressedSize instead; if we fail with Z_BUF_ERROR even with
that buffer size, we just can't decompress and need to give up.

As a drive-by, change a C-style cast to a reinterpret_cast.

Task-number: QTBUG-104972
Change-Id: I91c311b297ef410b4c001d3528f1e9fd469d5def
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 63b31ca72e59039a8623e9adb832e2189b0bbad0)
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-10-23 09:01:33 +02:00
Marc Mutz
3a32e51c6e qUncompress: limit MaxDecompressedSize to what zlib can handle
... which may be less than what QByteArray can handle, e.g. on Windows,
where long, used in the zlib API as the size type, is just 32-bit.

Re-define MaxDecompressedSize as the minimum of the maximum sizes
supported by each of QByteArray and zlib, so we respect each library's
individual limit.

Task-number: QTBUG-104972
Change-Id: If1894ae7a1888f651a82b153d463658c272287e3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit f3512ada092111a787d5d067551451fc91b8491d)
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-10-23 09:01:29 +02:00
Marc Mutz
1ace2d21f9 qUncompress: use existing MaxByteArraySize
... instead of rolling your own.

Since MaxByteArraySize already adjusts for the trailing NUL byte in
QByteArray, the odd 'len >= max' now become a more natural 'len >
max'.

Rename the limit variable to MaxDecompressedSize, which is more
specific, and remove comments that now look out of place.

As a drive-by, re-arrange an else branch that, had it stayed, would
have required an adjusted if branch to require braces around a
single-line statement.

Task-number: QTBUG-104972
Change-Id: I6805dab8391b7e51db30d99b1b8968434062d12d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit b84f4be6b78feec617b8d97b00a8231c15d83f67)
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-10-23 09:01:25 +02:00
Peter Varga
4242f57900 Fix bool comparison in tst_qopenglwidget.cpp
This commit amends 1ea73bc29b7542141bfcfa138cc194404c283bd5

Change-Id: I02000f86ff030ad369ccef1d4488ad22558eb974
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 55449a65285b704d53a0096689f156578d9cb0e2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-23 00:59:53 +00:00
Timur Pocheptsov
c827b51195 QCocoaMenuBar: avoid duplication of 'special' entries in the 'Edit' menu
For this, after the app's main menu is set, we are looking for a special
menu (which is essentially translates into 'Edit') and check if AppKit
inserted 'Start dictation' magic item. If not - we apply the solution
that Volker implemented in d42cfeb84faf154b46f2811b2059946b396fcc12
for 'Edit' menu - we call insertDefaultEditItems.

Fixes: QTBUG-104709
Change-Id: I8fee93c43e7cf974f94d173cd53adf8097b263e0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 6c2387571a6ccace9edb600ce6798f75affd961d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-22 19:33:37 +00:00
Laszlo Agocs
d1d8a21c53 Fix texture-based native child widget stretching
The new rhi-based approach to compositing has a difference in transform
calculation which becomes relevant with native child widgets (so when
the flush offset is > 0). This is incorrect, so restore how 6.3 and
earlier did this calculation.

Fixes: QTBUG-107814
Change-Id: I98fe866d6c857343f25f39450ee60fd307bcdb63
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
(cherry picked from commit d59b2fde5eef39cc1735cadf2327f99ca6055306)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-22 14:59:53 +00:00
Eirik Aavitsland
c2f85da3be Update bundled libpng to version 1.6.38
With this update, there are no longer any diffs to upstream
libpng. Hence, the qtpatches.diff file is removed. Details:

- #define _CRT_SECURE_NO_DEPRECATE: Done on compiler cmdline instead
- #undef PNG_BUILD_DLL: For our usecase, that only caused PNG_IMPEXP
  to be defined to an empty string. Done on compiler cmdline instead.
- #ifdef for WinCE: dead platform.
- A memory leak fix: Included in upstream 1.6.38.

[ChangeLog][Third-Party Code] libpng was updated to version 1.6.38

Change-Id: I229db30e1dd54c209dc93e76d11e6fdb1f7adbdb
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 2742ceb1cd9b1a383049ac41970bc06e8955c8df)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-22 08:56:06 +00:00
Assam Boudjelthia
875e90d249 Android: fix Android assets handler not listing dirs with only sub dirs
Amends edd983071e0a90ee8665d2f45916fb575fc25857.

Remove redundant calls to AAssetDir_getNextFileName() in
AndroidAbstractFileEngine::setFileName(). It's enough to check
if AAssetManager_open() returns null and AAssetManager_openDir() is
valid for the provided asset file name.

As part of this fix, add some unit tests to cover/ensure assets
listing/iterating works as expected.

Fixes: QTBUG-107627
Change-Id: I37ae9cb64fbbc60699bb748895f77fd6a34fae1f
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 89f89cedc0e62f4b66de340da57d6c56dc61baf0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-21 20:17:47 +00:00
Thiago Macieira
033b1ba4dd QBenchlib/Perf: open the perffd with PERF_FLAG_FD_CLOEXEC
This flag was introduced in the Linux kernel version 3.14. Trying to use
perf_event_open() now with a kernel older than that will cause EINVAL
errors, but 3.14 is from 2014, so most likely old enough for all of
Qt 6.

For that, I updated the copied header from v6.0.

Change-Id: I3c79b7e08fa346988dfefffd171f895201ceb4f4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 8995045c62bb673af1e74bce79e3c500e0217bae)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-21 17:21:32 +00:00
Peter Varga
98fdf50c30 Set alphaBufferSize to -1 when disabling translucency in QtWidgets
-1 is the default value for QSurfaceFormat::alphaBufferSize. Changing it
to 0 may result an unexpected pixel format change by ARB OpenGL
extension.

Fixes: QTBUG-107629
Change-Id: Ia6a1b90fba6c43b6872b406f4fd946d937135cf8
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 600752aa972d1e46792e18f1ec6dd0b519722e65)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-21 17:11:59 +00:00
Mikolaj Boc
81252ea92a Do not use client-side data pointers in qopenglpaintengine
Buffers can be uploaded - no need to keep these in client memory.
Decouple uploading of buffers from the creation of vao.

Fixes: QTBUG-107539
Change-Id: Idf75bd80033a44c34af6837cd4d65b75c183d886
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit e487b07e18f1cb7ff126744be57b2ae1b9839c6c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-21 16:02:50 +00:00
Eskil Abrahamsen Blomfeldt
c0b54bf6fa macOS: Fix less common writing systems on Catalina and later
Since Catalina, some fonts on macOS have been put into a special
"secret" mode where they are available, but are not enumerated:
https://support.apple.com/en-in/HT210192

It appears that this is done in order to phase the fonts out, as
the article refers to backwards-compatibility as reasoning for
keeping them around, but at the same time, there does not seem to
be any new alternatives. When using e.g. TextEdit, the text is
resolved to the "secret" font, but the font dialog does not
display it, indicating that you are using a non-existent font.

This also causes issues for Qt, since we have our own fontdatabase
and do our own matching. In order to work around it, we assume the
font is available and manually add it to the database and fallback
lists. This also appears to be what others are doing, e.g. Firefox.

[ChangeLog][macOS][Text] Fixed missing text with certain writing
systems on macOS Catalina and later.

Fixes: QTBUG-96384
Fixes: QTBUG-98920
Change-Id: Ifd08ccbfdd0c06e11a44be861ad2c275c5a8e339
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 65279d6e9dfbccf1b97884a1c19111d6ebb3828f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-21 12:43:34 +00:00
Volker Hilsheimer
520a837888 Windows: Don't force native file dialogs to index compressed files
We use QWindowsShellItem to hook into the native windows file dialog
and interface correctly with special windows folders. We create objects
of QWindowsShellItem e.g. when the user selects a file. We then probe
the shell item for various attributes, e.g. to see if it represents a
folder.

The selected item might be a compress archive of significant size, and
checking whether that archive is a folder can take significant amount
of time during which the UI is completely blocked.

To prevent that, first check whether the item is a compress item, or a
stream, and if so, don't check whether it has sub-folders.

Also, don't use the SFGAO_DISPLAYATTRMASK value, which the API
documentation [1] explicitly documents as "Don't use".

[1] https://learn.microsoft.com/en-us/windows/win32/shell/sfgao

Fixes: QTBUG-107618
Change-Id: Ifcdec53ec3f8a0236d849a0b72a71afbd03d8290
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 933eb68a9d81391174b772fd49f344082b61fa1b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-21 12:43:33 +00:00
Mårten Nordheim
c22bf97cb1 tst_QSql*/sqlite: Don't use random output in the datatags
It makes it impossible to rerun it, bad for both CI and local test runs.

As a drive-by name the database file sqlite.db instead of foo.db

Fixes: QTBUG-100245
Change-Id: I2e4ee01189ccbad2a6add5db7771d35fd7248da8
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit 30077d462dca28ba1acecc9413e97d115b46cb6d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-21 12:39:32 +00:00
Thiago Macieira
0c6f3d69a9 tst_QTcpServer: use a random port number in addressReusable
Just in case the same test is being run in parallel. We do that by
creating a listening TCP server in the test process. This test is
supposed to test the address reusability, so a clean close on a server
that never accepted a connection should not cause reusability issues.

Change-Id: I12a088d1ae424825abd3fffd171ccfb9fc5c09ee
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit a94731c2ad85f9dd40050a780f67c911bf12668e)
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-10-21 12:38:45 +00:00
Liang Qi
8760c0c2f6 tests: skip tst_QGraphicsProxyWidget::bypassGraphicsProxyWidget() on Wayland
QWindow::requestActivate() is not supported.

This function crashed very often in ci/coin when system is busy.

Task-number: QTBUG-107153
Change-Id: I82523080db40bddce9c9dc000433117d8ef74847
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 63cfab628af937ea33805b698c0b4e08d5117200)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-21 11:58:37 +00:00
Liang Qi
905b505895 tests: skip tst_QGraphicsProxyWidget::scrollUpdate() on Wayland
QWindow::requestActivate() is not supported.

This function failed in test vm in coin manually very often.

Task-number: QTBUG-107153
Change-Id: I013651b0e5e7618c29742effd85a091ca95a7414
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit d8c078c2b6135e1ccd4b4b676b0d229e23e22c11)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-21 11:58:28 +00:00
Christian Strømme
d9acc25af3 Android: Fix clipboard issue with urls
Both hasUrls() and hasText() can return true when containing urls, as
hasText() checks hasUrls() as well.

Fixes: QTBUG-85773
Change-Id: I91a34f151e7de17ab5b9a2f24bc0b6e6c097d7f9
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 5f9591bde3f3a67c566f3aa3571b57c82bd59cc5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-21 08:47:27 +00:00
Antti Määttä
495e4c6ad2 QRhi: Allow negative viewport origin
Do not bound viewport rect to surface size, only scirror rect.
Modifying the viewport will move the view origin changing the
way the scene gets rendered.

Task-number: QTBUG-106082
Change-Id: I105516bd460af87727d0e73f580b8cf6b748d87f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit d46ad528727772362b710d68c27d963db81235c4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-21 05:01:45 +00:00
Assam Boudjelthia
97866ffe4a Android: fix Gradle warning about using enableUncompressedNativeLibs
The warning is as follows:

 WARNING:The option setting
'android.bundle.enableUncompressedNativeLibs=false' is deprecated.
 The current default is 'true'.
 It will be removed in version 8.0 of the Android Gradle plugin.
 You can add the following to your build.gradle instead:
 android {
     packagingOptions {
         jniLibs {
             useLegacyPackaging = true
         }
     }
 }

We already define that property in build.gradle, but we also need to
account for cases where an old build.gradle file that doesn't have that
property is used. So androiddeployqt checks if useLegacyPackaging is set
(and not commented out) whether it's true or false, if it's set to true,
then that's what Qt wants to set, and if it's set to false, then we
assume the user setting it to false is explicit and we don't want to
change that.

Fixes: QTBUG-106713
Change-Id: I566232207c458daa4484623beee670c6c6679313
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit 466a03e724aa39f7c57010cc2263adb06976ea50)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-21 02:33:42 +00:00
Tor Arne Vestbø
6a0bba44c2 qmake: Add CFBundleDevelopmentRegion to the macOS Info.plist
Aligns with what our CMake Info.plist has for macOS, what we do for
both qmake and CMake on iOS, and what Xcode generates for new projects.

The value is hard-coded to English instead of using $(DEVELOPMENT_LANGUAGE)
as the file will be used by both the Makefile and Xcode generator, and
only the latter does variable replacements for $(FOO).

Task-number: QTBUG-63324
Change-Id: I87e1cb14b14a9746b3603016c2ac69c252d37ff6
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit d4b0e0d02eeb46b400ac726115d840dd05c74c51)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-20 14:00:34 +00:00
Ville Voutilainen
6b67edb23a Android: Add a way to disable accessibility via an environment var
Task-number: QTBUG-102168
Change-Id: I38956c1798b8874b3c5bc5b19c8cb09380e76cc3
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit e7553adf16c14ec474b2659ad53757a37b336f95)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-20 14:00:34 +00:00
Timothée Keller
896eb6bcd0 Mention limitation of QDir::drives() on Windows
Added comment to clarify returned drives from QDir::drives()

Task-number: QTBUG-106896
Change-Id: I7cf9642b11f9000a5e6382a2b29070ab2cd6442e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit df89c93d916873c02c0995c76f325e7147858dae)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-20 14:00:34 +00:00
Yuhang Zhao
4bf9f4bc6e QOperatingSystemVersion: add new Win10 version
Win10 22H2 is released already.

Change-Id: Ibd42ee5e8b6e4ceb3cb4f8ee237bd9cdd9473f66
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 2e582a0af9c918876c77a62ff827265e9d83e9bf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-20 14:00:33 +00:00
Mårten Nordheim
cbdcdc345f tst_QTcpServer: Unblacklist addressReusable
According to the grafana dashboard it has not failed in the
past week.

Reverts ad736e9150af6ac621393529a72c8e67e05c2d5e

Change-Id: I3eac3c7fd667cfe2cf951b2808dddbfed8eae087
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 9efb27e40ce097f2c761b5e5f9c3b9a5c65b3a49)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-20 14:00:33 +00:00
Doris Verria
e5c23d2a4a iOS plugin: Add support for wheel events
Use UIPanGestureRecognizer to handle mouse and trackpad scroll.

Task-number: QTBUG-99795
Change-Id: I5db7fabf55b6f2e6f7ba90a0b90ecb08734e2329
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 77fcd47febec58eaf35610c72f2d9bdfb1ee4174)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-10-20 14:00:33 +00:00
Assam Boudjelthia
ed5474aa60 Android: properly retrieve mime type of uri to for openUrl()
Retrieve the mime type of the url regardless of whether QFile::exists()
returns true or false, because it is nonetheless required when calling
openUrl().

Fixes: QTBUG-47979
Change-Id: Ia095b76d5d39addb0b115eb97ac6bbae0c18a21f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Samuel Mira <samuel.mira@qt.io>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit 6f418df9cc931032ffc32a15b6ff268452fe9f01)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-20 10:38:51 +00:00
Eskil Abrahamsen Blomfeldt
9ac433b40a Fix generating PDFs with DirectWrite engine
The PDF print engine depends on getting unscaled glyphs and some
metrics from the font engine, and for DirectWrite, we were relying
on the superclass implementations of the functions in question,
giving us approximated values. This caused glyphs to be slightly
the wrong size when the DirectWrite engine was in use, e.g. when
high-dpi scaling is enabled.

[ChangeLog][QtPrintSupport][Windows] Fixed glitches in generated
PDFs when the DirectWrite backend was in use, e.g. when high-dpi
scaling was active.

Fixes: QTBUG-102098
Change-Id: I6ad72bfc8f634a1dcaee02de39960faa93f1ece3
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
(cherry picked from commit 3158068209b06e8bfa18c8fb83890953221a8176)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-20 05:58:51 +00:00
Lorn Potter
f5a7514f42 wasm: fix crash when network reply is closed
We do not need to call QNetworkReply::close as that closes the
QIODevice that we do not use (or have)

Fixes: QTBUG-77210
Change-Id: I812bc324f49ae28b8c622cfa89f9690e012bf216
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 9a5a31268e1fc1c86796dcf7f9ab757c4a599a49)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-20 01:59:54 +00:00
Mårten Nordheim
a97bfaddc1 Fix duplicated words in documentation
Only did instances where two-and-two words are duplicated,
easy to see when wrong.

Task-number: QTBUG-107777
Change-Id: I11593728acc386e7ef9aba9b39a0a4d9c60a532f
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit b4ad658fa0a65a77961d53c1c6373dc83d1e30ab)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-19 20:17:22 +00:00
Mårten Nordheim
94379dd158 QSslServer[docs]: fix grammar
s/a/an

Fixes: QTBUG-107777
Change-Id: I11159202304fc5f892ee41552d110f3a838470f9
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
(cherry picked from commit c238a788464e1f41cd16210bd785ca5b61a763ee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-19 20:17:20 +00:00
Alexandru Croitor
4060a2ee93 CMake: Use unix paths in android xml files
We aim to allow building Qt for Android on one host, and make it
usable on any host.

Previously when built on a Windows host, we embedded windows style
paths into the android -dependencies.xml files, which caused
androideployqt to fail deployment when building a project on a unix
host.

In Qt 5, the dependencies xml files for Windows Android packages had
unix style paths. Thus switch to always using unix styles paths on
all platforms.

Amends a9d2c5b6d7fa6b7365db8690f57aa78002c8bc4b.

Fixes: QTBUG-107249
Change-Id: I851d3e0b08415b4c7f0d22baf43c10c715879ee7
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit f7a34630a1c13c054cf06199bbb907ddc718e48c)
2022-10-19 11:35:09 +00:00
Topi Reinio
3608ae4cb9 Add license text file for Creative Commons Zero (CC0) 1.0
Since I38b281c97e039a8158e143ffa16ba1966713d030, qtattributionsscanner
fails the documentation build on missing license file(s).

Task-number: QTBUG-104126
Change-Id: Ia0efcfa44fc26ebcd86d98263bc33336d486d064
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit 665d727a28017fc64724a4cf3e31361fd031d481)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-19 10:06:21 +00:00
Eirik Aavitsland
30ddd5874a Avoid warning from QPrinter::setFromTo() in the documented 0,0 case
The doc says the setFromTo(0, 0) will print the whole document,
i.e. clear the page ranges. Although this works, it creates a runtime
warning.

Fixes: QTBUG-105292
Change-Id: Ic5de5be71ffc91762c8a4a44875ba133831d981f
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 7988cf25a52d26109e60fe5a7b72ec2940c59ecc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-19 09:27:45 +00:00
Doris Verria
a68acbd0cf QMacStyle: Set NSControlStateValueOn for selected tabs
We draw tab buttons as NSButtons of type PushOnPushOff. To draw a
selected tab, we used state ON (NSControlStateValueOn), which gives it
the accent color, and state OFF for non-selected tabs. To draw a
selected and pressed tab, we use state OFF and set highlight:
depending on isPressed.
This worked fine up until macOS 11 because when setting highlight to
true the push button would draw the accent color no matter the state.

In macOS 12, things are different. A highlighted NSButton doesn't draw
the accent color anymore, but rather a gray background.
So when we draw a selected tab using NSControlStateValueOn (blue/accent
color) and then press it (state changes to NSControlStateValueOff), the
tab will change color from accent/blue to gray. The text remains white,
so it's not clearly visible.

To fix, set the NSControlStateValueOn for selected, pressed tabs on
macOS 12, so the background color doesn't change when pressing on a
selected tab.

Fixes: QTBUG-101000
Change-Id: Iaf48a7e2ae536c7c591578bb3c1065bd0e29b2e1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 0709af1c02a653f3121c76ae7879cc64b2e246b7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-19 08:41:32 +00:00
Thiago Macieira
4866cac6f1 tst_QLibrary: add a cleanup() method to unload left-overs
QLibrary intentionally does not unload on destruction, so failing tests
may leave libraries already loaded and cause further tests to fail
because of that. So add a cleanup() method to unload everything we may
have loaded.

Note that QLibrary::unload() sets its state to NotLoaded after one
successful call, so we must recreate the object in case it had been
load()ed multiple times.

Change-Id: I12a088d1ae424825abd3fffd171d133c678f910a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 636dbe604596b2860e4f6d9b159fc017dcd2f66b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-19 05:52:33 +00:00
Timur Pocheptsov
c7c360cd51 QIosTextResponder: stop using deprecated constants and type
Use NSWritingDirection and corresponding enumerators instead.

Change-Id: Ie76ec2b8d07ab70288c7071182f215412d3e133c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 46b290dda8d41f6c2f71ba24d4b9647507a04b26)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-19 05:52:32 +00:00
Timur Pocheptsov
f730cc755b QIosScreen: retain the right window
When initializing m_uiWindow (instead of trying to retain this window
itself, which is harmless, since it's nil, but useless, since it's
not the right window).

Change-Id: I7855fd7c24ebfc28fbb912966f8010caba914fe7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 9e5e330a09607c62fa440f6222cb75005be12b01)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-19 03:11:56 +00:00
Timur Pocheptsov
65465c2693 QCocoaWindow::windowStyleMask: make popups non-resizable
Otherwise, context menu can be resized.

Task-number: QTBUG-106925
Change-Id: I409d0113fd92ca89b14f068c391dd9c0ddb79ce7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit e17372e723555cd9eb7b4efcb553812e0b98f37b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-19 03:11:47 +00:00
Timur Pocheptsov
b793c01539 QIOSMessageDialog::exec - work around 'windowsless' exec
While the need for such scenario is arguable, we can imagine that some app
first shows some message box (by calling QDialog::exec()), and then creates and shows
the main UI/window/widget. Without such a widget, app's keyWindow is nil,
its rootViewController is also nil and no alert is presented at all.
To save the situation, we try hard and check the primary screen's uiWindow
(using QIOSScreen::uiWindow) searching for any window and using its root
view controller.

Fixes: QTBUG-79977
Change-Id: I9bf38bdf540f1f1dbe42b86df94d6a1b4694e9f2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit f50f6a456aca6f0782eab2bf475d4f9c86a21f4c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-19 03:11:39 +00:00
Thiago Macieira
c2a92199b5 QLibrary::setFileNameAndVersion: reset the tag after findOrCreate
If the library we've found is already loaded, set the tag to Loaded.

Change-Id: I12a088d1ae424825abd3fffd171ce3831b884eee
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 54df3488aff977e0881b2591fff2e66f270e243e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-18 20:40:10 +00:00
Timur Pocheptsov
c4405bc5d7 QMacStyle: restore control size after re-initialization
We had to re-initialize NSSlider, due to some hidden problem with
stale geometry, when just setting properties of a cached control
(the remains of another previous QSlider render, using the same NSSlider).
But -initWithFrame: also resets the control size we set earlier,
thus 'small'/'mini' becoming 'normal'.

Fixes: QTBUG-107450
Change-Id: Ice42c787ec65d89c1c15f9c89462b7804aafe51c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 942abaae595ea620bdeacba0f4a18b759785d61b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-18 16:55:41 +00:00
Ievgenii Meshcheriakov
a40be64759 QNetworkReply: Fix typos in the documentation
Fixes: QTBUG-107719
Change-Id: Ic5bbc59aebeb44595cfde000bfd1cfb28991d311
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit dd0eb89d2e3b196343cbf322b0f35ea0b54f0814)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-18 16:10:07 +00:00
Friedemann Kleint
fa853a7715 windeployqt: Deploy Qt Designer plugins for QtUiTools
Make QtUiTools a known module with command line options and
plugin dependencies.

Note: There is no automated dependency checking for those
plugins as this can lead to undesired libraries being pulled.

Fixes: QTBUG-104831
Change-Id: I31a0c3620460d6558edcf8245f43502f2bca7748
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit ec6b22f67dc6133b280a8f3fe40d7d1cbef819bc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-18 06:49:39 +00:00
Marc Mutz
ae4f63613b QApplicationStatic: avoid use of std::aligned_union
It's deprecated in C++23. Replace with std::aligned_union's
implementation, like done elsewhere in the code base.

Fixes: QTBUG-107569
Fixes: QTBUG-99122
Change-Id: I0c06876c03a3c268298fab0f0bae399f26449bed
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit fdd0a1bc179e406b4af8c1dd2cc58bf8857d42ee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-18 04:17:12 +00:00
Marc Mutz
93503b0c52 tst_Q{BitArray,ContiguousCache}: check not only count(), but size(), too
Add at least a few, so size() isn't completely untested.

Change-Id: I500d28f7efb30ab578808d8fefb6ea57949edc2e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit f5205bd6a409d736942a4eed8869245cb9646d35)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-18 04:17:02 +00:00
Thiago Macieira
2a14dd4f47 Autotest/Unix: request zero-sized core dumps for crashing code
Unix systems have got crash loggers in the past 15-20 years, notably
macOS and Linux (abrtd, systemd-coredumpd, etc.). By setting the core
dump limit to zero, those tools should be mostly inhibited from running
and thus not interfere with the parent process' timeouts. Even for
systems without core dump loggers, disabling the writing of a core dump
to the filesystem should also help.

Change-Id: I12a088d1ae424825abd3fffd171d112d0671effe
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit c849c48d19cc0b086f98688d760fa6e008adc50e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-17 15:14:20 +00:00
Robert Griebl
789f51eabc Fix QComboBox supressing a QDialogs default button
Commit 64ffe0a broke pressing RETURN aka. the default key in a dialog
to close it, when a read-only QComboBox has the focus.

Before that patch, Enter + Return were actively ignore()d, but this
code path was removed, resulting in those keys to be auto-accepted.

Fixes: QTBUG-107262
Change-Id: I3dd8dca7d2f9d94f5172adc92ef508fe81c0df57
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit f7e2984a1a8ce6fbe933f3905ae79b39ff5438df)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-17 15:14:20 +00:00
Marc Mutz
2ce49dfe8c Update Catch2 to v2.13.10
Two patches applied to upstream release.

Fixes: QTBUG-103321
Task-number: QTBUG-99122
Change-Id: Ief451a21e5f61851cb03a9ca94ffe0f864e4b1f8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 3d6f5e95f0cdf6bc36b5f8483da0c14f3535bce2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-17 15:14:20 +00:00
Timur Pocheptsov
8a24898735 QIosMenu - do not check -undo: and -redo: selectors
With the latest Xcode 14 an attempt to 'Archive' and distribute an
app to the App Store Connect ends with a strange warning:
"App Store Connect operation Error The app references non-public
selectors in Payload/appname.app/appname: redo:, undo:". Googling
finds many similar reports and complains (with a bunch of different
selectors suddenly reported as non-public). We filter out undo/redo
instead, the selectors without parameters.

Change-Id: I9667dc61f650f6b6ec42c64a9aa6fbff57fe5049
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 6e288701e837ca324ad6e95fce301b29879b4a28)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-10-17 11:33:27 +00:00
Laszlo Agocs
9778edbd6b Add missing repaintManager check
This is likely a problem only after the 6.4 changes to move QQuickWidget
composition from OpenGL to QRhi.

Add an extra check to the condition when bailing out.

In QWidgetPrivate (qwidget.cpp) all similar calls into the
repaintManager are guarded by

  if (tlwExtra && tlwExtra->backingStore && tlwExtra->repaintManager)

therefore it makes sense to perform the same check in the other file too.

The assumption is that the check was not added here due to being outside
of qwidget.cpp.

Change-Id: Ic94d4e5153f4a194a997cd669b0f7c48c7932d97
Fixes: QTBUG-107166
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 2d381001dae9c5e590375232e7a95f245350e4ea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-17 10:00:40 +00:00
Alexey Rochev
3fb11be311 QMetaType: explicitly include qobject.h
convertMetaObject() function requires definition of QObject class,
but qobject.h is not included explicitly. Instead it is pulled by
qabstractitemmodel.h.

Include it explicitly to fix builds with -no-feature-itemmodel.

Change-Id: I4386375588c451262923501ab8dd7374c1f729ec
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 1d7e3ef77eccdea566bbb55f24267d70c8a1ebce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-16 07:57:29 +00:00
Marc Mutz
1df7efe377 qcompilerdetection.h: detect Coverity
Just to persist the knowledge of how to detect it for the next guy.

Change-Id: I16847d02ce60fab0ae14ffb2688f2ee92fa6a9f2
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 16dbbc8f8c93f28194b8b440b9616119ea2f7b45)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-16 01:58:12 +00:00
Yuhang Zhao
3868f2fa5d QAnyStringView: fix MSVC warning
When use /W4, MSVC warns about the code is not reachable.
It's not reachable indeed, so it's no need to include it
in the final binary, just use the same #ifdef guard to
comment it out.

Change-Id: I22a321e2c748bd1c5608475d61ba9a83734c5364
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8ba8d1346a562347c398bdd0529d34f94f2ac698)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-15 17:23:57 +00:00
Thiago Macieira
bd82fb5e65 QLibrary: merge duplicated setFileName{,AndVersion} code
The code was in triplicate. Once is enough.

Change-Id: I12a088d1ae424825abd3fffd171ce375892457fc
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 1f7850cd464a6131367543747a092fa1c75f2830)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-15 11:08:48 +00:00
Liang Qi
e65bf0ab4f tests: skip tst_QWidget_window::mouseMoveWithPopup() on Wayland
Task-number: QTBUG-107154
Change-Id: I94149e8ffdb834b44c605cfd9bdea7e9f458dc90
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit ca3c72b27a8d4c6e2313e89722ac637555f1d573)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-15 08:18:46 +00:00
Liang Qi
a56075be80 tests: skip tst_QWidget_window::resetFocusObjectOnDestruction() on Wayland
QWindow::requestActivate() is not supported.

Fixes: QTBUG-107155
Change-Id: I3a3ce04695ce5039229ce51d80948c62456f5944
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 3846b27dd860cde81802d98793904060fc157096)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-15 08:18:43 +00:00
Liang Qi
f91cfbb38b tests: skip tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad() on Wayland
QWindow::requestActivate() is not supported.

Task-number: QTBUG-107158
Change-Id: I047337d736ff10693d98075e2636028225162765
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit f2aa04722a46273cfb94f9d25667a772a1c40861)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-15 08:18:40 +00:00
Liang Qi
1d3e0efdad tests: skip a few tests in tst_QWidget on Wayland
QWindow::requestActivate() is not supported.

* tst_QWidget::dumpObjectTree()
* tst_QWidget::enterLeaveOnWindowShowHide()
* tst_QWidget::imEnabledNotImplemented()
* tst_QWidget::activateWhileModalHidden()

Task-number: QTBUG-107157
Change-Id: Ic8e0eeff05cfc4e6dc16fc570caf80a1dcc57800
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 89b54bb4ec60c302c940e5d21705bab460e1898a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-15 08:18:37 +00:00
Liang Qi
e2808d7037 tests: skip tst_selftests on Wayland and XWayland
QWindow::requestActivate() is not supported.

We have one tst_selftests binary, and will test it with both xcb and
wayland qpa plugin. A runtime check and skip will have different
restult files, which is not implemented in testlib yet.

Task-number: QTBUG-107578
Change-Id: Idc8cb24c6f42a9f0f4dc9493e3fd1a5803ba7ce0
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit bdd2b68696738c773224ce2936a161da9d3ad3bc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-15 08:18:35 +00:00
Liang Qi
893ffbf0ad tests: tst_QWidget::renderChildFillsBackground() passes on Wayland
This amends 1453f048f535d98ea2454462875eed77a966bcde.

Task-number: QTBUG-107157
Change-Id: I606dd2013e11a4f7639fea59d75091191fd30d87
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit ca8554d338c7d16c63dca93a7fcee2d2463a6664)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-15 08:18:33 +00:00
Liang Qi
00c074d6c5 tests: skip tst_QGridLayout::setMinAndMaxSize() on Wayland
Task-number: QTBUG-107184
Change-Id: Iddc280acd18e230d1ae778ccb6d7d17a8ff3d76c
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 7f27189d90d463e09069192157e6ada04bf68266)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-15 08:18:30 +00:00
Liang Qi
beb4d79816 tests: skip tst_QCompleter::showPopupInGraphicsView() on Wayland
Task-number: QTBUG-107186
Change-Id: I1f67c0b7c70dec210989073660db6b03afb98fff
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit f990c256eb79810a5190ee096e9c1820f4a478b6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-15 08:18:28 +00:00
Liang Qi
d5f2fadef4 tests: skip tst_QWidget::renderInvisible() on Wayland
Task-number: QTBUG-107157
Change-Id: I405a5dfc915b754e30389208cc0bdb01f17ed166
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 584aa8ad41303ff089c99c3ded93bb085c78745f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-15 08:18:26 +00:00
Liang Qi
27c3e9fb41 tests: skip tst_QWidget::setWindowGeometry() on Wayland
Task-number: QTBUG-107157
Change-Id: I65a21898d6a5d40a4e7e9eeecf1e2398e45d97fe
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit a16fd6bbe2e19e30b8e977fc19c5ca872f78d57a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-15 08:18:23 +00:00
Liang Qi
b9843faf1c tests: skip tst_QWidget::touchEventSynthesizedMouseEvent() on Wayland
Task-number: QTBUG-107157
Change-Id: I88df3215aceb7a619b4c1fbc2f457400a1bc7025
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 673f89d62c8516ce30c44ba933f410f6c9e8b1a2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-15 08:18:21 +00:00
Volker Hilsheimer
6dbd47a3ca Fix memory leak and clean up splitter test
Allocate the QSplitter on the stack so that it and its child widgets are
cleaned up when the test function finishes.

As a drive-by, replace QString usage with QByteArray to avoid unneeded
conversion from and to latin1, and modernize list construction and for loop.

Change-Id: I2e29961edbab1ec88be356fca6bc100f08894e82
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 9eca8d62fa64f9820a37de4cd022a236cd3ca7a0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-14 21:34:03 +00:00
Christian Ehrlicher
11dfb44144 SQL/OCI: fix compilation
Fix compilation error introduced with
917b4d3802f3c2102021610cbf977403a3d4c21a and add a missing override

Fixes: QTBUG-107544
Change-Id: I53571a0a113dc0f1e65f8773e66c02c1764739ee
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
(cherry picked from commit c3dccfef22267c2f78438973a39bc91260d96582)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-14 21:34:03 +00:00
Tor Arne Vestbø
3422818d90 Bump supported macOS SDK version for qmake to macOS 13
Change-Id: I278af36b980ec4dacba7962c9f78655b536c21b2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit c017ef8bda3a9b41363df50ac24361c6020b02ec)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-14 21:34:03 +00:00
Christian Ehrlicher
a3ad05f13a SQL/OCI: add missing overide()
QOCIDriver::hasFeature() missed a 'override' which prevents compiling it
with '-Werror'

Change-Id: I73a30134415947475e8f378fdb51bdd3f7fdd989
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 71f7a49fb2936f769483699bf2e8bfe6ea8d7c6a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-14 18:53:33 +00:00
Volker Hilsheimer
5eeec29295 QComboBox: remove dead code
We used to explicitly fade out combobox popups on macOS, but even the
cocoa platform plugin no longer implements a fadeWindow function.

Change-Id: I5cd61da2c755ec0f312c451f0ea966aa48399385
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit dbf6e2db3bb724669b60fdd22221ed023ec1d739)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-11 23:53:52 +00:00
Volker Hilsheimer
a1ba8b726e Allow programmatic closing of windows that are modally blocked
In Qt 6, after changes such as 121fddcf5ae2ab238ef802e44b45ce62c56015f5,
we go through the QPA layer to close widget windows properly. Closing
and hiding of windows is now done in when we receive and handle the
window system's CloseEvent.

Such an event to a modally blocked window should be blocked, so that
users can't close a modally blocked window. However, if the event is the
result of a call to QWindow::close, then it should not be blocked.
Luckily, we know that the event is the result of such a call, so let
such events through. This restores compatibility with Qt 5, where it was
possible to first open a new dialog, and then close the previous dialog.

Add a test case.

Fixes: QTBUG-107188
Change-Id: Id812c1fc36aa0e1a10dfb8d3a16a11d387289b05
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
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 cdadd1bdb3f0137659f0f82b06628d0b20b858e3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-11 23:53:51 +00:00
Marc Mutz
18422559e7 Short live q20::fill{,_n}!
It just adds constexpr to it (we're ignoring the range version).

Apply it to QStaticByteArrayMatcher, where it replaces rather
lengthy initialization code.

Change-Id: I1d60216fb04c94fa66fce5cc01313b3e9ba856ac
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit fd2685c2f0a219c091e028a98ba6cdd154986fec)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-11 21:17:28 +00:00
Thiago Macieira
84fa8726a3 tst_QTcpServer: Output useful more useful info for addressReusable
To try to figure out why QProcess::waitForReadyRead is returning false
so quickly. Though we know it's going to be "Address in use".

FAIL  : tst_QTcpServer::addressReusable(WithoutProxy) 'process.waitForReadyRead(5000)' returned FALSE. (Failed to listen: The bound address is already in use
Netid State  Recv-Q Send-Q Local Address:Port  Peer Address:PortProcess
tcp   LISTEN 0      50         127.0.0.1:49199      0.0.0.0:*    users:(("crashingServer",pid=40529,fd=4))
)

Change-Id: Ic43a460bfc7c7eb6379405b7a1a064e502b6fef3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 742584b0f2204497c7daaf3cde1c42aab6f7e55c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-11 20:28:14 +00:00
Thiago Macieira
3ae6b28369 QVariant/Doc: expand what toList & toMap conversions may succeed
I don't know when conversion through sequential and associative
iteratables was added, probably some time in the 5.x. QString and
QByteArray got conversions to sequential iteratables for Qt 6.1 with
commit c9a11022692f9a4bd36beb0cd001686694a48915. Since that was
intentional, I'm just documenting reality.

Fixes: QTBUG-107246
Change-Id: Id8d5e3999fe94b03acc1fffd171b863b1a0ead68
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 49e62c51f275c94501a3c42b8fbd8f11b87e9d41)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-11 20:28:13 +00:00
Shawn Rutledge
5642f64843 doc: Add docs for QPointingDevice::GrabTransition and grabChanged signal
Fixes: QTBUG-97697
Task-number: QTBUG-102160
Change-Id: I6b782206a873bfe1837c419d15b0d6949d5b819d
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 47ab723d82e9718027ac906aac75116590009053)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-11 20:28:10 +00:00
Dominik Holland
a8de48b144 Fix broken Text rendering when noantialiased NativeRendering is used
In case antialiasing is disabled the QFontEngine::Format_Mono is used
to render in the glyph cache.
In this format the padding needs to be 8-bit aligned.

Fixes: QTBUG-107038
Change-Id: Icf69150b6b446099ad05d706ddcab0a57f8fe0c0
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit f6626cf3c3e7336567293b4b943a97b76e4e5f3d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-11 16:36:17 +00:00
Dmitry Shachnev
a2776f60f8 Fix file which had SPDX-License-Identifier on two lines
This breaks our automation in Debian.

Change-Id: Iee035dee8e0d89e22540a2691689da46c4c301a3
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit 638c4a3014f5adbda70c768d3df71a22fbf1e672)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-11 14:11:10 +00:00
Alexandru Croitor
e66eabca3f CMake: Only build ssl tests if the feature was enabled
Task-number: QTBUG-107538
Change-Id: If2d473fbf8240b356d226be7bc4058506149a0e6
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit a6b430337cd9e9a4b0e7c7165bb372f6c4ed8798)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-11 12:15:40 +00:00
Marc Mutz
41dc4fcdb8 qcore_mac_p.h: compile-optimize inline swap functions
Instead of using the overly-generic qSwap() monster, use

- qt_ptr_swap() for swapping raw pointers
- member-swap for swapping smart pointers
- std::swap() for swapping scalars

In QtCore, this has proven to give a nice reduction in compile time
for Qt users, cf. b1b0c2970e480ef460a61f37fa430dc443390358.

Task-number: QTBUG-97601
Change-Id: Iad8e6c11ebcc3ff822479c36f5faff88992b1165
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 e08fa9cc01f11ce61258e0d9a138118bff3453c8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-11 10:56:27 +00:00
Marc Mutz
0d140753c3 Short live q20::transform()!
It just adds constexpr to it (we're ignoring the range version).

Apply it to QOffsetStringArray, where it replaces the copyData()
function.

Change-Id: I6caf3b5fd2e60f4fcb0b116684c3ad6a8043f38e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit d4e62a9768c4ce4964f65cca15b3da0a36b910f1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-11 10:56:21 +00:00
Marc Mutz
16a6db8d65 corelib/CMakeLists.txt: remove duplicate qxpfunctional.h
Amends 343e0ff485de36e27c0a62781dc512a4bda22fce.

Change-Id: Id7054f777d6ae1ec3d9c94f144e6b0c6db8f9352
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 21991a1278d4c3c9857d6da3317cf053dfb1756c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-11 10:56:19 +00:00
Marc Mutz
d9eaf0de2b Short live q20::copy{,_n,_if}!
All they do is add constexpr.

Use them in QOffsetStringArray where they replace a custom
implementation, except, as usual, the custom implementation does one
tiny thing more, so not all uses can be replaced.

Explicitly not use it in QStaticByteArrayMatcher to not cause
conflicts with the introduction of QStaticLatin1StringMatcher.

Change-Id: I3c102a7e934a1d7d5fae4cbc629a4fabf2c47c92
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit d6250e2a0da4901e35e8d5fe18b716ff81e06a7e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-11 10:56:12 +00:00
Marc Mutz
971508969b QPdfEngine: port from raw zlib to qCompress()
Hotfix for disappearing zlib symbols caused by QTBUG-104972
and QTBUG-106542 fixes, to be merged later on.

Change-Id: I21e0bf13c866fa7bb45c7587c81e7fddddad90f9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 6fdd986bd9d9eacdfa6210605eb63371136d0e55)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-11 10:56:09 +00:00
Marc Mutz
85dbbc5166 forkfd: fix Clang 15 ATOMIC_VAR_INIT deprecation warning
Replace the macro use with the expansion of the macro as it appears in
both libc++ as well as libstdc++.

Fixes Clang 15 C++20 warning-turned-error:

  forkfd.c:157:39: error: macro 'ATOMIC_VAR_INIT' has been marked as deprecated [-Werror,-Wdeprecated-pragma]
  static ffd_atomic_int forkfd_status = FFD_ATOMIC_INIT(0);
                                        ^
  forkfd_c11.h:51:37: note: expanded from macro 'FFD_ATOMIC_INIT'
  #define FFD_ATOMIC_INIT(val)        ATOMIC_VAR_INIT(val)
                                      ^
  /d/llvm/15/bin/../include/c++/v1/atomic:2671:43: note: macro marked 'deprecated' here
  #  pragma clang deprecated(ATOMIC_VAR_INIT)
                                            ^

Matching OpenDCDiag pull request:
https://github.com/opendcdiag/opendcdiag/pull/159

Change-Id: I0204f7fcd6039624ed75d414daf9b6a771bfd9d0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 35649760e5ec22b4dcea0729ad679f51f438573d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-11 10:56:05 +00:00
Thiago Macieira
43ae941b8d QWaitCondition/Doc: add a simple explanation of the time units
Fixes: QTBUG-107174
Change-Id: Id8d5e3999fe94b03acc1fffd171ae572957e15bc
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
(cherry picked from commit 71f32653cb97040fccce41037e2a7b32a787a4c9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-11 10:56:01 +00:00
Marc Mutz
6a54d8b7b4 [docs] QMap: fix missing toStdMap()&& overload docs
Amends 14090760a87f23509b7bb5ad846537c766cb44a5.

I tried to find a linkable definition of valid-but-unspecified on
en.cppreference.com, but failed, so I'm using partially-formed like
everywhere else in Qt docs.

Ideally, we'd have the discussion of partially-formed (and
valid-but-unspecified) in some extra page and simply link to
it. Created QTBUG-106251 to track the issue.

Change-Id: I04c60cf903b2617c89467d1d040d5aebb7eccd53
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 3cd9536b7f6224b1c8fea2e40afdb5fe7b441f82)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-11 10:55:56 +00:00
Marc Mutz
dcd2735dca QPluginMetaData: replace manual loop with q20::copy_n
Change-Id: I7061b18efd2ff905cc36df41d680c0612a505a76
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9bd287335b2b7a70e116f4ef955e9e12df9009d0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-11 10:55:52 +00:00
Thiago Macieira
1cbae2adcb dbus_minimal_p.h: copy the libdbus-1 copyright to the top
See qt_attributions.json too.

Fixes: QTBUG-107128
Change-Id: I810d70e579eb4e2c8e45fffd1719fbf448154abf
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 184717e3a7cb469693641ea7ebd234ae5d8bd674)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-10 23:50:56 +00:00
Liang Qi
fe400975b9 tests: skip two tests in tst_QDockWidget on Wayland
This amends 9ff40b59da58160dc26c54204a615a2456e07405 .

Task-number: QTBUG-107153
Change-Id: Ie66205c5402d4346ffb61619ccb6a955623f5984
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 8b143f0aed3124aa4c0030f6074263bbd03100a5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-10 20:28:44 +02:00
Liang Qi
97594ea718 tests: skip tst_QAction::disableShortcutInMenuAction() on Wayland
QWindow::requestActivate() is not supported.

Task-number: QTBUG-107153
Change-Id: Iacdcf4ad4f6da4a5a996f26d3b97fb507a4b116b
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit e37baad7fc856d6c5da88020b66a3198969541f5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-10 20:28:42 +02:00
Liang Qi
7eaba5bb67 tests: skip two tests in tst_QAbstractItemView on Wayland
QWindow::requestActivate() is not supported.

Task-number: QTBUG-107153
Change-Id: I9080fbb0ae0a604ad4a7ffa55ba3243d1cf96be8
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 7d38320c4b634f140442bbec51ac45a140aafa03)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-10 20:28:38 +02:00
Liang Qi
c1cc0df2a9 tests: skip tst_QGraphicsView::embeddedViewsWithFocus() on Wayland
QWindow::requestActivate() is not supported.

Task-number: QTBUG-107153
Change-Id: Ie9583e55d298fe392d8ab09e9a10d8fce5ce3fee
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 1dcd4d71715bc3c2b5bb8a6271f5536a02a89f4e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-10 20:28:35 +02:00
Liang Qi
de7154c0ed tests: skip tst_QDialog::showAsTool() on Wayland
QWindow::requestActivate() is not supported.

Task-number: QTBUG-107153
Change-Id: Id8f9cc1d6a29b4d608a080f5b40a5369d7bd8da9
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 65d9b48a70b295eb239fe68e3c5c103546a71d86)
Reviewed-by: Liang Qi <liang.qi@qt.io>
2022-10-10 20:28:32 +02:00
Liang Qi
3a811eae97 Revert "tests: XFAIL tst_QOpenGL::bufferMapRange() on Wayland"
This reverts commit e49d2daf1912f4b94678d077e1edc01fb37a1fb0.

This doesn't fail on Wayland, perhaps a false alarm.

Fixes: QTBUG-100918
Change-Id: I1415afdeaf1bff26dba3b3100b2aafcda00bcdd9
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit f8898cae83f9efb8a93a99743f5107bd6ebd50ae)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-10 20:28:30 +02:00
Liang Qi
09b39af9bc tests: fix window activation usage in tst_QGraphicsWidget
- Skip tests that depend on programmatic window activation on platforms
  where this is not supported, such as Wayland.
- Change tests that don't rely on the window being activated to use
  qWaitForWindowExposed() instead.

Task-number: QTBUG-107153
Change-Id: Ieb4280343a725a2cbdc46a8ac5c657beeb2e7e57
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit a247da320cc221c19c309962f5f6d888f66d9225)
Reviewed-by: Liang Qi <liang.qi@qt.io>
2022-10-10 20:28:27 +02:00
Liang Qi
8da325be2d tests: skip two tests in tst_QGraphicsProxyWidget on Wayland
QWindow::requestActivate() is not supported.

Task-number: QTBUG-107153
Change-Id: I41c0c24c73ea5add821109172470d37a9b6211a8
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 19dabbbc733884d6d6ce55ef95d81e243fa8491c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-10 20:28:25 +02:00
Liang Qi
672269f321 tests: skip tst_QApplication::activateDeactivateEvent() on Wayland
Task-number: QTBUG-107153
Change-Id: I69bd4a0d4217b5e4c2cbee8b25c5bd69509e3329
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit dd608329b258232faf4dd60a0177ce20f475e8f3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-10 20:28:22 +02:00
Liang Qi
7f0783162b Revert "tests: XFAIL tst_QGuiApplication::genericPluginsAndWindowSystemEvents()"
This reverts commit ae1197fc5644c653fbc652b6008b83b5b11def85.

This doesn't fail on Wayland, perhaps a false alarm.

Fixes: QTBUG-100891
Change-Id: I3e1d2488b090f186c64d63cb6c9f97dfaafc8fff
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 5ddb01503839a3e1cebd59f4218ebecfd05e42e5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-10 20:28:19 +02:00
Mårten Nordheim
7dd906f7d0 tst_QTcpServer: blacklist addressReusable on macOS
For some reason it has become extremely flaky.
Blacklist to unblock most patches.

Task-number: QTBUG-107500
Change-Id: I11c3ff5e018981be46c20282fa171bce687596b2
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit ad736e9150af6ac621393529a72c8e67e05c2d5e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-10 18:22:26 +00:00
Mårten Nordheim
03d5a35047 tst_QTcpServer: convert QSKIP to blacklist
So we can gather statistics on whether it is still failing

Change-Id: I1f4080f4d96f31ce2b689cda175af3a35563e232
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 4f17a64f35078069e95cd02308487ff243fc6033)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-10 18:22:26 +00:00
Edward Welbourne
a111c15c0a Skip early return from test loops during cleanup()
The QTRY_* macros and QTestEventLoop exit early if the test has
resolved; however, in the cleanup phase of a test, even if the test
has failed, these loops should continue as normal.

[ChangeLog][QtTest] During the cleanup() phase of a test, the QTRY_*
macros and QTestEventLoop now ignore the test resolution, in contrast
to when they are used from the test itself, which (since 6.3.0) exits
the loops early if the test has failed.

Fixes: QTBUG-104441
Change-Id: I2673161967cbbc57815155af698a9338ab98a686
Reviewed-by: Jason McDonald <macadder1@gmail.com>
(cherry picked from commit 0462dba7665450bdd0dc07e6a7e6ebe2805994a9)
2022-10-10 16:56:56 +02:00
Mårten Nordheim
ff650e6252 WindowsKeyMapper: Fix unsigned/signed mismatch error
error C2220: the following warning is treated as an error
warning C4018: '>': signed/unsigned mismatch

Change-Id: I4ba59f3aa6bbd7b37fe469e6271df207a7d11c99
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 9e7f91781d41ba588efac695c74e5304ec15625d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-10 11:06:51 +00:00
Thiago Macieira
ff8beb27a5 qpoll: disallow file descriptors bigger than FD_SETSIZE
I don't know which platforms qpoll.cpp is still used and if in those
there's even a way to increase the file descriptor limit above
FD_SETSIZE's. But this is an easy change and protects against buffer
overruns.

Change-Id: I810d70e579eb4e2c8e45fffd1718ca1aac8e6bef
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 8c1776ee0781b49e0966d8394f02f55a90d73eba)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-10 11:06:50 +00:00
Yuhang Zhao
1906d225f9 QtRhi: make two plain arrays inline and constexpr
In the current case they can be inline and constexpr.

Task-number: QTBUG-100485
Change-Id: I8c200c0a756edbff914c4be8ba08fe6afbd61114
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit f003e25258e0fd546abe5857f20b626f160beb81)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-10 10:46:47 +00:00
Giuseppe D'Angelo
ed3d60cfca QTaggedPointer: disable operator= with an empty initializer list
Given a QTaggedPointer, users may write

  taggedPtr = {};

to mean "reset it". This is error-prone: due to overload resolution,
this actually ends up calling QTaggedPointer<T>::operator=(T *),
which changes the pointer but *not* the tag, and not the implicitly
declared QTaggedPointer<T>:operator=(const QTaggedPointer<T> &)
which would reset both pointer and tag.

Given the idiomatic usage of {} is indeed to perform a full reset (cf.
std::exchange(obj, {}), std::take, etc.), work around this by disabling
the operator= overload for pointers in case an initializer list is
passed. In other words, make `={}` fall back to the implicitly
declared overload.

Note, this breaks some usages, such as

  taggedPtr = {rawPtr};

but at least we get a compile error for these, and they don't look
common at all.

[ChangeLog][QtCore][QTaggedPointer] The operator assignment
taking a raw pointer has been reimplemented in order to avoid
subtle issues when assigning `{}` to a QTaggedPointer. This will
cause code that assigns a braced-init-list to a QTaggedPointer object
to stop compiling (for instance, `tagPtr = {ptr}` is now ill-formed).

Change-Id: I5e572a9b0f119ddb2df17f1797934933dff2ba7b
Task-number: QTBUG-106070
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 42b66bd809f0cadf232cd8527746b55cd00d9f10)
2022-10-09 17:23:32 +00:00
Laszlo Agocs
f90107341c vulkan: Re-enable VK_KHR_portability drivers
The Vulkan loader as of SDK 1.3.216 and MoltenVK decided that
all existing applications need to stop working with
non-conformant Vulkan implementations such as MoltenVK, unless
they start specifying the right soup of instance flags, extensions,
and device extensions.

Set VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR in
VkInstanceCreateInfo::flags.

Automatically request VK_KHR_portability_enumeration, if supported, on
the instance.

This handles the instance side. On the device side we can add support
in QRhi so Qt Quick continues to work with MoltenVK. This involves
requesting VK_KHR_portability_subset on the device whenever the
extension is reported as supported (not doing so would be an error)
However, applications creating their own VkDevice will need to take
care of this themselves.

This device extension requires VK_KHR_get_physical_device_properties2
on the instance (which QRhi does not control). This is no problem with
Qt Quick as that already does this automatically, but in the unlikely
case of wrapping an existing VkInstance in QVulkanInstance it will be
up to the creator of VkInstance to enable that as well.

Fixes: QTBUG-106912
Change-Id: Idaf277549b3ec982e99bfc49e4ad6a67976c141a
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 7fbc741d107ab679f6abd680ec909ce9b2bf333a)
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-10-06 21:58:14 +02:00
Friedemann Kleint
20f13568a3 uic/Python: Do not generate QByteArray for dynamic C-String properties
Fixes: PYSIDE-2069
Change-Id: I8f37023a6d697ee257f283d08347349f89e7f0a9
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
(cherry picked from commit 369d4f4b5ea688bf9dd729a2ba35ce0292591252)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-06 16:47:18 +00:00
Eric Lemanissier
aeddd791f9 fix fontconfig detection
the "official" variable name is Fontconfig_FOUND
cf https://cmake.org/cmake/help/latest/module/FindFontconfig.html

Change-Id: I40ec178a18baabe47d8d66845ff03add9efc0e51
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 539165dae99d996746801da1cd8a09267cda3c42)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-06 16:46:36 +00:00
Tor Arne Vestbø
3bb905ab21 Document that QSharedMemory requires -feature-ipc_posix on Mac App Store
The QSharedMemory backend build system machinery does not currently
support multiple backends, so the choice has to be made at configure
time.

Fixes: QTBUG-106910
Change-Id: I4b814ca1c131a2860467e96cc5a6dd7cd03fc8b7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 381538991229299c1e62bb0ebf282506b567e322)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-06 16:46:36 +00:00
Mårten Nordheim
3beb8a742b Fix build with SPARC Solaris
Change-Id: I8969d7950f7c5b6164f87ab37f1089b7bc8cae8b
Done-by: Petr Šumbera
Fixes: QTBUG-107178
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 87d12f7f2178b1604635ec9beead5dc0a3fa74ee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-06 16:46:36 +00:00
Axel Spoerl
89583fe7d0 Remove focusProxyAndInputMethods from tst_QWidget
focusProxyAndInputMethods tests focus acquisition and inheritance with
a toplevel widget, acting as a focus proxy for a child.
X11 window managers are set to be bypassed, programmatic focus is set
with QApplicationPrivate::setActiveWindow().

The test is flaky on Linux/XCB, and therefore blacklisted on most
Linuxes.

This patch removes focusProxyAndInputMethods, considering that
- focus proxying is tested in tst_QWidget::focusProxy()
- window activation and focus inheritance are tested in
tst_QWindow::isActive()

Change-Id: I510fd935399d9ad0b6cd76f1bd5db0811e0702f6
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit b439f06941007483ee14aeeb4fb09ac8148c8038)
2022-10-06 11:39:02 +00:00
Friedemann Kleint
840484b4cb windeployqt: Add new multimedia plugins
Reintroduced by qtmultimedia/ccdc369cb82180bc12c3a6b00d33afad2848ba02.

Fixes: QTBUG-105984
Change-Id: Iaca5ac6ad360c78542f20922803bac3375cbe58a
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
(cherry picked from commit f4192dfcf5718b2ccd6ecbc919f7ce93d2d08e66)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-06 11:33:14 +00:00
Timur Pocheptsov
b11821fd77 InputMethodQueryResult - use int as a key, not Qt::InputMethodQuery
In release mode different qHash overloads picked up for enumerators
in 2 different translation units (and this can be even affected by the
order of includes), thus resulting in one hash with which we insert
a value, and a different hash, when we are trying to extract the value,
which _is_ in QHash; getting us a default value (invalid QVariant in our case).

Fixes: QTBUG-106219
Change-Id: I7cce35555d792f03e50639a8d3d25f6a74de05a6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit b22a726f25b47f2a800a16d35da6aee7f622bcd9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-06 11:33:14 +00:00
Volker Hilsheimer
124a8c20ed Make sure that palette cache keys are unique
After 1d961491d817490da156769ddce6fce48a0bce4a, palettes are different
if they either have different brush data, or a different private. Two
privates can share data, but still must generate different cache keys.
The cacheKey has so far been composted of the serial number of the Data
struct, and a detach number that is incremented when we detach the
private.

This failed for two reasons:

- the implicit copy constructor of the Data class copied the serial
number, when it should have incremented it. Fix that by member-
initializing the serial number rather than doing it only in the default
constructor. The member initialization is also executed for the copy
constructor.

- the detach_no logic as it was implemented does not guarantee that two
copies of the same palette that share data, but have different resolve
masks (and thus different privates) have different detach_no values.
Use a static serial counter for that number as well.

Amend the test case to verfiy that cache keys, and the elements of the
cache keys, change when they are expected to.

Fixes: QTBUG-106984
Change-Id: I84d7055ce8bfe0d42f1f8e9766f3f1ad610f4ec8
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 109e088c7c5d0c9325966e88d55fd9f7a58f67ea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-06 07:16:47 +00:00
Tor Arne Vestbø
2cb798ec7b macOS: Pass on native virtual key (key code) for modifier keys
Regression after f563203f60f2cb4d03650af3a357e988aa6bce32. Unlike the
characters and charactersIgnoringModifiers properties, the keyCode
property of an NSEventTypeFlagsChanged event can be read without
causing an NSInternalInconsistencyException.

Fixes: QTBUG-69608
Change-Id: Id3679a468fbc609112bd8fb37aa7acc526492d19
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 3b22e6a8e07170a7a7280107d30ce86005523284)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-05 12:11:04 +00:00
Assam Boudjelthia
e5d28032c0 Use SPDX license identifiers lefovers for some Java files
Replace the current license disclaimer in files by
a SPDX-License-Identifier.

This amends 05fc3aef53348fb58be6308076e000825b704e58.

Change-Id: Ie6bbdcd0d764ce1295f45f2d41d7c1c1ab47d9a8
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 2a47bb221dacefbc606ca24ba8d926009c067fa4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-04 21:31:07 +00:00
Tor Arne Vestbø
d28acffdc0 macOS: Reflect platform settings for double click and key repeat intervals
The KeyboardAutoRepeatRate is unfortunately exposed in QStyleHints as
an int, so any rate below 1 event per second will not be reflected
accurately.

Change-Id: I506762545a1838cf007320e73827def006f5f0c2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ff4e624cd6b4320314ea93d142c707732cb01d4a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-03 14:04:24 +00:00
Thiago Macieira
fc146be897 QString/doc: correct the record on const char* optimizations
This portion of the documentation was there since the Qt 4.5 import of
the repository and may have been correct at the time. They haven't been
for some time and definitely aren't now. So be clear that even if there
are overloads, some of them are bad ideas.

Change-Id: I810d70e579eb4e2c8e45fffd1719adefb6f9f3bf
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d46eeffe83db56aea7703d20351dde2969bf372a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-02 23:07:12 +00:00
Christian Ehrlicher
7d452d17a4 QODBC: fix handling NULL values for strings
Qt6 added a slight behavior change in QVariant - an empty QString in a
QVariant no longer results in QVariant::isNull(). This created an issue
that qGetStringData() could no longer return a NULL value. On the other
side, NULL values in Qt5 could not be distinguished to an empty string
which we now can.

Fixes: QTBUG-106607
Change-Id: Iddc6f7e8b97f5abc136bbbfd02d175b80152ac90
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 44ac742f730a5e8cac229067429eb2f5cb90105a)
2022-10-02 12:31:03 +00:00
Thiago Macieira
6b5eac4697 qsimd_p.h: remove BMI1 feature from the ARCH_HASWELL list
AMD introduced BMI1 to one of their processor generations before AVX2
and BMI2. Complements a98cf15ed1b57aee695de01b04a974637b2cd44a.

Fixes: QTBUG-107072
Change-Id: I810d70e579eb4e2c8e45fffd1719b15d80d88c10
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 29d3938aa56663f09666a0ac58b33e70e00abff2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-01 20:03:22 +00:00
Axel Spoerl
3f87d88ba0 Update documentation of qWaitForWindowActive / qWaitForWindowExposed
Sharpen existing documentation with a focus on use cases and
differences between both methods / overrides in qtestsupport_gui and
qtestsupport_widgets.

Change-Id: I62b7be437dd43bb0b114af66de51fb4d1f55b671
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e3358e233683575a4b3e5385b1a522a8ddd02f27)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-01 12:42:00 +00:00
Thiago Macieira
81fc4dfc35 qsimd_p.h: document that AMD Zen4 supports AVX512
See https://www.mersenneforum.org/showthread.php?p=614191

Change-Id: I810d70e579eb4e2c8e45fffd1719b166daf555e1
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit fee7844759f3c1dbc8a00139d923211990a07775)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-10-01 12:32:24 +00:00
David Skoland
0e8f2fac5a wasm: enable QT_BUILD_MINIMAL_STATIC_TESTS by default
Wasm doesn't play well with these baseline tests in general,
so we can disable them for now.

Change-Id: I5a66a932449c8934d88b94e419aae5ddcc89ee78
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit c3730ffa9228ba43f4b7c7ec518a7a47e981ff2e)
Reviewed-by: David Skoland <david.skoland@qt.io>
2022-09-30 11:26:20 +02:00
Joerg Bornemann
42acd3514b CMake: Write all Host* properties to target_qt.conf
Otherwise, qmake won't work if the host Qt was built with custom
INSTALL_BINDIR and friends.

Task-number: QTBUG-106712
Change-Id: I436103efc21f245cc220f4706adcab369feba836
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 5818dd3cadfe8184ed37a5d3d8363a1204a90aac)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-30 06:13:56 +00:00
Yuhang Zhao
de0f12ec70 OpenGL: Remove pre-Win10 leftovers
Qt6's minimum supported platform is Win10 1809, and all pre-Win10
code have already been removed from QtBase long time ago.
These code are trying to support Windows 7 to Windows 8.1, which
nowadays become legacy code and should be removed.

Change-Id: I21a979d32d99977107964bccc06fdec7b38cd727
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit bdadc3340c1656980983ea4acade4d781d750bef)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-30 05:00:20 +00:00
Fushan Wen
9b88b0fe2f Send string to Atspi DBus interface on value changed for comboboxes
Orca only accepts string or list type for
object:property-change:accessible-name events. This fixes
NameChanged not being announced by Orca.

Change-Id: Ib30fed94aad70b98400deec5e31630b4f8c22e26
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c6b1c3381461b01255b432468fe38ed5c32b6537)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-29 23:56:32 +00:00
Thiago Macieira
727de65816 qsimd: remove the F16C macro in the Haswell sub-arch testing
F16C is an Ivy Bridge (third generation Intel Core), not Haswell (fourth
generation). This allows compiling with -march=native on Ivy Bridge and
equivalent systems.

Fixes: QTBUG-107072
Change-Id: I810d70e579eb4e2c8e45fffd171962f8a8d2bbb1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit a98cf15ed1b57aee695de01b04a974637b2cd44a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-29 22:30:02 +00:00
Eirik Aavitsland
c38a954d9f StyleSheetStyle: Fix color of placeholder texts in text edits
Prior to 5.12, the placeholder text color was hardcoded to be the same
as the text color, but with an alpha of 128, i.e. semi-transparent. In
5.12, it instead got its own ColorRole in QPalette. So behavior
changed (In some cases in 5.12 and later, consistently from Qt 6):
placeholder texts no longer got a "light" (semi-transparent) version
of the css-styled color, but just the default gray/semi-transparent
black. That problem was reported as QTBUG-89815. However, the fix for
that bug did not apply the semi-transparency, but only used the same
color as the text. That caused a confusing visual expression, as
actual and placeholder text would look the same. This commit fixes
that.

The problem was made worse since there is no way to specify the
placeholder text color from css, i.e. to style it independently. A
follow up commit will aim to add that.

Fixes: QTBUG-92199
Task-number: QTBUG-93009
Change-Id: I9e6698d34eba91cbf65c4da07aa5ac6d9f96a9ed
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit df0b70eece519b1c78353588ba92ef39d873aa1f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-29 06:21:18 +00:00
Eirik Aavitsland
e3e655744a Fix setScaledClipRect autotest for reading SVG format
Since setScaledClipRect will actually render only the necessary parts,
there may be insignificant differences in rounding/anitaliasing
compared to rendering the whole image first and then clipping.

Hence this autotest case would always fail. But that would not happen
in CI, since it tests qtbase without the qtsvg module, and then the
SVG tests are skipped. (For some reason, one ran into this in wayland
testing and made an exception for that, but obviously this failure has
nothing to do with wayland).

Work around the issue by converting the rendered images to 4 bpc
format, so the differences in the least significant bits get truncated
away.

Fixes: QTBUG-100917
Task-number: QTBUG-81044
Change-Id: I1c14e98af22d0ae22a751960b69e692c7a38399b
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 458ec4cb5442315c2c923ba78faf45fdd729a109)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-29 06:21:08 +00:00
Giuseppe D'Angelo
7e476f5c48 QDateTime: specify a class template argument
Although the code is legal in C++20 (due to the new CTAD rules for
alias templates), clang-cl errors out on it. Just specify the template
parameter, which we know anyways.

Change-Id: Ifdea31853d4281601cf40ed8adeb14e493a5ce04
Fixes: QTBUG-107043
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit f2b4adebd40c56243bc6f042bc7f46e800c12423)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-29 03:53:12 +00:00
Christian Ehrlicher
9eb2a5bf8f QODBC: correctly fill cache when index() is called
QODBCResult::isNull() incorrectly checked for the validity of the
internal row cache which lead to wrong results when the requested
column was not yet cached.

Change-Id: Ic7dcc2117e6f05b63c83f21c6a84ba7e0bda2b2d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 91374bb6322cf09525e99698c8fae7688c227d74)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-28 18:54:26 +00:00
Mårten Nordheim
5d5ab28eaf qHash: Add seed argument for classes inheriting QString
Pre-requisite for a fix for qHash. The classes inherits from QString
and after the upcoming fix their single-arg qHash overload is no longer
preferred since we want to use a seed. This has been the case since
Qt 5.

Change-Id: I6e8601ab8d591742e2399d10521dec8cfa46f71a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit a6e8ee141d4f0fa9c19f689a279447c7e7252629)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-28 16:26:34 +00:00
Kai Koehne
1cb57091ac Revert "Keep original text for text/plain mime data"
This also affects things like line breaks, effectively preventing the paste of copied text to non-Qt applications.

This reverts commit 17eb0f2d8a84eb54e6e4fbfa981ca3bae8c7e919.

[ChangeLog][QtGui][Drag&Drop] The fix to preserve special characters
like &nbsp; the text/plain part of the clipboard when copied from
a QTextEdit or QLineEdit had to be reverted (QTBUG-107004).

Fixes: QTBUG-107004
Change-Id: Ia226f38f31a368c381910e1d43b6422395a5744f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit a51e7876b8adee2d6ddb721de9b4525cd1025ad7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-28 16:26:33 +00:00
Kai Köhne
05ca943de2 Doc: Fix typo in QFileDialog documentation
Fix typo introduced in 9cd3ff2bdea

Change-Id: I248779c06fff81aaea1ef8f0a3a412cfb7cfc0bc
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit 12ff1888b16d91db9227d856d38d9b5740f7e191)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-28 16:26:33 +00:00
Thiago Macieira
f5dda2390f Logging: remove const from the lambda calling dladdr
In some OSes, the function takes a plain void*.

Fixes: QTBUG-106980
Change-Id: I810d70e579eb4e2c8e45fffd1718bdaf94d8ac0e
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 7d7d4671bd641634bd7ab8fd523ca96f7cda95ee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-28 16:26:33 +00:00
Mårten Nordheim
ea730ed599 Update tst_bench_qhash hash functions to use size_t
Pre-requisite for a fix for qHash. The Qt50String inherits from QString
and becomes ambiguous once it no longer goes through a catch-all
template function because qHash(QString, size_t) has a better match for
the second argument.

Change-Id: I23c7afb1b3aa167d40dc4838e82b7763de015f6b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7fea2d34fb3e9d13deb584595d119c870389b912)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-28 13:19:11 +00:00
Martin Storsjö
4a9fb8c475 QPluginLoader: Fix the expected machine word for Windows on ARM
This fixes loading plugins on Windows on ARM
since 892d5607d0b1c9e010ea10a1123e68741c46c21e.

IMAGE_FILE_MACHINE_ARM was used for older Windows targets on ARM,
in particular Windows CE.

Change-Id: I61ef7a6b5920af9192c55209f2641a6c469ad1d2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit c36412603dd798007f7acc0b12b8a7754ee90c4b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-28 13:19:11 +00:00
Morten Sørvig
6ade22c7cf wasm: add Window.localStorage settings backend
Window.localStorage provides a synchronous API for storing
saving data across browsing sessions, and is a good match
for QSettings. Storage is limited to 5MB per origin, which
should be sufficient for typical application settings.

Window.localStorage is shared by all pages/apps on the
origin (e.g. "https://qt.io" is one origin), which makes
key collisions possible. To avoid this the key structure
is "qt-v0-org-app-userkey", where both the organization
and application name is used to differentiate between
keys, and "v0" is a version tag to allow changing the
key structure in the future. We reserve the "qt" prefix
for keys written by QSettings.

Add the new implementation as QWasmLocalStorageSettingsPrivate,
rename the existing settings backend to QWasmIDBSettingsPrivate.

Make QSettingsPrivate::create() support backend selection using
the QSettings::Format enum. It now also supports selecting the
Ini backend, which can be used to store larger amounts of settings,
for example to a file on IDBFS. (alternatively IDBSettings +
asyncify could also be used for this case)

Change-Id: If70aa488635018218bc2a19803c4a719732c0004
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-09-28 13:19:11 +00:00
Joerg Bornemann
e609a00aae CMake: Fix HostData qmake property for cross builds
The target_qt.conf file contained a wrong HostData value if the
effective data dirs were set to paths of different levels in the host
and target Qt builds.  Fix this by computing the relative path from the
mkspec dir's parent to the ext prefix' data dir.

Note that qmake's HostData dir is the root directory of the mkspecs
directory.

Task-number: QTBUG-106712
Change-Id: Id8c9de925f5ff51901677b7218621747169a5cec
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit ea92137e7624d4abd544d79be8faf99471bfd87b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-28 13:19:11 +00:00
Samuel Mira
1437422bd2 Android: Fix Display.getRealMetrics deprecation
In latest Android versions some functions related with Display metrics
were deprecated. This patch changes some instances of that code to use
the Resources.getDisplayMetrics or WindowManager.getMaximumWindowMetrics
depending on the situation.

Fixes: QTBUG-99543
Change-Id: Id9846efa877f704ef7f58c1b0820ad1527b53f09
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 413593183bbb1137fdc784d98c171d67a167bb32)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-28 10:29:44 +00:00
Volker Hilsheimer
163734a8cf Add "We mean it" warning to new private header
Amends 5e48a51608485cbc87b68498fd54ab36f001d584, fixing warning
from syncqt.

Change-Id: I15d22a1bba865777c17180438b6e89ee9e1ae78b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit e6da018c86d874f5f0a5549f97609bf456a6f0d3)
2022-09-28 06:28:57 +00:00
Alexey Edelev
045a27ad07 Fix condition that runs the scanning of the Qml imports
Scanning of the Qml imports should be run if either Qml root paths or
.qrc files are specified for androiddeployqt.

Task-number: QTBUG-106939
Change-Id: I3229ec6d3f2ac17ef751b4a6ed74e8e98db7465e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 24f68a0deb7aea19d9d80391a35c76043ed7532e)
Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
2022-09-27 10:16:23 +00:00
Richard Moe Gustavsen
b260d7b7ee iOS: send control keys to Qt, even if IM is enabled
Perhaps dating as far back as 829e421ddcd5e8f (Qt 5.8), using
the arrow keys on a bluetooth keyboard to navigate the cursor
around in a TextArea/QTextEdit has been broken. Some work
was done to remedy this with 15576c9610 (Qt 6.1) it seems, but
still, using the arrow keys is broken in 5.15, 6.2 and dev.

This patch will ensure that we send control key events, such as
Qt::Key_Up and Qt::Key_Down, to Qt, also when the focus object
accepts Input Methods.

Fixes: QTBUG-101339
Change-Id: I2d12438a822a607646080ab2edb17de8ea6d337c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit f7e4987966205154fcbd819df31aef2dcece5397)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-24 11:42:48 +00:00
Axel Spoerl
41e488c2fc Fix native titlebar offset and resizing upon unplugging dock widgets
When a dock widget received a native title bar upon unplugging, the
position of the newly unplugged dock widget was calculated without
taking the title bar's height into consideration.

Furthermore, dock widgets grew by the separator size upon undocking.
That is fixed by 10a143ccd762c810f4096a5b2e986d16ea0107ad by relying
on the assumption that passing a QRect() to the unplugging method
leads to un unchanged dock widget geometry.
However, when more than one dock widgets are docked in the same
main window dock on macOS or Windows, the size is stil increased.

This patch corrects the position offset for native title bars.
It also corrects an unplugged dock widget's geometry by the sparator's
size.

Fixes: QTBUG-106530
Fixes: QTBUG-106531
Change-Id: Ia4bcb556841e14146f19c1377f4010d5ae009bcf
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit d46f317c8e69376b5f124fba3c42fff5e394699f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-24 08:20:42 +00:00
Shawn Rutledge
6fe38482ee Rename QHoverEvent ctor pos argument to scenePos
The QHoverEvent ctor takes two points: scenePos and globalPos; the first
of those is passed to the QSinglePointEvent ctor as _both_ the local and
scene pos, which calls QMutableEventPoint::setScenePosition() on the
persistent QEventPoint instance, and then detaches before setting
ephemeral state.

Therefore, we must construct QHoverEvent with scene position, not local
position, so that the right value is persisted. To localize a
QHoverEvent during delivery, use QMutableEventPoint::setPosition().
This needs to be done repeatedly while visiting multiple widgets or
items; the detach() prevents it from being saved in the persistent
QEventPoint in QPointingDevicePrivate::EventPointMap.

Amends 0a64a044b6c1c44b0a2bb2be5e70fda920f5f6bf

Task-number: QTBUG-35409
Task-number: QTBUG-100324
Change-Id: Ic1084e1c3cd384683666ba52fe34f16b9d039877
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9d6c1f387afda1a73df8cafb10d9b5bf883e5479)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-23 21:30:04 +00:00
Eskil Abrahamsen Blomfeldt
034b500f09 Revert "QTextLayout: fix maximumWidth() for a text containing line separator"
This reverts commit 013c346a8dcbd618febb07884c64c740daf9754d. It was
determined to cause a regression in Qt Quick: QTBUG-106899.

In order to unblock integrations, we need to revert the change. It
can be re-committed later when the problem has been analyzed and
addressed.

Fixes: QTBUG-106899
Task-number: QTBUG-89557
Task-number: QTBUG-104986
Change-Id: I04054587f68ab39fdb038b02fc69ebfa3dc7d197
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ce4c26c8d16fbc9fdafd8325b8a0b32bacd8cd93)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-23 18:09:08 +00:00
Richard Moe Gustavsen
f34693408f iOS, input panel: be more careful before enabling QIOSKeyboardListener
The current implementation would assume that if we get a
UIKeyboardWillShowNotification, the keyboard is about to
show, and we should therefore enable the gesture.

This is problematic on an iPad with a hardware keyboard
connected, because we do actually get get a
UIKeyboardWillShowNotification on startup, even when the
standard input panel is not showing. From speculation, this
is probably because there is a little floating menu at the
bottom of the screen that lets you start dictation mode.
And in UIKit, this is probably implemented as a UIKeyboard.

This new input panel has a zero size, according to the
UIKeyboardFrameEndUserInfoKey key in the notification.
This means that we can still trust our own implementation
of QIOSInputContext::isInputPanelVisible() to be false
when a hardware keyboard is connected.

This patch will therefore only enable the gesture if we
understand the input panel to be visible, rather than
automatically assume that it is based on the
UIKeyboardWillShowNotification alone.

This will also stop the assert inside touchesBegan
from triggering.

Fixes: QTBUG-106387
Change-Id: Ia3d27864325b6efb49f03fb20b711979f2d07fbf
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 9516823fce1d6f9bb7446fba8192396453af1557)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-23 17:29:56 +00:00
Yuhang Zhao
8e82e929b5 Windows QPA: remove two unused forward declared structs
They are not used, so just remove them.

Change-Id: I9b92ef97df85a1ab975bf6b6d460b5427135c301
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 20ae1cd486104cda556051040719dcbd56516bad)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-23 08:35:05 +00:00
Mårten Nordheim
d29a10c189 QFlags: Mark the operators declared in macro maybe_unused
Because, when used in a .cpp file, the compiler can verify that
they are. With warnings-are-errors this breaks compilation for me
on windows with clang++.

Change-Id: Ib29c3b0b485be2c7d7cf6f1fa4541cac8fe32708
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 2c6c76374eeb649f40787c840f9b4b38e5d48ccb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-23 01:31:08 +00:00
Mårten Nordheim
631087460f QFlags: Mark the mixed enum operator declared in macro maybe_unused
Because, when used in a .cpp file, the compiler can verify that
it is. With warnings-are-errors this can break compilation.

Change-Id: I2c403d914fca24158dba93f618476521cbcfe39f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit bf9ba81429076002614e19620588da6ca6b8cfd0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-23 01:31:08 +00:00
Fabian Kosmale
617e1fe20a QMetaType of non-const ref: play nice with template instantiations
...by making QMetaTypeId2 contain all expected members.
While we don't allow QMetaType from non-const references, we want to
get to the static_assert telling us as much, instead of running into
more or less incomprehensible error messages in the depths of
qmetatype.h.

Task-number: QTBUG-106672
Change-Id: Ica9b13fee95eda97cafab2cccdc5249dfc3dcdf2
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 9b3de58d2dfedfdd8097b329438a2f2f086aa43f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-22 20:43:47 +00:00
Mårten Nordheim
b404ad5894 tst_QHash: Fix outdated rehash test
Inserting the same key repeatedly with QMultiHash will not
test rehashing behavior because in Qt6 those entries all
end up in a linked list.

Change-Id: I78c45eed0f35a13af6d6da75d7189a6933750f13
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c633f4644c0065964345402535d54f3749431d82)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-22 15:40:30 +00:00
Mårten Nordheim
8f1fc6c2c4 QNetworkReply: honor legacy behavior of setting Accept-Encoding
And don't decompress the data

Fixes: QTBUG-106689
Change-Id: I93a96be8178e24ff0b0bb8647276828161445cf5
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 1fa0e86995bfdf9c0507fcd097fce712554a769e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-22 15:40:30 +00:00
Laszlo Agocs
7b8771d618 eglfs: Add env.var. to disable the dedicated drmHandleEvent thread
Setting QT_QPA_EGLFS_KMS_NO_EVENT_READER_THREAD=1 makes it operate
like it did before 5.12.7: just calling drmhandleEvent (guarded by
a mutex) on the current (main or render, depending on the QQ render
loop) thread.

This should not be needed and is discouraged (will certainly cause
deadlocks in multiscreen setups + QQ threaded render loop on certain
embedded systems), but it seems necessary to provide a way to revert
back to the old way of functioning as there are reports about
problems with screen cloning when the dedicated event reading thread
is used.

Task-number: QTBUG-91882
Change-Id: I4cddcd09149dcab9e135467b6ef0e047a2a0ecff
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 820775166132b073a941f2389fba81db49619688)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-22 15:40:30 +00:00
Friedemann Kleint
0805c5b07e Brush up the drop site example
- Use qsizetype
- Use new string literals instead of deprecated QLatin1String()
- Streamline some code
- Remove unused member variable
- Remove module include

Change-Id: Ia96424a23f3ae10e57db942de49949ce3aef8876
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 33bee95910eda6ee06e47753f87e4f140f309721)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-22 12:53:45 +00:00
Axel Spoerl
1098778129 Prevent dock widget from resizing upon unplugging from main window
QDockWidgetLayoutState::itemRect() has been used to calculate a dock
widget's size when unplugging from the main window. This method is meant
to calculate the size of the rubber band, showing the dock widget's
dock area.

The rubber band is by QDockAreaLayout::sep wider (top or bottom dock)
or higher (left or right dock) than the respective dock widget. This is
to make sure the rubber band is never fully covered by the dock widget.

By wrongly using itemRect() also for the dock widget's size after
unplugging, the dock widget grows in size each time it is unplugged.

This patch passes an invalid QRect to QDockWidgetPrivate::unplug(), in
order to prevent resizing.

tst_QDockWidget::unplugAndResize() is extended to check size
consistency after unplugging (corrected for frame margins).

Fixes: QTBUG-106531
Change-Id: I1cf9f695691b0e165a5cb2881781602426e5d587
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 10a143ccd762c810f4096a5b2e986d16ea0107ad)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-22 10:25:31 +00:00
Fabian Kosmale
bd14c12e28 moc: Do not fail to compile meta-methods containing non-const ref types
Amends 2d0c31e7d92a3e9df4ce2b9c1d41b94fb12735fc. We were using
MetaTypeDecay in qTryMetaTypeInterfaceForType; but that is not used by
moc when complete types are enforced. Change qt_metaTypeArray to also
use qTryMetaTypeInterfaceForType, so that the code path for "force
complete types"[0] and the normal one do not diverge.

[0] Most easily enabled by using one of the QML type registration
macros.

Fixes: QTBUG-106672
Change-Id: I9bf14873d1d0c4127a676643f7e8eb77f6e42dc8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit a8ccd9cd848be9aafd2d07d83a8897dc8b2a0cb3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-22 05:16:15 +00:00
Alexey Edelev
9775c63340 Propagate QT_HOST_PATH_CMAKE_DIR to multi-ABI external projects
If QT_HOST_PATH_CMAKE_DIR is set it also needs to be used by multi-ABI
external projects. Add it to a list of cmake arguments.

Fixes: QTBUG-106616
Change-Id: I5b12f72cabdad86846851fb3605e5388896e5abf
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 79d3fba2eb271096b3d3da3b763b18f73a225201)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-21 12:00:52 +00:00
Jaishree Vyas
b627f51978 Document QAtomic testAndSet
[ChangeLog][QtCore][QAtomic] Documented new overloads of testAndSet()
that were originally added for 5.3.

Fixes: QTBUG-103008
Change-Id: I96c7b5828dc284651e6514389f405d7670d6784b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit b62c3a85452aecf4f6c863645db34857b05d5ebf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-21 09:16:02 +00:00
Sona Kurazyan
ee349ffba0 QFuture: fix handling of cancelled continuation chain
To support cancellation of continuations attached via the parent future,
for each future returned by a continuation we store a pointer to its
parent (i.e. future the continuation is attached to). Later, before
executing a continuation, we go through chain of parents and check if
any of them is cancelled. However, if one of the parents is destroyed
while the chain is executing, the next continuations' parent pointers
will become invalid. So storing the parent pointers isn't safe.

This commit changes the logic of handling the cancelled continuation
chain in the following way:

- Instead of storing a parent pointer in the continuation future's data,
  we do the opposite: we store a pointer to continuation's future in the
  parent.
- When a future is cancelled, we mark all continuation futures in the
  chain with a flag indicating that the chain is cancelled.
- To guarantee that the pointers to continuation future's data don't
  become invalid, we clean the continuation (that stores a copy of its
  future's data and keeps it alive) only when the associated promise
  is destructed, instead of cleaning it after the continuation is run.

Fixes: QTBUG-105182
Fixes: QTBUG-106083
Change-Id: I48afa98152672c0fc737112be4ca3b1b42f6ed30
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 24dedaeaa1a94bfe9ade2da2a2c9aa112241b07a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-20 23:18:40 +00:00
Axel Spoerl
2d7f68fac1 Make commit() call in QTouchEventWidgetSequence explicit
Calling commit() in the QTouchEventWidgetSequence destructor bypasses
the vtable. This causes a compiler warning.

This patch eliminates the warning by explicitly calling
QTouchEventWidgetSequence::commit().

Change-Id: I1354aa22d2a85a609adc307338d118c5789df93f
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit feed452a9987a4629b03d3bc4a629ba7978ab7ba)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-20 18:52:50 +00:00
Tor Arne Vestbø
fab25293b3 windowflags: Report QWindow compound window states
Change-Id: I44b923df6851d0f51ac39bcbb4a569cb2fde775d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 6fc751aedf31111f833349fa743c23dc2e95c39a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-20 14:35:18 +00:00
Tor Arne Vestbø
0b04f858f8 macOS: Report compound window state when state changes
Otherwise we lose the fact that the window is both maximized and
minimized, if the minimize transition is asynchronous, as it is
on macOS 13.

Task-number: QTBUG-104210
Change-Id: I76199e98927e6e4a0f379d78db0603faa80aa4b0
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 55a7385296a516ce3532f24053b0dc37a1c974f0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-20 14:35:09 +00:00
Tor Arne Vestbø
5d23caf776 Clarify that FramelessWindowHint does not guarantee fixed sized windows
Depending on the window manager or operating system the act of making
a window borderless may also affect the ability for the user to move or
resize a window interactively. However, this is a side effect of making
a window borderless, and should not be relied on. The correct way to
ensure a window has a fixed size it to use setMinimum/MaximumSize.

Fixes: QTBUG-103503
Fixes: QTBUG-106710
Change-Id: I6d82380f5a9af1f08b12cb445792ecbf71bb0377
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9796670732b24d36751371824726a79fe5b38f20)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-20 14:35:08 +00:00
Tor Arne Vestbø
9702e8107f macOS: Handle asynchronous deminiaturizing of windows
As of macOS 13 this operation is now asynchronous.

Change-Id: I9431e24803c53a3fa455707b20a6814290718766
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit dc1f931a9169484b8f2c39bd1f8d4bd4e148ea14)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-20 14:35:06 +00:00
Venugopal Shivashankar
dba46183cd Doc: Update the animation framework overview
- Clarify how the object ownership works
- Language clean up
- Update the snippets

Task-number: QTBUG-106071
Change-Id: I7caf42a150ef82dee920df4d03db6fd988796bd4
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit 4a338aa1804a4d812cf1b9bb20274e480e3c8e9c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-20 13:35:05 +00:00
Santhosh Kumar
32b7278640 Clear WA_UnderMouse attribute when widget gets hidden
From 6.3 onward, hiding a widget doesn't automatically clear
QT::WA_UnderMouse attribute.

This leads to multiple buttons drawn with highlighted rectangle at the
same time (refer bug). The behavior is observed after
commit 0246bfd40a2cc5ea9cfc035146e6dd865b334c68 made as part of
bug QTBUG-53286.

This patch clears WA_UnderMouse attribute in widget hideChildren() and
subsequently, widgets that are hidden will not inherit this attribute
on the next show operation.

The attribute will be set only when the widget is under mouse cursor.

Fixes: QTBUG-104805
Change-Id: I4988eb72577fd557a328fd08bb09fa2fbded3138
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 82e7ac23a035a1c034d2ed665ecaeeb72914b715)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-20 13:35:05 +00:00
Vladimir Belyavsky
70e33a585c QTextLayout: fix maximumWidth() for a text containing line separator
When laying out, we need to increase layout's maximum width _only_
if the previous line was not explicitly wrapped by a line or paragraph
separator, or if the current line's width is greater than the
previously accumulated layout's maximum width.

Fixes: QTBUG-89557
Fixes: QTBUG-104986
Change-Id: Ib7cc4b9dda8f20166dcbd5cfd3b56424bb33d14a
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 013c346a8dcbd618febb07884c64c740daf9754d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-20 13:35:05 +00:00
Mikolaj Boc
bc01540a6d Make the clipboard paste from the outside work correctly
During the previous refactoring, two exceptions that triggered
native copy/paste events were omitted.

Fixes: QTBUG-106668
Change-Id: Ie61dd6a0c1d9d2fdd47bd94be055d0221feae25b
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit 38049164c370dd424afe0c4574b458f7bd79083b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-09-20 09:32:09 +00:00
Liang Qi
eb8aab9b60 tests: improve tst_gestures on GNOME
There are some issues when testing QGraphicsView on GNOME(xorg)
overlapping with the default top bar. This change only move
the view a bit.

Notes:

* There is no CentOS in CI any more.
* panelPropagation() and panelStacksBehindParent() failed in CI
and local vm on Ubuntu 20.04, but only in CI on Ubuntu 22.04.

For example, we can turn the top bar off:

In Extension Manager, install Just Perfection, and disable Panel
in Visibility in it, all tests will pass too.

Task-number: QTBUG-84258
Task-number: QTBUG-103054
Change-Id: I05c262540c85af00182cd142760c4a29554b04c9
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 571e7a41f55d60fef019ea7106213ffe37d5eb16)
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Liang Qi <liang.qi@qt.io>
2022-09-20 07:32:24 +02:00
Bartlomiej Moskal
dc53e7e60f Examples doc: Tags fix for QtQuick examples
Four examples in QtQuick module had wrong tag in qdocconf file:
-QQuickRenderControl D3D11 Example
-Scene Graph - Direct3D 11 Under QML
-Scene Graph - Metal Texture Import
-Scene Graph - Metal Under QML

The first two are specific to Windows. The other two are IOS specific.
They were all marked as "android".
This commit changed those tags to correct one.

Fixes: QTBUG-106436
Fixes: QTBUG-106438
Fixes: QTBUG-106439
Fixes: QTBUG-106469
Change-Id: I3d8d3cb54e4e552d7574c7c2f1d59437374c6446
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
(cherry picked from commit 7ae963292906510b4d589c2c5063520af0d67a4e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-19 14:35:37 +00:00
Aleksandr Reviakin
1444763616 wasm: capture pointer unconditionally on PointerDown event
The pointer events weren't captured previously
if, for example, mouse was pressed inside the window
and released outside of the window.

Fixes: QTBUG-71948
Change-Id: Ie50e5c132fa03046f0c5b321c35a58cb9f34b67a
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit aee64bbe134b057b60e8848a8433cd9c4329b046)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-19 10:14:30 +00:00
Aleksandr Reviakin
c8b9fcef6c wasm: add DejaVu Sans as a fallback font
Add fallback font which supports emoji.
Similar logic of addding additional fallback fonts is used
for some other platforms.

Fixes: QTBUG-87339
Change-Id: Iad9e7071bcc3c5bb1c11c6c745fd86f7d0f7860b
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 81d9b5ada4d6e495a592123cf76ac5fff0718014)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-19 10:14:23 +00:00
Tor Arne Vestbø
9ee1576b5a macOS: Remove hard-coded logic for determining if key event has text
The normal flow for a keyDown event when sent to a text input enabled
view (NSTextInputClient), is that it's sent through interpretKeyEvents,
which in turn goes through the input methods, and result in either
composing (marking) text, inserting text, or executing a text editing
command such as moving the cursor to the beginning of the line.

  https://apple.co/3qDhwNb

In our case, we prefer to treat "simple" text insertion (non-composed
text) outside of the Qt input method protocol, and send these as normal
key events instead. The same applies when a key event results in a text
editing command that we don't handle.

The problem is that in the latter case, the key event would contain the
text that resulted from e.g. ⌘+K, or one of the function or arrow keys,
which in many cases would not be suitable for inserting into a text
field by a naive client that trusted the text property of the QKeyEvent.

To work around this two exceptions were added; first in 4dbce2a4696081
to ignore text when inside the U+F700-U+F8FF unicode range (arrow keys,
function keys, etc), and second in 933fab137dcaa8 to ignore text for
events that had one or both of the control or command modifiers.

Unfortunately this hard-coded logic was not taking into account that
some keyboard layouts may produce text that match these exceptions,
for example ^⌥+ю with a Russian keyboard layout should result in
inserting a period.

Instead of continuing to add hard-coded exceptions to this logic,
(for example by only filtering out single-modifier events), we
instead use the information that the text input system gives us
via doCommandBySelector to decide whether the key event should
have text or not.

Note: We have similar workarounds for detecting text that is not
suitable for text insertion in other places of Qt, for example in
QInputControl::isAcceptableInput(), but since we can't assume the
client uses QInputControl for their text input needs we need to
filter out the text earlier than that.

Fixes: QTBUG-106393
Task-number: QTBUG-36281
Task-number: QTBUG-35734
Change-Id: I7769098cba1c605f6fdb6b23964eb614578724bb
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 705665957baf16f9ec4d256dd4d2fad98788314b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-17 22:11:44 +00:00
Samuel Mira
52af31fbbd Android: Fix flickering on window resize and show keyboard
Changed to use display getMetrics which will return the size of the
application window, and use getRealMetrics to obtain the size of the
largest region accessible to the app.
I updated the fullscreen mode to use the new sizes.

Task-number: QTBUG-41170
Task-number: QTBUG-66727
Change-Id: Ic25555ed2e1b910b3fdbc0f3a31e3a19763a04eb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
(cherry picked from commit 072387edecb2269097821e35f1f232da6c657650)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-17 11:19:46 +00:00
Allan Sandfeld Jensen
0459b572b3 Fix flaky FP32x4 test
The composition implementation may act unexpectedly on Inf or NaN input
values. This change avoid those values, without changing the current
implementation.

Fixes: QTBUG-101236
Change-Id: I8e4ee67f53093b7f81e014b28d8a028ba2ddcc47
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 0e90bdbaa43b05a0c0711c78c749bb8379efa755)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-16 23:09:17 +00:00
Thiago Macieira
db5fc3711b tst_QFile::setPermissions/Unix: test both chmod() and fchmod()
On Unix, we have the fchmod(2) system call that changes the permissions
of an open file descriptor. This commit adds a test for that, by not
closing the QFile before setPermissions().

Change-Id: If5d5ef6220874ae8858efffd171255b9f20ed501
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 864fbd65828e0e84e588c896d778ae523a30e97b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-16 18:15:05 +00:00
Thiago Macieira
bc2546ba5f tst_QFile::setPermissions: add QScopeGuard to remove temporary file
Change-Id: If5d5ef6220874ae8858efffd17125580b5943cc2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 0193b4d2193b989d44dd28deda6dce12ae11ca4e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-16 18:14:58 +00:00
Thiago Macieira
ea9e8cc7e0 QFileDevice: clear cached permissions on setPermission()
In theory, if we succeed, the permissions should be what we set, but
let's not make that assumption. And if we failed, it might be because
the file disappeared or something else, so re-stat()ing the file is a
good idea.

Fixes: QTBUG-7211
Change-Id: If5d5ef6220874ae8858efffd171255506b7bbee0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 4b997d1851bc62b9a1eb761f08d3b22c85bb0b51)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-16 18:14:49 +00:00
Mårten Nordheim
f2c00dd038 QNetworkReplyFileImpl: Don't emit 'finished' in the ctor
Fixes: QTBUG-105618
Change-Id: I3bd36fbd5818d54088098e750643c3e2de30496e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 68f641095c5403925e49954aea0e65c4574121e0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-16 16:52:02 +00:00
Alexandru Croitor
7bb095f09c CMake: Fix return value of applicationName() on macOS
QCore::applicationName() is influenced by what values we insert into
the Info.plist file of an application bundle.

We accidentally inserted tokens like ${PRODUCT_NAME} that are meant to
be expanded by xcodebuild, even when using a generator like Ninja.

This caused the applicationName() to report "${PRODUCT_NAME}".

Make sure to only call relevant finalizers for macOS applications
when using a generator other than Xcode.

Amends d5580aa7194b84306da52efb189cf126dbaee1f7

Fixes: QTBUG-106652
Change-Id: Idbc9c84557a8f17b1302e6969f6eb317e3ef225d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 865b1721bd284fac6c68eadb335507ea6cffb676)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-16 16:52:02 +00:00
Michael Weghorn
bc75982253 a11y atspi: Add null check in GetRowHeader handling
Just like the GetColumnHeader case already does, check
that the cell isn't nullptr before trying to retrieve
the table cell interface from it.

(Not doing so e.g. resulted in a crash with WIP branches
of LibreOffice and Orca to make selected cells with a
child index not fitting into 32 bit work, s.a.
https://bugs.documentfoundation.org/show_bug.cgi?id=150683 )

Change-Id: Idd55fd1f0c49b616c732ddb683814605a46ff319
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 5462485a59373b9871261910895b9b8987442b48)
2022-09-16 14:23:25 +00:00
Alexandru Croitor
f1fe9ae895 CMake: Add function to get tool wrapper shell script path
The _qt_internal_wrap_tool_command function has a limitation
that it is not possible to use it when a command needs to be wrapper
in a generator expression.

Provide a lower level API called
_qt_internal_get_tool_wrapper_script_path
to just get the path to the wrapper script, ensuring that the script
is created if needed.

Deprecate _qt_internal_wrap_tool_command, in favor of replacing it
with the new API.

Task-number: QTBUG-90820
Task-number: QTBUG-96232
Change-Id: Ie4a4a17178bf2061ae01ee2b03b052d84560abf9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 59e08d21058661d9972da4840a82e2bc80d02741)
2022-09-16 13:21:15 +02:00
Alexandru Croitor
af165e9704 CMake: Rework tool wrapper shell script creation
Instead of creating the tool wrapper shell script only
during a Qt build in QtBuild.cmake,
ensure it is created any time _qt_internal_wrap_tool_command is
called, regardless if we're building Qt or a user project.

As a transitional period not to break compatibility, we also need
to create the script in QtBuild.cmake, until all usages of
QT_TOOL_COMMAND_WRAPPER_PATH are replaced with function calls.
Currently such usages are present in qtdeclarative.

When considering which bin dirs to add to the script's PATH
environment variable assignment, in addition to the build
internals relative bin dir, also add QT_BUILD_DIR,
QT_ADDITIONAL_PACKAGES_PREFIX_PATH and QT6_INSTALL_PREFIX.

QT_BUILD_DIR is important so we always pick up the just-built
but not installed libraries in a prefix build when running just-built
tools.

QT_ADDITIONAL_PACKAGES_PREFIX_PATH is important when building examples
as ExternalProjects in prefix builds, to ensure that the
not-yet-installed tools and libraries are picked up from the repo
build dir, which is passed via QT_ADDITIONAL_PACKAGES_PREFIX_PATH
to the external projects.

QT6_INSTALL_PREFIX is there in case if the build internals relative
dir is located in a different places than the Qt6 package.

Task-number: QTBUG-90820
Task-number: QTBUG-96232
Change-Id: I4d76fbbc275ca961379971054f87991adac36539
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 74083599f8b175e94789757e478a106ec03750d4)
2022-09-16 13:21:13 +02:00
Alexandru Croitor
3b5ba9e942 CMake: Move __qt_internal_prefix_paths_to_roots
Move it into QtPublicCMakeHelpers.cmake so it is available also when
configuring qtbase and the Qt6Config.cmake file is not yet loaded.

Task-number: QTBUG-90820
Task-number: QTBUG-96232
Change-Id: I88127fe0439ae26af1d125eb584244d315574a48
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 828e402a1904c25dc5ea9fa915a5da8559e08560)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-16 13:21:11 +02:00
Alexandru Croitor
08e7d943ef CMake: Move __qt_internal_collect_additional_prefix_paths
Move it out of QtConfig.cmake.in into QtPublicCMakeHelpers.cmake
so that the Qt6Config file is less cluttered.

Change-Id: I772a0cca35d5c03cd688c3f1de34984484444105
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 59f0f25f7161313988b2c40f3c26b8ee12a88877)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-16 13:21:09 +02:00
Konrad Kujawa
e1db632ad9 Remove preprocessor conditionals for chrono include
__has_include(<chrono>) is always true, because C++11 chrono include
is required since 6.0.

Change-Id: I50cb92571bf4f1f86e2f3f2b5f486dd3c3f30f4a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ec2af0a9df0ac7bf9036f59a94ac3f3ef45c6740)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-16 11:12:41 +00:00
Jani Heikkinen
7505ff1321 Bump version to 6.4.1
Change-Id: Ic0925baf2b1d0060ffcb5dbd5c59b18a46674178
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2022-09-16 10:35:23 +03:00
Jan Arve Sæther
1e9164a92e Pass a parent pointer to the Animation instance to avoid memory leak
The leak is just on termination, but we should show good practices in
our examples

Change-Id: I39abb7545d3c68a1a537b865ba3fcb5e60c22fbf
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
(cherry picked from commit 30947c7fd4dddd76b69a3aa11567e27174d7a3ea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-15 15:58:04 +00:00
Friedemann Kleint
5a84483bbf uic: Add an option to modify the generated resource import
Historically, resource imports were generated as "import file_rc",
however, pyside6-project generates files by prepending "rc_". Add an
option to flip this.

Change-Id: Iee0f161cb2101c8080bd131a6401bbaf4682186d
Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
(cherry picked from commit 3696c99a9ab74113557578401d467d845171e543)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-15 15:58:03 +00:00
Liang Qi
1ce75ea7de tests: blacklist tst_QSocks5SocketEngine::passwordAuth() on all Ubuntu
Task-number: QTBUG-106020
Change-Id: I98de5b890d23ff6721e3e5f2644a3cf73a532e6c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 6329fed0a8721a530d9dc485ecc5611a22db59d9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-15 11:47:55 +00:00
Tor Arne Vestbø
b76dffec3c Don't rely on synthetic mouse events in updateFocusChainWhenChildDie test
Synthetic mouse events are not reliable, as the platform might restrict
synthetic mouse moves. In addition, the WM might automatically activate
the window when the other window is hidden, which makes the EXPECT_FAIL
flakey.

Since the test was not written to test window activation, let's just
explicitly activate the window.

Fixes: QTBUG-23699
Change-Id: I0ac1d3bc0658dfbd600a1f5d960839860be6dd2c
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 2e58e242b436d0d462748546d4451f6365de4743)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-09-15 08:40:23 +00:00
Doris Verria
caa82adf07 QCocoaColor(/Font)Dialog: Call makeKeyAndOrderFront asynchronously
We are calling makeKeyAndOrderFront on the NSColorPanel once when
show()-ing it and then we call runModalForWindow when calling exec(),
which also internally makes the panel key window.
The call to makeKeyAndOrderFront changes the window to key window
immediately so by the time the next event loop is run, the window is
already key. This causes problem when running the modal loop in
runModalForWindow as now the [NSApp _previousKeyWindow] already points
to the color dialog (NSColorPanel), so the application looses the
reference to any other window that was key before the color dialog,
thus, choosing the wrong window as key when the color dialog is closed.

So ideally we would avoid the first call to makeKeyAndOrderFront, but
since we don't know if exec() will be called on the dialog, or just
show() (which would need the call to makeKeyAndOrderFront in order
to set the dialog visible), we need to make the call to
makeKeyAndOrderFront in an asynchronous way, so by the time the
next event loop is run (the modal session loop in the case of
exec()), the app still has the correct reference to _previousKeyWindow
and can choose the right window after the color dialog is closed.

Fixes: QTBUG-42661
Change-Id: I1b5c429c90847c48d7aa1d61b2462122c5b587f8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 6430d1db636962ed25dd1c14a2d7ae548bafb948)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-14 19:01:20 +00:00
Mårten Nordheim
4f26cd2f9e Http: Don't clear (de)compressed data on error
Some errors, such as 404, may still present useful data. As opposed to
errors such as 'RemoteDisconnected'. So, just keep the data around until
the reply is deleted.

Fixes: QTBUG-106573
Change-Id: I6c86b5a55a45f837ea9b42559d88cd3e0ac2fa5c
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit b31d90291314c0664ef5aae72225c213fc560b06)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-14 17:53:59 +00:00
Lorn Potter
b2c678292e wasm: fix native keyboard popup on iOS
misspelling of element property causing issue

Fixes: QTBUG-106397
Change-Id: I8e8f6114bba6374381df4a1d9831ff36e3964658
Reviewed-by: David Skoland <david.skoland@qt.io>
(cherry picked from commit 88fbbb422e277a5dd56ae9d0f2d961362be2145e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-14 04:50:40 +00:00
David Skoland
bf00ecb41b wasm: Replace QT6_INSTALL_PREFIX with WASM_BUILD_DIR in cmake helper
The change b515fa56a3144289023dc9588c5f73283599e4d4
introduced checking the emsdk version of a qt installation.
However, this checked for QT6_INSTALL_PREFIX where it may not be
defined. This fails when trying to build tests because
when configuring tests, it calls into add_target_helpers which
calls into this logic, and QT6_INSTALL_PREFIX is set after
this is called into, causing the qconfig.h lookup to fail.
To fix this so it works in all conditions,
we need to check if either install prefix or
build_dir is set and use whichever is set.

Change-Id: I3cf7e20d3d830f04e5b632fc51d8bf3b2758a717
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 3bd54f285dd41f4c176ed54161b58ab5c85e14c3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-13 16:13:12 +00:00
Mikolaj Boc
f213f58889 Make popup menus non-resizable on WASM
Windows that are of popup type only should not be resizable. Those that
are dialogs as well, should, provided their minimum size does not match
their non-empty maximum size.

Fixes: QTBUG-106560
Change-Id: I76851e19949110323f949a1d17260fbd4fc35159
Reviewed-by: David Skoland <david.skoland@qt.io>
(cherry picked from commit 9ec7cbc77462938969e9569deeb5a106d321ce21)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-13 16:13:10 +00:00
Mårten Nordheim
c2be8b3516 tst_QNetworkreply: fix a path to test-data
For some reason it fails on Ubuntu 22.04, but it's anyway
not following the trend the rest of the file uses, so just
assume it's the code at fault and fix it.

Thanks to Liang Qi for debugging this!

Fixes: QTBUG-106016
Change-Id: I9d0563a081827eaa037d61643f0ea46301e11493
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 9e12ea37ea1a62fe5f5ed6860a48928664e19713)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-13 16:00:53 +00:00
Konrad Kujawa
bcbce8c8d6 Move QTimerPrivate to separate header
Change-Id: Icf3f8701f3cced822f2241cb2c0d27cd8739efe1
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 84c085273f21fc6365a7fbe99d98d726a161d000)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-13 11:11:40 +00:00
Marc Mutz
dbffd02feb qUncompress: make a narrowing conversion explicit
... and add an assertion. The assertion can only trigger if our
definition of MaxDecompressedSize is wrong.

Task-number: QTBUG-104972
Change-Id: Ifa375f59fb6ff5e0324d2208f4c2882174f9a44d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 454f4679ef838f866faf26e8f20c960ae5191795)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-12 21:28:03 +00:00
Mårten Nordheim
98ef806830 QNetworkReply: Fix missing final emission of readyRead
If we receive compressed data we will decompress it as it comes in,
in some cases the final byte we receive doesn't actually contribute
to the final output. If this byte is handled by itself then, when
combined with QNetworkReply's signal compression, we ended up not
emitting the readyRead signal for any of the data we received while
compressing the signals.

So, instead of relying on checking difference in bytes downloaded
for each batch of data received we keep track of how much data
we had received the last time we emitted readyRead.

Fixes: QTBUG-106354
Change-Id: I4777be29b46bf0de968667e9de9d975c735ac6e6
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 5387b88aa96d2096a3423190d1f1e5bdd2c52052)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-12 17:24:50 +00:00
Heikki Halmet
6a83c2eef8 Coin: Add core count config
Reflects what has been configured in the Coin. Allows removing
the rules from Coin and brings them visible.

Change-Id: I8b3567bca3ac040725253764775249a0b0dee8eb
Reviewed-by: Simo Fält <simo.falt@qt.io>
(cherry picked from commit 0e7d06009e2c75664317cff987735d266805ca38)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-12 17:24:50 +00:00
Marc Mutz
9bcb73af22 Specialize qMulOverflow<2>(n) as qAddOverflow(n, n)
Addition is always more efficient than multiplication.

Task-number: QTBUG-104972
Change-Id: Ib945e7df88562a2f4aea00aa319ff837191b8df2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 4b5b87c27b803c5bf0fed96c381c5e343b28d419)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-12 17:24:50 +00:00
Michal Klocek
40e844918a Do not make extra copy of public headers for external headers module
Cmake install(TARGET) copies public and private headers even
if DESTINATION is unset, therefore add workaround and remove
public headers before the install call.

Note the reason we do not need this copy is that we install those
headers with install(DIRECTORY) to keep the directory structure as it
is required for example by freefont.

Fixes: QTBUG-104856
Pick-to: dev 6.4.0 6.3 6.2
Change-Id: I494935d01163cee4f2f19b95aec97f5fd7a12f84
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-12 11:21:32 +02:00
Mårten Nordheim
03c7222add Make tst_qnetworkreply depend on the 'echo' helper
Because it's convenient to have it build automatically.

Change-Id: Iecd5bd1f9fe518f683b8ee9eb6529e48ce76fb33
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit c288733541b7842f0aa91dba378a00e6c158fa6e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-11 23:20:29 +00:00
Marc Mutz
1da9244629 qUncompress: mark invalidCompressedData() Q_DECL_COLD_FUNCTION
... and in turn remove the manual Q_UNLIKELY() leading to its callers.

Paths to Q_DECL_COLD_FUNCTIONs are implicitly [[unlikely]].

This is in preparation of changes where the extra Q_UNLIKELY markup
gets in the way.

Task-number: QTBUG-104972
Change-Id: I2cba5103854bf356ed841e1957a5ef143f8d3823
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 936d33849c31c020edfa9fdf04aec29d14cb133f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-11 15:03:39 +00:00
Ilya Fedin
e6208eea19 FileChooser portal: set current_file only when file already exists
According to xdg-desktop-portal documentation, current_file should be set
only when such a file already exists and xdg-desktop-portal-gnome enforces
this by being totally broken when current_file is set to a non-existent path

Change-Id: Ie3c80a7c6fd0cf23eea88ddec2149f5904c63394
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7927b05b2fed0d6004435fcb48954f609de288ca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-10 22:01:41 +00:00
Shawn Rutledge
92e38ed3d4 Avoid crash in QTextMarkdownWriter::writeBlock()
The inner loop would go out of bounds whenever it tried to find the end
of a run of spaces in a fragment that contained only spaces.

Fixes: QTBUG-104999
Change-Id: I5dda03b31194fff12f6052c458a0eb85d0be5c2b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9807c4e5afc953444a4b5a161ceb31c68fdf2484)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-10 19:30:59 +00:00
Mikolaj Boc
e9d0bab1de Propagate the copy event correctly to Qt widgets on WASM
The event should be propagated when the native clipboard is available.
A recent regression caused it to be suppressed, which resulted in lack
of copy/paste capabilities.

Change-Id: I030a31aa0951c3813ce1d38da9a6526010b3bfc8
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit adebdd0f9af0ffe47250b4a273407b84a6c61879)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-09 17:06:50 +00:00
Joerg Bornemann
2d09aba547 CMake: Un-TP QT_HOST_PATH
Take QT_HOST_PATH out of technical preview.  It has proven worthy of
being documented as proper CMake variable.

Fixes: QTBUG-106463
Change-Id: Ie1dd83eff526d5b803ea275dd3c6ecc3a7aa0e17
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 124522a0a575f52172de841068d8e949703edb37)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-09 16:04:24 +00:00
Alexey Edelev
b220b219f3 Pass QT_NO_PACKAGE_VERSION_CHECK to the Android multi-ABI external projects
The QT_NO_PACKAGE_VERSION_CHECK flag should be considered by multi-ABI
external projects when it's set in the main project.

Fixes: QTBUG-106394
Change-Id: Ief4ca1272f08f074d6c93d923efabdc13acd3add
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit da635dfced9961cf9f16b273f625acd2d9b0c3ab)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-09 13:23:24 +00:00
Mårten Nordheim
897071229c QSslServer: Document undocumented signal
Change-Id: Ife21d43d682e9463d41a1dd8c377003fca6f120f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit fe486d0fb42828151374d4ed0ca8db622a73745f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-08 22:41:37 +00:00
Mårten Nordheim
42e6322751 JUnit: Don't turn seconds into kilo-seconds
Overlooked in the review where this changed, this value was already in
seconds and needs to be converted to millis before converting back.

Now printing output such as:

<testcase name="initTestCase" classname="tst_QHash" time="0.001"/>

Amends bb74e72aa92b599cb4c80c23161ce9b66639ec01

Fixes: QTBUG-106222
Change-Id: I1f8b774eea3dcbe2b4e822e2b0b2efb1ccc01abb
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
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 95e315a66e4cc6bcafc442b6e5d5377b82ba8295)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-08 22:41:37 +00:00
Lorn Potter
a57cc71ee1 wasm: partial revert of 06b95cf55e33ca153a149a1685f6b7a16c4a02fa
Remove the batch test code as it is not in 6.4 branch

and fix

Change-Id: Ie0a26f1728d1686a8ccfb45e828d279711833324
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-09-09 05:52:29 +10:00
Timur Pocheptsov
1a65c64b59 tst_QSslSocket::serverCipherPreferencies - fix for OpenSSL v3
Test was not really good to start with - it was assuming the presence of
particular ciphersuites. Furthermore, it was ignoring the fact that
TLS 1.2 and TLS 1.3 set ciphersuites differently in OpenSSL.

Task-number: QTBUG-106018
Task-number: QTBUG-95123
Change-Id: I6c8ba20154cdeb9275878462ab945729d6c82ecc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 17e8f322ebca42275d23b7a54b9f4161fc851c2b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-08 19:52:29 +00:00
Liang Qi
f47de579f6 xcb: fix the build of native painting
Fixes: QTBUG-106374
Change-Id: I91871078a0e09cdda8db4afd236a9746c72007f7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: JiDe Zhang <zhangjide@uniontech.com>
(cherry picked from commit 2585fa7c091715ba4766bf58a75ae8f632dbb37f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-08 17:01:10 +00:00
Friedemann Kleint
94a7744037 uic: Remove trailing blanks generated into Python icon code
The indentation is only required for C++.

Change-Id: Ie861b12ba262fd56995c11d883129bafd11eface
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
(cherry picked from commit d1175e20cf61fa37cff03c76d4714cc8fdbd7b8d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-07 17:18:05 +00:00
Friedemann Kleint
f79387a3cf uic: Add QPdfView
Generate the correct header and Python import for the class.

Change-Id: I3682b1659e73e0ccd35b617632a56a5c14715cde
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 2ac733832dc6ed2ce2f49b331bb852512f303c00)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-07 16:32:42 +00:00
Edward Welbourne
dd98e36201 Work round macOS's omission of en_DE from its own uiLanguages()
When the system locale is en_DE, macOS seems to think we should use
en_GB as the right translation. While that probably is a sensible
choice in the absence of an en_DE translation, we should definitely
use the en_DE translation if available, especially if en_GB isn't
available (which lead to a fall-back to de_DE, given later entries in
macOS's list). So prepend the system locale's own pcp47Name() if it
(isn't the C locale and) is missing from what we would otherwise have
used for uiLanguages(), after likely sub-tag perturbations.

Add a test simulating (some approximation to) what macOS was doing
that would have caught this case; and add a scope-guard reporter to
the test to report what shows up when lists don't match.

Fixes: QTBUG-104930
Change-Id: I116234708067e1717d9157aebc84da76e04a9f38
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 753bfdf6a1336cc296e5fc8175aedd000c2cc013)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-07 15:53:25 +00:00
Edward Welbourne
ddeb1c9a7f Document shell-friendly data tags as best practice
Also follow this best practice in testlib's own documentation and
examples.

Change-Id: I8b57dfa8f88835adae8fceeb122a16635708e338
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit f94f1653368bf8c499fa9a6eeba81736bb2a7710)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-07 15:53:25 +00:00
Mårten Nordheim
63788de25b tst_qlocale: only restore the fp control masks we change
Certain masks are not supported outside 32-bit x86, and will assert on
x64.

Fixes: QTBUG-106000
Change-Id: Ic9f58e5a19c1db3309edeb5ec529e7a78c929665
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 070446d5ebf2a82531160268fbae0bb7c6730ecd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-07 13:17:36 +00:00
Marc Mutz
7fbe08538a QFileSystemEngine/Unix: fix unneeded casts from errno values to int
In the same file, errno and EACCES are passed unadorned to
qt_error_string(), proving the int casts on the other calls aren't
necessary.

Remove them; ints are a code smell these days.

Task-number: QTBUG-103525
Change-Id: I7209a209141195090878944ae66da3c85bbe4135
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 8b514c9c588f5570526c9ce0376bffbf431843f8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-07 13:17:36 +00:00
Timur Pocheptsov
398d5d6038 QCocoaDrag: don't add pasteboard items with non-absolute URLs
AppKit rejects them and we end up with inconsistent number of pasteboard
items and drag images:

"NSURLs written to the pasteboard via NSPasteboardWriting must be absolute URLs."
"There are 1 items on the pasteboard, but 2 drag images."

Fixes: QTBUG-105711
Change-Id: I7b1bc99f6e0b2b304f92f69125fb6af4ab5e303f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit da951c9dbf091b15e76fa63055a299e29a9001ad)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-07 13:17:36 +00:00
Nicholas Bennett
a5e722d71f Docs: Improve documentation regarding adding SSL support
Added link to Adding Open SSL support to Android Applications

Users are having difficulty finding this information, so adding a link
to the networking module's SSL Classes page.

Clarified the section title for adding SSL when building Qt from source.

Change-Id: I88fbf696583d75c76d3b9778dbacd058eb00b50d
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit b25b8ba1a92acc92b981d10cccd40bb0c9ba6add)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-07 13:17:36 +00:00
Mårten Nordheim
b75504ab81 tst_QSsSocket: fix verifyClientCertificate with OpenSSL 3
OpenSSL 3 by default disables TLS < 1.2 in the conf files. We're not
going to work against that, so we bump the version of TLS used.
Keep the client-side TLS 1.0 Or Later just to keep testing that this
part works.

Task-number: QTBUG-95123
Task-number: QTBUG-106018
Change-Id: Ia6cb10495875de232d69a886832ae74c5f5ac15f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit b4a5f0c57cd9d14dc5a8e825aad6cc329dae1b23)
2022-09-07 13:17:35 +00:00
Marc Mutz
64b53da19a [docs] qCompress/qUncompress: document size limits
Zlib uses ulong in the interface, which, at least on Windows, is a
32-bit type, so qCompress cannot consume input and qUncompress cannot
produce output greater than ULONG_MAX, even on 64-bit platforms.

Document this limitation.

Task-number: QTBUG-104972
Change-Id: I56c926a67f8705ef773977a86e157e6eb26aa585
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6bdde5295708df78db45c120d123945447f00232)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-07 13:17:35 +00:00
Marc Mutz
cab293de79 qUncompress: statically assert that arithmetic overflow cannot occur
... because the limit we check against, doubled, is still within the
range of size_t.

Took me a while to prove this to myself, so document the finding in a
static assertion.

Change-Id: Ib2d1bb825c1693ccc4ffa1d8fc0bd455a170337f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c97bcaaa1aa95570bd4911294bc8a0cb557b168d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-07 13:17:35 +00:00
Rolf Eike Beer
9adc7c3a42 CMake: allow user specified boolean values to have any case
When running something like this:

    cmake -D FEATURE_xkbcommon=On qtbase

one would run into issues like:

    CMake Error at cmake/QtFeature.cmake:254 (message):
      Sanity check failed: FEATURE_xkbcommon has invalid value "On"!
    Call Stack (most recent call first):
      cmake/QtFeature.cmake:396 (qt_feature_check_and_save_user_provided_value)
      cmake/QtFeature.cmake:606 (qt_evaluate_feature)
      cmake/QtFeature.cmake:575 (qt_feature_module_end)
      src/CMakeLists.txt:12 (qt_feature_evaluate_features)

Change-Id: I33a921625b97aeb3c423cb7c1fb1bd3b05ce24a7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 60829b0b257e62056aa32a7e58863b2c30bbdc89)
2022-09-07 11:53:23 +02:00
Yuhang Zhao
6b3f71521b Doc: Add missing since 6.2 to QImage and QPixmap
The deviceIndependentSize() function of QImage and QPixmap was added
in Qt 6.2 but their docs are missing this information, so add them.

And it seems the QImage docs were copied from QPixmap, so it still
reference to pixmap, not image, fix it as a drive-by.

Change-Id: Ic3d0a2019b5e9b89bd8723d994d7ae54f2cb5257
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 0d20e6e4957b3842b659522f330b8a201ef8e505)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-07 05:32:59 +00:00
Mårten Nordheim
acaa3c6a33 QTextStream: Fix logical error in setEncoding
We only want to enable writing BOM if we have _not_ started
writing.

Fixes: QTBUG-106279
Change-Id: Ibcbc101b931615fddb2507f01307bf9619772d7b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c76f7cbbcbe68bf785e8d8cbbe641cd6c0e42834)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-06 23:09:42 +00:00
Thorbjørn Lund Martsum
42c7bb44f9 Refix QDockwidget drag out dockwidget
In f082458c4609dfa20fdfb8bfe3e625c311b145da a fix attempt was made
and in a lucky example on Mac it worked well. However, the logic was
still not correct and that could be seen in other systems/examples.
This patch updates the logic to be the correct behavior in
general.

Fixes: QTBUG-106064
Change-Id: I3b098be9942d37c367b146a7359185bcfd127762
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 06556d079afcf8c53c7dbbc0592988f52a23ff68)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-06 20:59:20 +00:00
Tang Haixiang
b3bb20b8bc QTextDocumentLayout: Account for topMargin when hit-testing
When TopMargin is set in TextBlock and the mouse click position is
between Margin (the mouse is not on the textrect), the cursor will
usually jump to the end. So topMargin should be considered when
hitTest() calculates coordinates.

Fixes: QTBUG-91774
Change-Id: I231377263855b9cd7152684203fc4ed2e9299bb9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tang Haixiang <tanghaixiang@uniontech.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 8aae49019d7386c1abd6cd32f7ccb68c264c0288)
2022-09-06 18:26:59 +00:00
Alexandru Croitor
16dcd2abe6 CMake: Tidy up documentation regarding android library collection
Change-Id: I3167855ef3a390a51d7bb0c703f47392b07cb2ac
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit fb284a3c47c77cbb9669ac8b2558c39bc0db5b83)
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-06 18:04:33 +02:00
Shawn Rutledge
88752a1377 Use QVarLengthFlatMap for QPointingDevicePrivate::activePoints
It's good to use a pre-allocated set of points that never changes,
because queryPointById() returns a pointer to the stored instance.
If the flatmap's values are in a QList, and a mouse event comes in at
the wrong time while touchpoints are already stored there, causing
the QList to be resized, the returned pointer can become garbage.
The pointer returned from queryPointById() is never retained for long,
but in practice it turned out this could still happen, at least on X11
(perhaps because of X11 synthesizing mouse events from touch).

Using a pre-allocated QVarLengthFlatMap is also an optimization: events
on single-user systems are unlikely to ever cause memory allocation in
this part of the code.

Many touchscreens support up to 10 touchpoints, but the user might
have some other input devices, plus the "core pointer" (mouse).
The user could also have two touchscreens and try to use them
simultaneously.

d4611ba3a5b46ee790e6c790ef6c3d771d3507ee added QVarLengthFlatMap along
with a test using int keys; so we expect that will keep working now.
There was some issue in 2020 which is why I didn't use QVarLengthArray
for the QFlatMap key and value containers to begin with.

Pick-to: 6.2 6.3 6.4 6.4.0
Fixes: QTBUG-106223
Change-Id: I588f66f07126b9551937a369df44f045759b473d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 83e70c315742c5de964a1fc5f973ad087f5894e2)
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-09-06 13:03:46 +00:00
Thiago Macieira
95692dd1be 3rdparty: apply a fix to the last zlib fix
Source:
1eb7682f84

Change-Id: Ic6547f8247454b47baa8fffd17111732eb074b0a
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit d6fae59faa49cedf44960f54b43cb80c6a751a15)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-06 12:34:55 +00:00
Mikolaj Boc
e57b49f346 Clear the timer target time when stopping a timer on WASM
Not clearing the target time makes the subsequently created timers not
get their time ticks, as no actual timeout will be registered as the
dispatcher wrongly assumes there will be a tick fired, which there isn't.
Since there are no updates, the WASM compositor enters an infinite
window update loop where it requests an update on a window, and the
window requests an update on it, getting the update request back due to
an animation running forever.

Fixes: QTBUG-105347
Fixes: QTBUG-102004
Fixes: QTBUG-104518
Fixes: QTBUG-106153
Change-Id: I14b8dd08df81852e28e8527545c8530e0656990d
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit df4be707407685d9afdeacaca172c01dd74c07a8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-06 12:07:58 +00:00
Eirik Aavitsland
75a9a0ad5e Update bundled libjpeg-turbo to version 2.1.4
[ChangeLog][Third-Party Code] libjpeg-turbo was updated to version 2.1.4

Change-Id: Iaffb12606ec53c3ee217b51ad20663aa4409eafa
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit e6d3657f7f90a6a184b391d74a9542ef0acf072c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-06 12:07:58 +00:00
Lorn Potter
06b95cf55e wasm: handle cmake's RUNTIME_OUTPUT_DIRECTORY
Also OUTPUT_NAME

Fixes: QTBUG-105923
Change-Id: Iaef92b068845d69fad4f73abb7e15dcba3107265
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-09-06 17:26:55 +10:00
Eskil Abrahamsen Blomfeldt
d7620f1b74 Fix crash when setting override cursor on multiple clients
When a client disconnects, we need to disable its client cursor,
otherwise there will be a dangling pointer stored in the
pointer.

In addition, we should reinstate the default cursor only when
all clients have disconnected.

Note: Patch provided in bug report.

[ChangeLog][vnc] Fixed a crash when setting an override
cursor on multiple clients.

Fixes: QTBUG-105057
Change-Id: I0399087a924c05c8d0811b0ec0305b7857da5d3c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9b6e79abbe66cc098ff8587c2f494716d920c4ea)
2022-09-06 07:10:39 +00:00
Michael Brüning
4d10022a8d Reland macdeployqt: Don't copy .prl files into the Resources folder
QRegularExpression::isValid returns true on default constructed objects,
so the filter was always matching even though it was not meant to be
applied at all.

Fix this by checking that there is a non-empty pattern string set and
applying the filter only then.

Fixes: QTBUG-87764
Change-Id: If37f8abaecacba3dc6f0b14da681a6e025367c10
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit aed7b5f3701ff51d088bc80c60b6bd4675a01077)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-05 11:20:00 +00:00
Michael Brüning
3602a95a8c Correct typo in destination path variable names
A couple of variables contained "Destianation" instead of "Destination"

Change-Id: I98a15652347d1b0dad640bc49925ec296830147b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 60b069471dda1ae3cacca8cf8cfdd8a140e63563)
2022-09-05 11:19:48 +00:00
Timur Pocheptsov
85d28ea391 tst_QSslSocket::oldErrorsOnSocketReuse - make it work with OpenSSL v3
The initial problem was in server not starting encryption, because
its certificate was rejected by OpenSSL (v3) saying 'weak md'.
After the certificate was replaced, we got another problem - due
to the fixed TLS v.1 protocol for both client and server - handshake
is interrupted early with 'tls v1 alert' and error message
saying about not found signature algorithms. Don't fix the protocol
version, use proper QSsl::SecureProtocols (default).

Task-number: QTBUG-106018
Task-number: QTBUG-95123
Change-Id: I0f22f5304f4405933ad511195bc61c640518e7d8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit a7657d3c5ff1aafe347209dc6b76bd6d127694d9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-05 10:49:18 +00:00
Volker Hilsheimer
6806192e87 Fix warning from testing assignment
Tests that do

QTRY_VERIFY(a = b);

generate a compiler warning:

using the result of an assignment as a condition without parentheses
[-Wparentheses]: place parentheses around the assignment to silence
this warning

Do that centrally in the QTRY_TIMEOUT_DEBUG_IMPL macro definition.

Change-Id: I4a4b0161c4e16c0e1e27a68f33a41efdaa2c962c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b05a2768c2fb166bdca8f05a6833409fe5a40ee6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-04 07:17:30 +00:00
Christian Heimlich
5b2924b4b0 Update zconf.h prefixes to match zlib v1.2.12 update
Historically Qt has used `Z_PREFIX` within zconf.h of its bundled zlib
copy to prefix all zlib symbols with `z_` in order to prevent clashes
with a potential system install of the library when linking statically;
however, v1.2.12 introduced 3 new functions that were erroneously not
accounted for in the upstream repository:

- crc32_combine_gen
- crc32_combine_gen64
- crc32_combine_op

`403020` updated our bundled zlib to this new version and therefore
Qt has inherited this oversight, now clashing with external zlib
builds.

Manually add prefix macro definitions for these three symbols to
restore built-in zlib to its previous clash free state while waiting
for the issue to be addressed upstream.

Change-Id: I83f88109a08cf7e7117f1c94b4557a2c36f519c3
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit 54ea62756a7b0d47370551b0ec07f602cb341228)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-03 21:14:07 +00:00
Mårten Nordheim
bf958e22ce tst_QSslSocket: regenerate certificate used for setLocalCertificateChain
The certificate was using SHA-1 for signing its certificate, which is
considered 'not good enough' by some TLS libraries.
Regenerate it with SHA-512 and a larger RSA key.

Also include the files needed to generate it.

Task-number: QTBUG-106018
Task-number: QTBUG-95123
Change-Id: I535e047d540e663c8cec334695196044173949fc
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 28693abb6490734aac9018dd7d96d429ddba9b7e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-03 09:33:41 +00:00
Eirik Aavitsland
8edb27d7df Windows: avoid losing transparency when pasting images into Qt apps
Before Qt6, we would only request a DIBV5 format image from the
clipboard if that format was available without synthesizing. Then, in
commit 8fa91c75ad that check was believed to be needless, and
removed. However, it turns out that it is needed to avoid loosing
transparency information, so we revert that part and bring back the
check against synthesized DIBV5.

The logic is that some widely used apps will provide images in both
PNG and DIB on the clipboard, and only the former can have an alpha
channel. When we request a synthesized DIBV5 rather than a PNG, it
seems we only get the (opaque) DIB image repackaged as a DIBV5.

On Windows 11, there even seems to be an issue (possibly a Windows
bug) where, after asking for a synthesized DIBV5, the clipboard
contents is somehow changed in a way so that pasting again into other
(non-Qt) apps later will yield a corrupted (pixel-shifted) image. (It
looks like they get a DIBV5 when they expect a DIB). So avoiding
requests for synthesized DIBV5 also avoids triggering that issue.

Also add some logging outout to help future debugging.

Fixes: QTBUG-104872
Fixes: QTBUG-105338
Change-Id: I33ffa2b50870b887a083e9bbb1b2234604e4d8ab
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
(cherry picked from commit 8cb78647e3d210e73a6dd4f0ca744b2887c482b7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-02 19:22:44 +00:00
Topi Reinio
134abb7eef Doc: 3rd party: Fix reference to FreeType LICENSE.txt
Change-Id: Id5c92938948c636765590e1bee2dd9c2baeb826b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit cf3461bab3507e834dbcaaefe59961102583675e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-02 19:22:42 +00:00
Timur Pocheptsov
11ac2ccaef tst_QSslSocket::protocolServerSide - make it work with OpenSSL v3
OpenSSL v3 by default sets SECLEVEL = 2 unless overridden in conf files.
SECLEVEL >= 1 means TLS <= 1.1 is disabled. Remove cases that were
previously expected to work. Arguably, we should not test deprecated
protocols at all, but the cases expecting a failure still work
and logically correct.

Task-number: QTBUG-95123
Task-number: QTBUG-106018
Change-Id: Ifa59fa902b433338dbed7abf086cfdef9470384c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit d2544b3bb274bb31e89d42b71d4ca64c4e46c126)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-02 19:02:37 +00:00
Shawn Rutledge
70ae87a51c Use testlib for multiPointRawEventTranslationOnTouchScreen events
It was an old test written in a very low-level way, which perhaps is ok
to be independent of testlib in a few tests; OTOH, it was blacklisted
on a couple of platforms. Perhaps doing touch events the standard way
could be more stable.

While we're at it:
- verify that the touch events are accepted, and thus verify the new
  bool return value from commit()
- implement paintEvent() to help understand the layout, and touchpoint
  locations
- remove repeated QCOMPARE lines
- skip the test if window positioning fails
- try to un-blacklist it, on the assumption that window positioning
  failure was the reason

Task-number: QTBUG-87025
Task-number: QTBUG-104656
Change-Id: Ie22eb24abf95cd849990a56212be87d06ce8e574
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Doris Verria <doris.verria@qt.io>
(cherry picked from commit ef9b51ce99fb05a37888f6e2cec733df7ca53144)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-02 17:07:31 +00:00
André de la Rocha
bff012b53f Windows QPA: send UIA focus notification after window activation
After a Qt application window was opened, and focus was moved to
another window, and then back to the Qt application window, NVDA
would only announce the window name, but not the widget focused
within the window. This patch makes Qt send a notification focus
for the focused widget after a window activation notification.

Fixes: QTBUG-105735
Change-Id: I3426b3613ae546de0ce363f9acc5d6776c99a8aa
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 3e95884081727b84df265e2fa3456f2393e61f7b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-02 16:31:45 +00:00
Alexandru Croitor
c7ce952d6f CMake: Add reference documentation for QT_IOS_LAUNCH_SCREEN
Amends 578f4ba00c9fce9af922c9924ca104bc47e50f03

Task-number: QTBUG-104519
Change-Id: I02ea0694ead0e5b8c7a70a09cc14b51d8e374dd5
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 3eb2918f2ec95d1efd198106e78a109b1accfd86)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-02 16:30:54 +00:00
Jens Trillmann
37d673313d Android A11Y: Check for active surface before calling into native code
This fixes a deadlock. The deadlock occurs on an application state
change. During this state change the QML plugin requests Android to
create a new surface for drawing and waits on the Android thread to
complete the request (QAndroidPlatformOpenGLWindow::eglSurface()).

In the meantime the android a11y delegate gets requests from the
android a11y interface. The delegate tries to access the a11y
information through the native interface, where it has to wait for the
main loop thread to get the a11y information from the QtQuick objects.

This leads to a deadlock in which the main loop thread waits on the
quick rendering thread, the rendering thread waits on the android thread
and the android thread waits on the main loop thread.

This workaround avoids this issue by not calling into native code until
a rendering surface has been created.

Task-number: QTBUG-105958
Change-Id: Ib99145aa689d1d62e25d25e1f4f8598d53eee3a9
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit b8a95275440b8a143ee648466fd8b5401ee1e839)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-02 16:30:54 +00:00
Eirik Aavitsland
d076c31bfa QVariant: fix conversions of Q_ENUM that are QFlags<> to string
The doc of QMetaEnum::valueToKey() says to use ::valueToKeys() instead
for flag types.

Change-Id: I48e5ba47324137f2ce2710f1d876e93e7c562e9f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 54aa7e75b89d5d27e59594ce35206089ccc22d3b)
2022-09-02 13:13:34 +00:00
Øystein Heskestad
192df6ef47 Add CBOR documentation
Add documentation of usage of CBOR in convert and cbordump examples,
add a CBOR overview, and add links to them other places in the
documentation.

Task-number: QTBUG-85912
Change-Id: I518792db63647bf9ddd4507d8d4b7ef056192f82
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 855a9ca217ad3b9d8eb8f6544698a174323843fc)
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2022-09-02 08:38:11 +00:00
Thiago Macieira
255234136c QGtk3Dialog: remove the #include for empty moc
This amends 64e6233252117415d6765b6f7a8f4df39490b678.

Automoc complains:

AutoMoc warning
---------------
"SRC:/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp"
includes the moc file "qgtk3dialoghelpers.moc", but does not contain a Q_OBJECT, Q_GADGET, Q_GADGET_EXPORT, Q_NAMESPACE, Q_NAMESPACE_EXPORT or Q_ENUM_NS macro.

AutoMoc: /home/tjmaciei/src/qt/qt6/qtbase/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp:0:1: note: No relevant classes found. No output generated.

Change-Id: Ic6547f8247454b47baa8fffd170ea8a8ce0ed06c
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Ilya Fedin <fedin-ilja2010@ya.ru>
(cherry picked from commit 43aaffb0185e018b666359609b5ff82686226e05)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-01 23:41:35 +00:00
Ilya Fedin
6f482054d7 xcb: set _NET_STARTUP_ID at client leader window
This should help to overcome WM's focus prevention mechanism

Fixes: QTBUG-96276
Change-Id: Ic5fb46f7ce54f0df29850725bafa364b74e30d25
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit ba8c4b4ac6df8c4318e3dd8c886aa0135628d33c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-01 23:41:32 +00:00
Liang Qi
22dc3ee801 xcb: fix D&D in same xembed client
This is kind of porting missing parts QX11Data::xdndHandleDrop()
in src/gui/kernel/qdnd_x11.cpp in Qt 4.

Change-Id: I3a9d657c63dbca43e33262f49484861e60f59b58
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 7bc63f345f9ab296979a75c6f4547ef038fd8b37)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-01 22:42:37 +00:00
Liang Qi
8ba68e36b8 xcb: use global coordinates for position of D&D for xembed client
Change-Id: I4805b764b11b86e2b0975ca45f7182f2719fda74
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 64cd43d394aa389ee28db5abad6a394d3ad44aea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-01 22:42:37 +00:00
Thiago Macieira
2932130a8e QVariant: fix conversions of string keys to Q_ENUM that are QFlags<>
Since Qt 6.0, QMetaType stores the name obtained from the C++ compiler,
which means we know a type like Qt::Alignment by its proper, full name
of QFlags<Qt::AlignmentFlag>. However, the meta object records only the
bare name of the enumeration, not the full flags.

Fixes: QTBUG-105932
Fixes: QTBUG-96185
Change-Id: Ic6547f8247454b47baa8fffd170eab977e306377
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 98e21f0979143a1e278572390012f021dfed1b6a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-01 19:51:39 +00:00
Mike Trahearn
abaf1aa134 Doc: Update QMetaType::metaObject() descriptions
Change-Id: Iff93f8fe2cf701d56d072e2593c76d49a70fc183
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit e27ecb203538208157e3e0e710ae54ab8bd2a844)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-01 18:45:26 +00:00
Timur Pocheptsov
cb61bea591 tst_QSslKey - make OpenSSL v3 detection fully runtime
Otherwise, checks are useles in non-developer build.

Fixes: QTBUG-106036
Change-Id: I41b6d8f250021ff9fa4981f9df9244c269ed2999
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 8e21844683d46e777db3db74df0bcf76cb9a35c0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-01 18:10:12 +00:00
Edward Welbourne
88d06dd980 Fix two trivial defects in testlib docs
A fragment of inline code wasn't wrapped in \c{}.
Doing so made the quotes it was wrapped in redundant.

Documentation of of QSKIP's parameter claimed it does something it
should, but it's up to the client code using it to write a description
that lives up to that.

Change-Id: Ib355b9b85c9986f244ae01479134245f182c912c
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 6dd6bf3467040b3efceafa317de6e833ee5ec15e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-01 17:44:40 +00:00
Edward Welbourne
863e308e6b Provide CMake guidance for skipping whole tests
The testlib docs on how to skip whole tests was qmake-specific, so add
the missing details for CMake.

Change-Id: I247d08262302dcedb98ffbf301932d6dd84d7ff7
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
(cherry picked from commit 8814fb5f4faff2d8442e481feb1bb35c2250e930)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-01 17:44:33 +00:00
Jonas Kvinge
9516fe526e macdeployqt: Fix deploying libraries with reexport
Fixes deploying libgcc, currently it fails to change the rpaths with the
following error:

ERROR: Could not parse otool output line:
"\t/usr/local/opt/gcc/lib/gcc/11/libgcc_s.1.1.dylib
(compatibility version 1.0.0, current version 1.1.0, reexport)"

Change-Id: I5c866a375f88e3b222cbdbebc167b04174f753b2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 2e8c84cda25de38d64669a9d078d87c7d2bf451c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-01 17:03:09 +00:00
Marc Mutz
6cdc2fc0f4 QLocale: port to qsizetype [2/N]: remainder (qlocale_win.cpp partial)
Port ints to qsizetypes where they're not blatantly wrong. This
includes indexed loops that don't require the additional range,
because int these days is a code smell, so if we can save the next
code reader a few moments of digging to convince herself that the int
is ok even in 64-bit builds, then let's do it.

The Windows implementation only has the most obvious occurrences
ported, because I lack platform access. Created QTBUG-105100 to track
the missing changes. OSX should be fine, provided sizeof(long) == 8 on
64-bit OSX.

Task-number: QTBUG-103531
Change-Id: I679183f28ed42e89e2879e29457e6a4e487fed0d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 24e8a693cdf418a90559472addfd49637ff4e270)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-01 15:32:16 +00:00
Marc Mutz
e8e91ef35c [docs] Fix ints that should be qsizetype [src/corelib/text]
For the constructors, replace int with qsizetype. For the incorrect
return type in \fn of length(), drop the return type, the presence of
which violated DRY, stressing the importance of that SOLID principle.

Fixes: QTBUG-103531
Change-Id: Ic7a8e1953333c28a2722fd7f753a0b5af6777395
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 334c27dad139956135b8687bf695e3cfa0228b9c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-01 15:32:16 +00:00
Liang Qi
53997b5196 widgets: avoid setting X11BypassWindowManagerHint in QToolBar
when restoring state

With X11BypassWindowManagerHint, the floating tool bar was created
without control from window manager, which causes it stays on top
at all virtual desktops.

Fixes: QTBUG-105591
Change-Id: I1868f4e75e1b84f9e81c05d2e927a183a0c635ee
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 c3c4d4dda942cab92a8fdcd47a5973f5ecf59d40)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-01 10:06:20 +00:00
Heikki Halmet
c51eb3dfc3 Blacklist: tst_QGraphicsAnchorLayout::layoutDirection for Ubuntu 22.04
Task-number: QTBUG-87728
Change-Id: Ic78a17146c265ffe6baf6f08a0f9c29750bd0d58
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 191419e98040d7aa7c306d3ec2776d5c143d8c2d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-01 10:06:20 +00:00
Jens Trillmann
3bf1786d02 Android A11Y: Notify android about scroll events
QtQuick Flickable has an issue that after a scroll the previously
hidden items are not added to the A11Y hierarchy. That happens because
Android has no ways to detect that something has changed.

This patch uses the ScrollingEnd event to notify Android A11Y backend
that the Flickable was scrolled, so that it could update the A11Y
hierarchy and add the previously hidden nodes.

The ScrollingEnd event generation is added to QQuickFlickable in a
separate commit.

Task-number: QTBUG-103513
Change-Id: Ie6cd688d56343bcfe7ce9580c0b9244dd6d6c068
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Samuel Mira <samuel.mira@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 3c709198838866d5122c69a30cacdc806605d0cf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-01 06:07:34 +00:00
Mitch Curtis
04147c4585 Doc: fix example repo URL
qtquickcontrols2 was merged into qtdeclarative in Qt 6.2.

Fixes: QTBUG-105004
Change-Id: Icbec8a74f1269b270be42b6a93930fb28d64af37
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit 2d7b67d4917f7a489ac1b9b11fb129943a844fa9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-01 04:24:05 +00:00
Lorn Potter
78a0203ffa wasm: add Emscripten version check for apps
This will tell developers if they are using the wrong version which may
not build or might cause other issues.

Fixes: QTBUG-105922
Change-Id: Ic5c4549d5637182dce380e415f131e33a4da416f
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit b515fa56a3144289023dc9588c5f73283599e4d4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-01 03:48:16 +00:00
Alexandru Croitor
233b95f70a CMake: Move Apple specific functions into a separate file
Task-number: QTBUG-95838
Change-Id: Ib0ce53fe0e2068482b654921ecba3232efe656c8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 51f8eaa3283daf78f32caa2f9db08860c3f7be9d)
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-08-31 23:33:01 +02:00
André de la Rocha
3bdd3b8aa5 Fix tree/table/list accessibility state
The accessibility class associated with trees, tables and lists was
reporting a default/empty state, causing issues with accessibility
tools.

Fixes: QTBUG-92964
Change-Id: I9c8ee5e7e582fd6b6a59cd70437eeddad0f4eb8e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 0d3f09ac0231fca114aa58553144b78f8040a2e1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-31 21:33:01 +00:00
Kai Köhne
d3375534ac Restore signature of qt_handleTouchEvent()
The function return value changed in commit e1f25b1c8. Anyhow, this
breaks the AUT probe of Squish on Windows, as long as it is built
against an older Qt version.

Squish can of course be adjusted eventually, but let's allow some
grace period.

Fixes: SQUISH-15324
Change-Id: I289ed43bffcf292aa2eae3962a4661ed5c29100e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 4a29ee770f76e72fe71275d5f987fc9de9af12a0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-31 21:33:01 +00:00
Timur Pocheptsov
9010a4351f QSslCertificate::toText(): add a file to compare against
With OpenSSL 3.0.5 we see X509_print giving us the text representation
not matching any of previous ones - mostly a question of spaces
and formatting. Let's add a proper version to compare against and
remove useless 0.9.8, 1.0.0, 1.0.1, - we don't support them anymore
and thus QSslCertificate::toText() will never give a match.

Task-number: QTBUG-106017
Change-Id: Ida11321c23e74c7313acc682237ab78408cf2803
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 0f2397f03d6dc84ed1157e5a78c3298a1cdd7c85)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-31 21:33:01 +00:00
Timur Pocheptsov
277b44ab6d tst_QSslCertificate::pkcs12 - skip the test if OpenSSL version >= 3
leaf.p12 is using RC2 for encryption and it's disabled by default
in openssl v3.

Fixes: QTBUG-106017
Change-Id: I4edd0d29506d1e50b2b618b6a00cceeb4b156204
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 0206eb137fcf3239b8657a80a136f6dba77752da)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-31 21:33:01 +00:00
Thorbjørn Lund Martsum
7e804fb106 Fix dragging a docked QDockWidget [REG-fix]
In 54f328f0e8205480749a6d8d2ebe0e58cb1cdb67 issues with dragging
dock widgets between screens were solved. However, it only
worked well if the widget was floating. It worked wrong when
dragging out a docked widget. That is fixed by this patch.

Fixes: QTBUG-106064
Change-Id: I8d486d30a334719a2931828464ccaceb8ba2e019
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f082458c4609dfa20fdfb8bfe3e625c311b145da)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-31 21:33:01 +00:00
Thiago Macieira
347c9e2b58 RCC: fix zlib compression when --no-zstd was specified
Since we had code to default to zstd as the default algorithm instead of
"Best", we ended up not compressing anything.

[ChangeLog][rcc] Fixed a bug that caused rcc not to compress files with
any compression algorithm if the --no-zstd option was present.

Fixes: QTBUG-106012
Change-Id: Ic6547f8247454b47baa8fffd170fddae429f82d2
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit f12321288009119552df10df75c77228f6bac0db)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-31 21:33:00 +00:00
Niclas Rosenvik
e5a46dd1cf Fix possible undefined behavior in clear_thread_data
Fix possible undefined behavior in clear_thread_data.
The key used in pthread_setspecific must be obtained
from pthread_key_create or undefined behavior occurs.
Use set_thread_data to clear it since it ensures that
the key has been obtained using pthread_key_create
by calling pthread_once using
create_current_thread_data_key.
Fixes crash when closing threaded qt apps on NetBSD.

Change-Id: I1c7d2628f4248e00a12724a952568f7d92011986
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6d930533037f27b906bbd02b0764041d931efb5d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-31 21:33:00 +00:00
Axel Spoerl
6ea58fb499 Make QKdeTheme aware of runtime theme changes
When the KDE theme gets changed programatically or by the user in KDE
settings, Qt applications were not notified during run time.
The KDE theme was read during startup only, when the QApplication's
palette was constructed.

This patch implements a DBus connection to the SettingChanged signal.
QKdeTheme is notified about KDE theme changes, which trigger an
application palette reconstruction and all subsequent QEvents.
The implementation reacts to changes the in KDE settings "widgetStyle"
and "ColorTheme". The application palette is updated only if the
underlying settings change results in a palette modification.

Fixes: QTBUG-103093
Change-Id: If0ec0f0ba515ef3dcf9924283d3a818ac7d24a7b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 223fdc7d52665b2fab24c0624b969bfdab067a2f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-31 15:14:16 +00:00
Timur Pocheptsov
d0745dfe88 tst_QDtls::verifyClientCertficiate - update certs for OpenSSL v3
Because this version does not seem to like MD5 which old cert was using.

Fixes: QTBUG-106019
Change-Id: Id354d1e32acb0528685b2788ee9c7326c43397bd
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 267d923ed9329b465b3bb0d2e82c5d07bc83961c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-31 11:43:52 +00:00
Thiago Macieira
85abf956ca 3rdparty/zlib: backport the fix to CVE-2022-37434
Qt isn't known to be affected by this.

Change-Id: Ic6547f8247454b47baa8fffd171025f5a435a209
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ab3342c26f4b7926b1c210df4dd254962b170da1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-31 11:43:52 +00:00
Mikolaj Boc
1b69f7379b Request frame when a window has been moved
Whenever a window's geometry changes, the scene has to be redrawn.
This has not been the case if the size didn't change.

Change-Id: Ic85e1d75221134788ab2cf2e76bf2ba121f3335e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 11c19ac6e2892a552e5302fdf71aeb3e6a7812e9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-31 11:43:52 +00:00
Tobias C. Berner
bfb2fbc035 qthread.h: fix logic for Q_OS_FREEBSD and add support for 32bit FreeBSD
Fails to compile on i386 on FreeBSD with:

In file included from /wrkdirs/usr/ports/devel/qt6-base/work/qtbase-everywhere-src-6.3.1/src/corelib/thread/qmutex.cpp:49:
/wrkdirs/usr/ports/devel/qt6-base/work/qtbase-everywhere-src-6.3.1/src/corelib/thread/qthread.h:201:13: error: invalid operand for instruction
    __asm__("movq %%fs:%c1, %0" : "=r" (tid) : "i" (2 * sizeof(void*)) : );
            ^
<inline asm>:1:14: note: instantiated into assembly here
        movq %fs:8, %edi
                    ^~~~
1 error generated.

Change-Id: I0a71e4631d7b6d452083d3ca8e35759e5dc563d4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b1c57d13eecc208408b7ed05f888d7625fb6e251)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-31 11:43:52 +00:00
Alexandru Croitor
22d453e104 CMake: Remove NSHumanReadableCopyright from iOS Info.plist
The key only applies to macOS bundles. Also, qmake doesn't have it.

Task-number: QTBUG-95838
Change-Id: I438f0079cc7b74672dfbe956769138a8bb006669
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit c81da821c43a351578005737fcd21b5b903d728f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-31 08:53:50 +00:00
Alexandru Croitor
9bc03ed425 CMake: Fix storyboard entry in an iOS Info.plist file
It should not contain the .storyboard file extension, just
the base name.

Amends 578f4ba00c9fce9af922c9924ca104bc47e50f03

Task-number: QTBUG-101064
Change-Id: I70ce4581baec7cd62c2dae25c1ed963be28eddfe
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 5b43a673df8b83d23ed0b9f9f77cbd901c306d20)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-31 08:53:50 +00:00
Alexandru Croitor
3cbb6c1438 CMake: Clarify documentation for target and project finalization
Amends 944c424ff601fe546a0ac83e0d8b3f781beb68f6
Amends 63f79d7ffb22de89a2c6314caa5b5a1908590063

Change-Id: Ic8f3376f49b7aaeaa4bf307aa401c54d48cd5c4d
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit b0fef2849b97f9a315018efb49ab9d8974e2c19a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-31 08:53:50 +00:00
Alexandru Croitor
65a04c3625 CMake: Add documentation for QT_NO_COLLECT_BUILD_TREE_APK_DEPS
Amends 63f79d7ffb22de89a2c6314caa5b5a1908590063

Change-Id: I0d2fb6377653d88f4899b990d9c073df86047b61
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit fbcf910831ef7ba4897d7e818dc0c1c3e45e28a6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-31 08:53:50 +00:00
Mårten Nordheim
352cbfd3c8 QDateTime: work around bitfield bug on msvc x86
Somehow, when mixing types in a bitfield, MSVC will use a lot
more space than expected. So ShortData ended up being 16 bytes
causing various static_asserts to trigger.

Change-Id: Ia0032e71621772db27e2917d9c71598046730107
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit a901afcd79fe0ac7cf257f2ed45c72a7cfaf028a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-31 08:53:50 +00:00
Lorn Potter
a09b9aaba9 wasm: update emsdk to 3.1.14
This fixes some threading bugs

Change-Id: I1a96dcc54d8338de09b551d52a166d073e85d752
Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 83b75988964b70ec5d947bc38f9cc363232a2be8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-31 08:53:49 +00:00
Jens Trillmann
9584f999e3 Android A11Y: Fix TalkBack scrolling behavior
* Add CollectionInfo to scrollable nodes.
  Every scrollable node will get a CollectionInfo attached to signal
  the number of (possibly invisible) children.
  This is necessary as TalkBack on Android doesn't scroll to items not
  visible on screen if the number of further child nodes is not
  communicated to TalkBack.
* Return success of scroll to TalkBack.
  TalkBack needs the result of the scroll to decide if it should leave
  the current element or stay after a scroll was successful.
  Success of a scroll action is measured as the successful movement
  of the children of the scrolled element. This is a workaround for
  the Qt Accessibility API not returning the success of failure of a
  performed action.

Task-number: QTBUG-103499
Change-Id: Ie2c51d0b77fb5030973a0f93c42e0db3082be45e
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 56c4d183ec30c7f40ece09de1c483829eedc299b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-31 08:53:49 +00:00
Michael Weghorn
53783496f6 a11y: Don't reassign unique ID to other object right away
For the case that a newly created and registered accessible
interface gets removed again from the cache before another one
gets registered, the next registered interface was
previously assigned the same "unique ID" again, which e.g. breaks
assistive technology when using caching
with AT-SPI, since that relies on the assumption
that the ID is actually unique for each object.
(But here, the new object was using the same object path
as the old one, so data from the old object would be
used for the new one.)

To prevent that from happening, increment the
counter for the next ID to try at the end of
QAccessibleCache::acquireId, so the next time
the method gets called, it doesn't try again
whether the same ID as used previously is
available again.

For consistency, also rename the variable used
for the counter from lastUsedId to nextId.

This also adds a corresponding test case.

Fixes: QTBUG-105962
Change-Id: Iddf4f3b35c57895bcfbb623a5377edf8344ab6c2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 8b947bae72bf661d31372d1bb5e3a16db50fca08)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-31 05:54:54 +00:00
Timur Pocheptsov
9fd40c04d1 QHttp2Configuration: in QNAM, use old, higher values in flow control
Initially, stream receive window's size was quite significant.
At some point when dealing with a server that did not want
our windows' sizes and was closing the connection (they only
accept 64K) we reduced this size, which ended in a regression
with download speed significantly throttled. We return the old
values (or even more, presuming we have 10 multiplexed streams
and not 100). And also making QNAM consistent with its documentation
(it was not updated).

[ChangeLog][QtNetwork] Stream receive window that HTTP/2 protocol in QNAM is using
increased to 214748364 octets (from the previous 64K) not to throttle download
speed. Clients, working with servers, not accepting such parameters,
must set HTTP/2 configuration on their requests accordingly.

Fixes: QTBUG-105043
Change-Id: I252b6b5eefe92a7304dad15c67928d5a57d9597f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 9540a4eb9071a17446c6b68e086bbea2b50d50f5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-31 03:28:12 +00:00
Ilya Fedin
17f0d47413 QDBusTrayIcon: add xdg-activation support
[ChangeLog][QtGui][Linux/Wayland] StatusNotifierItem tray implementation
supports getting window focus token from desktop environments supporting
the ProvideXdgActivationToken extension (e.g. KDE)

Change-Id: Idcd79a4224b74d6eedfcf1b90129b1a2d3e14312
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit c81d5ec19a3bb85a4b8197bd3176dc873c3b7a68)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-31 01:04:59 +00:00
Axel Spoerl
69b1b91e0d Derive PlaceholderText color from Text color in QPalette
Until Qt 5.15, PlaceholderText color was automatically derived from the
Text color, dimmed by 50% (set alpha to 128, assuming the text color
is fully opaque).

This method has been adapted in the static qt_fusionPalette() method.
No other static method to populate palettes defines a PlaceholderText
color. As a consequence, the Text color is used to render placeholder
text characters.

This patch adds a static method, that sets missing PlaceholderText
colors by deriving them from the corresponding Text color.
It takes a dim factor by which the opacity is reduced versus the
corresponding Text color.

Fixes: QTBUG-105049
Change-Id: Iebb9d15d56f5d72d7ec68b7a0babdf5825b92665
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit ebf733c6fb5503a48a0723d7c6b86a8e1bc60363)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-30 09:07:36 +00:00
Mike Trahearn
7b690681d3 Fix the spelling of the word "combination"
Change-Id: Ib6ad11d4fbbeefa280070125fd0ee6a64dababae
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 20242a254987414566ec852a7e05c19041b90024)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-30 07:54:01 +00:00
Doris Verria
c17a16f468 Add nullptr check for theme when initializing palette
Change-Id: Iaac2c92f5f7e7fd5c25d6ecde058d4dc01c62aa1
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 56e2e899555c99d4013fdbef940a79de9dc542ea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-30 01:00:14 +00:00
Thiago Macieira
9fd2cb559c QMetaType/Doc: update some wording about type registration
Type registration isn't necessary any more, unless you're trying to look
up a name back to ID or QMetaType object. It hasn't been since 6.0.

Drive-by update the example not to use deprecated API.

Drive-by remove the paragraph about requirements that aren't accurate
any more.

Task-number: QTBUG-104858
Change-Id: Ic6547f8247454b47baa8fffd170eecb66719fa65
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 5ff637cc140abc07c4c7934fcd6a048a3d0aa66f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-29 20:47:00 +00:00
Alexandru Croitor
9af6c08e42 qmake: Align iOS Info.plist file with the CMake one
Remove keys that are not needed: CFBundleSignature and
LSRequiresIPhoneOS.

Add CFBundleDevelopmentRegion, which is added by default in new Xcode
projects.

Task-number: QTBUG-95838
Change-Id: I090c14561bc812ec255f55001b658d2dc60e11f3
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 2ca83a1fc9a60eda8046d2f1059ef4a09b0b4b6e)
2022-08-29 10:00:26 +02:00
Alexandru Croitor
c755b10e95 CMake: Default CFBundleName to ${PRODUCT_NAME} for iOS
This matches what we do in qmake.

Task-number: QTBUG-95838
Change-Id: I59fab289a2febc38b50aced89c93612ac6a817a3
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 6bbd77737fc333054f669f3cb8c59e296c417ea6)
2022-08-29 10:00:24 +02:00
Thiago Macieira
8226ae9ac7 tst_QMap: avoid tripping MSVC debug-mode iterator assertions
It does a check to ensure you aren't comparing outside the container.

Fixes: QTBUG-106001
Change-Id: Ic6547f8247454b47baa8fffd170eef346b7f4f24
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit f039147165049dedcf6e1d92d902af28f566d753)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-28 16:41:42 +00:00
Michael Weghorn
e3de89533b a11y: Prevent one case of losing a11y interface when setting event child
9a369a25ddfac9352cabde65c8476c7433dc6c3a added a
QAccessibleEvent ctor that takes a QAccessibleInterface*
instead of a QObject*.

Retrieving the QAccessibleInterface* later is done using the
interface's unique ID stored in the m_uniqueId member.

However, the fact that m_uniqueId is a member
of the union alongside with m_child means that setting
a child via QAccessibleEvent::setChild also overwrites
the stored unique ID, which breaks retrieving the accessible
interface later.

Fix this for the case where the QAccessibleInterface has
an associated QObject by assigning m_object in the ctor as well.
This means that a QAccessibleEvent created using either of the two
constructors (the one taking the QObject* and the one taking
the QAccessibleInterface* associated with the object) now behaves
the same.

Fixing the case where there is no associated QObject would require
further changes (e.g. adding a member for the QAccessibleInterface*
or making the m_uniqueId member a separate member instead of having
it in a union with m_child). However, I see no way to do so without
breaking the ABI, so that is left unchanged.

This also adds a corresponding test case.

Fixes: QTBUG-105988
Change-Id: I71a548af0277a5034e9e207f066fa3e25c5393f3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 0c0eadc484ab7143801593ccdbe8e96eeb9f6cf7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-27 06:11:54 +00:00
Ilya Fedin
0fc6a211b5 QGtk3Theme: subscribe to theme hint changes
Change-Id: I67a9a0d06e88384c0bb6f5008609bcfbf504705f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit f832c707caaa24528eb3048280576144eb13cda4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-27 01:46:18 +00:00
Mikolaj Boc
f10b467a0b Implement mouse capture on WASM
This fixes dock widget undocking - previously, without the capture, any
widget that the mouse accidentally entered would get the event,
resulting in re-docking problems, cursor issues etc.

Fixes: QTBUG-105621
Change-Id: Ia1f2c91578018f2ae9df903bc0730200ede17d32
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit f35e5a44b0d148ede055a11c89fcd7e9920f0b85)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-26 22:10:44 +00:00
Axel Spoerl
c76b524206 Replace logging category lcQpaDockWidgets in dock widget auto test
Logging category lcQpaDockWidgets was used in both dock widget test
and implementation. This dual use caused static builds to fail.

This patch replaces lcQpaDockWidgets with a test specific logging
category in tst_QDockWidget.

Change-Id: I02cdfdaee9c1c1840126d803139b3d271aeac236
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit b48364d49b46c5233d761616a573c010824bcb2b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-26 20:27:59 +00:00
Thiago Macieira
0ad99e39df QVariant/Doc: document that you must register types before op>>
But not before ::fromValue, since that registers automatically.

Take the opportunity to add the \relates to the two streaming operators
to QDataStream, so the documentation shows up *somewhere* at all.

Task-number: QTBUG-105469
Change-Id: Ic6547f8247454b47baa8fffd170eb8ffc31feb5d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 15ccc7e499ac8dd1f75dfa75346d15c4b4d06324)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-26 19:02:26 +00:00
Marc Mutz
69084cf721 Port QDir to qsizetype [2/3]: implementation
Port ints that should be qsizetype. None of these are likely to cause
bugs, because both path lengths and number of directory entries are
usually limited by the OS, not by INT_MAX.

As a drive-by, replace length() with size() and port some functions
from QString to QStringView.

Task-number: QTBUG-103525
Change-Id: I79eb6d580631346a1e77eb1c7a73a3880943794e
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 3f32b01b98f71df32281745fb54b62ab123fe424)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-26 19:02:26 +00:00
Marc Mutz
50d1f6f2cc tst_QDir_10000: add sorted_byName benchmark
Change-Id: Ic30a6353c356f6613f2ef3720b99ebb3b0a7968e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 24675d1a94461cc9d83760c81c164ff4fc0069c9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-26 19:02:26 +00:00
Axel Spoerl
d2e88bc4ea Add QDockWidget save & restore auto test
Implement auto test for (de)serialization of dock widget properties.
Test settings compatibility by importing a hard coded byte array.
Test serialization format and sequence by comparing expected and real
serialization output.
Test dock widget closing behavior (QTBUG-103474) to ensure that
no closing inconsistency is caused by serialization incompatibility.
Extensively document/comment the test to ensure failures can be easily
interpreted in the future.

Task-number: QTBUG-103474
Change-Id: I3c1589c2c291b2ed56334d09b85536d4c7388f92
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 0c54ac20eb27afb9271f5cc8bdb39926796c0896)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-26 19:02:26 +00:00
Marc Mutz
d421418bea [docs] QAnyStringView: remove the prediction that Qt 7 will drop L1
UTF-8 can never replace Latin-1 as the go-to US-ASCII superset,
because, as a variable-length encoding, it cannot use the important
size check in equality comparisons with UTF-16 to avoid having to
iterate the whole string data.

Mention that.

UTF-8 only makes sense in a UTF-8-only environment where the size
check works again. As long as our preferred charset is UTF-16, Latin-1
must be the preferred US-ASCII wrapper.

Change-Id: Ibe52cfc0c9fce0e7aaacd4cd8d6361e8d8bdee3d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6b146566e6686477af99126945df4fd2c059b426)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-26 15:02:55 +00:00
Mikolaj Boc
eed1e0396f Update the snippet for QFileDialog::saveFileContent
The snippet for QFileDialog::saveFileContent is wrong - the parameters
used are in wrong order.

Change-Id: I022e8ed2ef5aeea5a44e9b10ac211893a3e24c0f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 08d2ae88333ee63fe4e84b24409c41d603697577)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-26 14:46:26 +00:00
Morten Sørvig
0f3796941f QThread: add empty functions for the no-thread build
Add implementation for requestInterruption() and
isInterruptionRequested().

Change-Id: I9ffabb0181a48c71deded7362c6c8e2e96418cc0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 927bb089f77b922844e403d529df6558aaf05871)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-26 14:21:58 +00:00
Volker Hilsheimer
53f17d809a QComboBox: Prevent recursion in hidePopup
With styles that want the selected combobox item to flash, QComboBox
runs a modal event loop in hidePopup. This might result in reentrancy if
a mouseReleaseEvent is processed during the 60 ms of flashing.
Since mouseReleaseEvent calls hidePopup again, we end up reentrancy and
possibly undefined behavior which has caused crashes with Qt Creator on
macOS.

Prevent the reentrancy of hidePopup using a boolean flag. Since
QBoolBlocker (or QScopedValueRollback) cannot be used with a bit flag,
use a QScopeGuard to reset the flag reliably.

Fixes: QTBUG-105951
Change-Id: Iaa5df47b93217fc8dff621764ac4005bbc3459b7
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
(cherry picked from commit 2af64c4577e42fecfeab9611c15fa8526bb09988)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-26 12:49:57 +00:00
Volker Hilsheimer
f94e4e3787 Refactor QApplication::event from if/else to switch statement
And it wasn't even 'else if' in all the places where it should have been.

Change-Id: I5a48bfe27cc01fa1fbea1995e8c9cb1be427511a
Reviewed-by: Doris Verria <doris.verria@qt.io>
(cherry picked from commit 74397b4924ea23670952ece384c8b6daf71e7f9c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-26 11:33:28 +00:00
Tasuku Suzuki
25d949c4f2 QAbstractButton: do not steal wheel event when disabled
Fixes: QTBUG-102091
Change-Id: I9a6683ad94a739c9997ebc68dd4ca8cf05438c45
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f8409b6e9c7f9a303fc78061182ce06de9bc795e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-26 11:33:27 +00:00
Friedemann Kleint
1e24f4cd1c Windows QPA/QPlatformServices::openUrl(): Add work around for anchors on local file URLs
Retrieve the browser executable and pass the URL as command line argument
in this case to work around ShellExecute() failing to handle anchors.

Fixes: QTBUG-14460
Change-Id: I44ccd1126d5db6a387b36729837edc045908a670
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
(cherry picked from commit 7e89e6bfe83761bb3dd80dddf4ccc1c332cae80d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-26 09:43:35 +00:00
Andy Nichols
cb7707f855 RHI: Make sure to compare bindings when comparing QShaders
It is possible, at least with Metal, that after the shader is converted
to the native shader that the native bindings will changes, so it is
important to also make a comparison against the bindings as well.

Change-Id: I8b6ff99fbda04ea66e3cb7970d7c33df066734cf
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit e020a8eaf7dbc2adf9064b3e3794dc289264ebab)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-26 00:03:23 +00:00
Volker Hilsheimer
6dd2dbaef6 QAbstractItemDelegate: tolerate that editor gets reparented
An item delegate might override destroyEditor to merely reparent the
existing editor out of the item view for later reuse, rather than
actually destroying the editor.

As of d0dffdfc012574da4a75241097b667d09bb39ba2, the code calling
closeEditor() - which calls destroyEditor - might explicitly set focus
back to the item view parent of the editor. This needs to handle that
the parent of the editor might no longer be valid after the closeEditor
call returns, and rather store the old parent widget explicitly.

Add a test case that segfaults with nullptr access without the fix.

Fixes: QTBUG-105231
Change-Id: I04a355673823c4941865f7a575864e991ceeb5f0
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 52f4d0b0d2a29a08e55293664bf1c8002cad0d17)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-25 16:04:30 +00:00
Eskil Abrahamsen Blomfeldt
a20d257015 Wayland: Skip test that queries window position
The client does not know its global window position on Wayland,
so testing for this will not work.

Fixes: QTBUG-100888
Change-Id: Ibdfc84f1b33d25223dbd740603ce4783c21afc70
Reviewed-by: Inho Lee <inho.lee@qt.io>
(cherry picked from commit e8031906b596fb58d4426fc1ea2c93d3fcb0d77d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-25 16:04:29 +00:00
Alexandru Croitor
9c94845573 qmake: Reformat mkspecs/macx-ios-clang/Info.plist.app
Replace tabs with spaces.
Add some newlines.

Task-number: QTBUG-95838
Change-Id: I0fa0e7b74590e7a093d22de85e24d4456ece4a63
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 4a13083bad111fb9f0a8a1628221038b786a5b63)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-25 15:28:40 +00:00
Alexandru Croitor
0882148f5b CMake: Default CFBundleDevelopmentRegion to $(DEVELOPMENT_LANGUAGE)
That's what new projects in Xcode set.

Task-number: QTBUG-95838
Change-Id: Id07dca0f56c8849a93085c5d36910679e45381b4
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit f16c7e15a2272673e99aee029808deccfe5d32f8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-25 15:28:34 +00:00
Alexandru Croitor
0b072e4da2 CMake: Replace tabs with spaces in iOS Info.plist template
Change-Id: Ied8f31a22c14688fd250955bb54f161f07bea90b
Task-number: QTBUG-95838
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit c0bb65ec022ba209aa0cf8d2615ba08922b3dccf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-25 15:28:26 +00:00
Ivan Solovev
b58fcc10bd tst_qshortcut: port away from deprecated APIs
Explicitly call QKeycombination::toCombined() instead of deprecated
implicit operator int().

Task-number: QTBUG-104858
Change-Id: I46b0863eda445e832a9490bc2a3d05811c2df8c6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e5c184ecd11ab1f03ee568687fbfd25d1c2dd8d2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-25 07:58:02 +00:00
Mitch Curtis
94094780a1 qt_fusionPalette: make links more legible on dark backgrounds
QPalette's default for Link is Qt::blue, which is difficult to read
on dark backgrounds.

Use the same blue that is already used for Highlight, as it is
consistent and easy to read.

Task-number: QTBUG-90504
Change-Id: Ic7aceafb2bd0e57b65448917c352e3551ad26610
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 502c47820a3285b3b3c85365a9843aeb7b76235d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-25 04:03:34 +00:00
Samuli Piippo
bd0d5d4456 CMake: don't use full paths for X11 SM and ICE libs
Full paths were recorded into INTERFACE_LINK_LIBRARIES which could
point to temporary build directories.

Change-Id: I883fd8f652e4d9ecd7d8e0076d62f5c7f4e14ec9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 52ebf31d2b97513b2e3f9b46c99e60249d2b61fe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-24 19:12:12 +00:00
Morten Sørvig
c55ce84808 wasm: add echo_server test TCP server
Test server for in-browser TCP usage.

Change-Id: Ia1a29c0e14a6d2ee8075ce202c9f6998a3ccc4c9
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit a2d0ce32cdfffd3fff1be9c0d6663e11bb01419d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-24 19:12:11 +00:00
Ilya Fedin
982ad6c06a Re-create TLW's window only when its surface type is really changed
Fixes: QTBUG-105017
Change-Id: If5826172efb53b6df15dd3b7ba91b09d733cc77f
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit a4a51f6a641f4bf0a863251d6d3e026d81de6280)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-24 19:12:09 +00:00
Mårten Nordheim
e3702e19d9 Make sockets' accept() methods return qintptr
Not necessarily relevant outside windows, where the socket descriptor
is SOCKET (= unsigned 64-bit). Also follow their recommendation to not
compare to -1, but rather to INVALID_SOCKET.

Change-Id: I0cfa4dfd9e147469132e2e72de22b30eab01e15c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit da9d60ecc32263eaf77882811d58fefad9f85dc9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-24 17:11:24 +00:00
Mikolaj Boc
80201e21c9 Create a driver for running batched tests on WASM
A driver application has been prepared in js for running batched tests.
There is a convenient public API defined for reading the current test
status & subscribing to changes thereof.
The solution is modular - the module qwasmjsruntime can be used for any
wasm instantiation, e.g. in the next iteration of qtloader.

Change-Id: I00df88188c46a42f86d431285ca96d60d89b3f05
Reviewed-by: David Skoland <david.skoland@qt.io>
(cherry picked from commit ad1980cd4326acca891ed0fa4326ed1b22828324)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-24 17:11:24 +00:00
Kai Köhne
b92f6dac20 Doc: Remove "Container keywords" section from containers.html
For foreach, we just mention that it is deprecated, and forever is not
actually directly related to Qt containers. Both macros are also
documented in qglobal.cpp, and the section title is not referenced
anywhere so this patch won't break any links.

Change-Id: I6c3e11b205237e5b502173f2216606adf5812f55
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 4b3cb1329a36448bc636c9e43ed53b8b9e102acd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-24 17:11:23 +00:00
Kai Köhne
bff67a3ebf Doc: Remove qmake-only reference in Q_IMPORT_PLUGIN description
The Static Plugins page describes handling of qmake and CMake already
in greater detail. No need to replicate it here.

Task-number: QTBUG-88044
Change-Id: I2cae85c0b0d20585b563bab9e263121181adeb8c
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 836b2ae1e6c76775b38eb59f0b01c66a83a0fe9a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-24 17:11:23 +00:00
Kai Köhne
c4b2c75593 Doc: Remove mentioning of variadic macros
We don't support compilers without variadic macros anymore; the check
in code was removed already in commit 4628e5cded8.

Change-Id: Ica4d0b2f7055e3d00ae780e23eb4e5a9d2dcc191
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit f9cd4a02904e860e6a3dc29ad942098e1c1ab6a8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-24 17:11:23 +00:00
Kai Köhne
0d8f92ec8f Doc: Generalize info about -rdynamic to be not qmake specific
Fixes: QTBUG-88044
Change-Id: I079cb75b5a5c32e38dec73474c967cc836d94b68
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 54e01d50f44044e6b8d7a26a8f095702c6739bdf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-24 17:11:23 +00:00
Axel Spoerl
3638a46b67 Make QHeaderView restore state from different stream versions
If restoring a QHeaderView state from a data stream with version Qt_5_0,
check alignment and resize mode properites for out-of-bound values.

If out of bounds, try QDataStream version Qt_6_0, which is used by KDE
apps compiled with 5.15.2 or 6.2.3.

QFileDialog stores settings in the same settings file across different
Qt versions, using different QDataStream versions. That makes
QFileDialog vulnerable to the issue (QTBUG-104962). A respective auto
test is added with this patch.

Fixes: QTBUG-104962
Task-number: QTBUG-104425
Change-Id: I666207fca7ab837ad27a247e504a40757ee8afab
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 854cb55987b3de3c8379db0e7e95b4c94d4e6588)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-24 17:11:23 +00:00
Joerg Bornemann
4e656d6142 CMake: Fix Android build for CMake < 3.19
The Android build used cmake_language(DEFER) and guarded with a check
for CMake's version being >= 3.18.  However, cmake_language(DEFER) was
introduced in CMake 3.19.  Fix that version check.

Fixes: QTBUG-105841
Change-Id: Ic318c104cf212de4c97c5a89b73536609826fd5b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit e38c7618be50e16b51cc8afdab52ffb26ed76b0c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-24 17:11:23 +00:00
Mitch Curtis
ac2b8ff45c Account for dark system themes in qt_fusionPalette
On Ubuntu (Gnome), the Fusion style didn't account for when a dark
theme was set in the system's settings. Neither QGtk3Theme, nor
QGnomeTheme (which it derives from) provide a palette() implementation,
so they'd fall back to QPlatformTheme's. This default implementation
calls QPlatformThemePrivate::initializeSystemPalette(), which uses
qt_fusionPalette().

This patch accounts for QPlatformTheme::appearance() in
qt_fusionPalette(), adjusting the palette roles accordingly
to look correct when run under a dark theme.

This also fixes the same issue for the Fusion style in Qt Quick
Controls.

Fixes: QTBUG-90504
Task-number: QTBUG-99276
Change-Id: Id096bf809ef7a63dc440b5a68283e123173e917e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 9c66af1f1d2cb8d25546d544e22fd7647227214e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-24 12:17:05 +00:00
Joerg Bornemann
487512c134 CMake: Allow for CMAKE_INSTALL_BINDIR set to . in deployment API
Esp. on Windows, it can be desirable to deploy an application and its
DLLs directly in the install prefix, without a bin directory.  To do
that, one must set CMAKE_INSTALL_BINDIR to ".", but that resulted in a
faulty prefix entry in the generated qt.conf.

Check for this case when generating qt.conf to write the correct prefix.

Fixes: QTBUG-105583
Change-Id: I0e8295c70b48b991c19f58f6b3f2ed132112dd29
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 2f7a78cd7b3351bc7a1a209d0822769d111f246b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-24 12:17:04 +00:00
Joerg Bornemann
cd5d212634 qmake: Fix installation of separate debug info for plugins
This amends commit fc2e40e88d44d457ec5ebd1cc235696f3f478be9.

For Qt plugins, we do not add 'dlltarget' to INSTALLS but only 'target'.
In this case we must add the .dll.debug file to 'target' like we did
before fc2e40e88d4.

Fixes: QTBUG-105374
Change-Id: If495548dfca55d02e1c5884e03e281e27ee07ccd
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit 38ca34ac935e222d532fc5f6939efaa15c633b39)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-24 12:17:04 +00:00
Richard Moe Gustavsen
c4f08c0935 iOS: use NSProcessInfo to resolve timestamps in simulator builds
We currently build Qt for simulator using X86_64, even
on ARM based macs. This results in the simulator running
on ARM, while the app is running inside it using Rosetta.
And with this combination, the event.timestamp, which is
documented to be in seconds, looks to be something else, and
is not progressing in sync with a normal clock.

Sending out mouse events with a timestamp that doesn't follow
normal clock time will cause problems for mouse-, and pointer
handlers that uses them to e.g calculate the time between a
press and release, and to decide if the user is performing a tap
or a drag.

For that reason, we choose to ignore UIEvent.timestamp under
the mentioned condition, and instead rely on NSProcessInfo.
Note that if we force the whole simulator to use Rosetta
(and not only the Qt app), the timestamps will progress normally.

Fixes: QTBUG-105810
Change-Id: Ib4e60593cac3230567ebc53d634f434fcefc98d0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 0250f9364fbf31950601bf27c2a93c520c4abd80)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-24 06:50:34 +00:00
Mikolaj Boc
8ad7e7d6a0 Disable resizing only when explicitly asked
Do not assume that popups are unconditionally non-resizable. Only
disallow resizing if explicitly asked by minimum/maximum size match.

Change-Id: Ia8e3e4d074e4dc24b0ae4be56858e0d833eeebdb
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit a4c0e442e5f4f3ca2ed8ea81883db31e464a0209)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-24 04:46:46 +00:00
Volker Hilsheimer
a6276ca0e4 Mac: close popups when the user clicks into the menubar
Otherwise it is possible to have a context menu and a menu from the
menu bar open at the same time. Native applications close the context
menu, but also block the click into the title bar. This change only
closes popups, the click goes through to the menubar.

Task-number: QTBUG-105474
Change-Id: I664c00eea83ba8fb43cc8a630d787f2d2b5b96ff
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 03144190dfa329444d8941781d20265dfe7ce59c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-23 21:50:42 +00:00
Volker Hilsheimer
1218e71aae Mac: close popups opened on inactive application on relevant user action
On macOS, users can right-click into an inactive application to open a
context menu without activating the application. Qt handles a number of
events to close open popups (window deactivating or a mouse press
outside the popup), but none of those will get called when the
application is already inactive. So the popup might stay open (and on
top of the window stack) when the user clicks into other applications,
or activates another window.

To fix this we need to watch for events outside of the Qt application on
which we need to close the popup: when the user presses a mouse button,
or activates another application using Cmd-Tab. But we don't want to
monitor for key events, as that requires user permission. Use a global
event monitor to watch for mouse presses, and an notification observer
to watch for application activations, and respond by closing all popups
(and removing the monitor and observer again).

Use the monitor as well to watch for mouse moves, and pass only those
events through the Qt event system so that mouse tracking in the menu
works even if the application is inactive. This change brings back a
version of the global event monitor we had in Qt 5.15.

However, a press into our own menu will trigger the activation observer
after the application became active, which would now close the menu. We
don't want that, so we also need to remove the observer when the
application becomes active (which makes sense anyway, as we will get
regular events from then on).

Fixes: QTBUG-105474
Change-Id: I18573fcda09a46c27730bd670a795f4d467aab01
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 5afb04d79ba246d9dca30c666511ce7505113ac5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-23 21:50:35 +00:00
Ilya Fedin
b7cfd0990e Fix build without highdpiscaling feature
Fixes: QTBUG-104925
Change-Id: Ieb5dd2194c54a61733c427c8a0ddf7576147d6ea
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit c2bcba0d3cf550ede0488b40b8a5f81be817a65c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-23 08:32:19 +00:00
Mikolaj Boc
c79cc68081 Deliver correct key code on key release on WASM
Changed the behavior in which key events are delivered to targets.
Before the change, in case of a EMSCRIPTEN_EVENT_KEYUP event, the key
code and text were not filled in correctly as they should. This resulted
in wrong behavior when event targets expected these codes being available.

Fixes: QTBUG-105213
Change-Id: Ie66b5d6d395d08af655fcb00f1f616ad43d6bea4
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit 74852139308b3798ffefbf94c62a056bdb1898c4)
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-08-23 09:51:24 +02:00
Sona Kurazyan
c834c2b918 Remove qtnamespacemacros.h and use qtconfigmacros.h instead
Change-Id: Ibae6e6e255c1bb1ee52839a051d585de81833bf9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 4842cc176881ae22e14ca193fba46c6a04d09530)
2022-08-23 09:19:58 +02:00
Ilya Fedin
10c9ae1bea Move PreselectFirstFileInDirectory theme hint from QGtk3Theme to QGnomeTheme
It doesn't use any gtk API, so can live in QGnomeTheme

Change-Id: Iff0391de6f01a03981f6e45b04fe9824fd2becfc
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit cf6ab64f03723e254af9a28f431f076cffc7d54a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-22 23:25:50 +00:00
André de la Rocha
508e584c60 Windows QPA: fix tree item discovery through UI Automation
This change reverts a workaround for a compatibility issue with
a Windows utility, which is no longer necessary with Qt6 and was
in some cases preventing accessibility tools from discovering
tree items.

This reverts commit 1c55a6caf1fc2b8a73a9a756bcf6894c5d4e4398.

Fixes: QTBUG-105814
Change-Id: Id464da49704b6953affca2fa40acc03f1ffd05ac
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 62d957f6aab38f60f22c7e045a9710484f58ae4e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-22 20:00:44 +00:00
Mikolaj Boc
be1df31121 Refactor QWasmEventTranslator for added readability
Change listing:
- change names of abbreviated structures/variables (e.g. KeyTbl
-> WebToQtKeyCodeMappings)
- add constants for commonly used magic strings ("Dead", StringTerminator)
- use common idioms for common tasks (find_if, std::optional)
- use binary search as facilitated by the sorted array instead of a full
search - this optimizes the code at no cost
- remove dead code (double translateEmscriptKey in
QWasmEventTranslator::getKey, remove sticky dead key support as it was
write-only, remove the dead setIsMac and g_usePlatformMacSpecifics,
remove the dead getWindowAt).
- cull the public interface on QWasmEventTranslator as some functions are
only used internally (translateEmscriptKey)
- simplify / shorten functions by short-circuiting
- modernize definitions (= default)
- auto-format the changes using clang-format

The file is now much easier to read and understand.

Change-Id: I5ea2bdafd9b9abc009feeb5516ddd87fb0ca212e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 784555cc2fa9d1625a4cac458c15d28cf0c1f4d7)
2022-08-22 11:54:11 +02:00
Sona Kurazyan
86082a711f CMake: fix the sorting order in CMakeLists.txt
Change-Id: I27c2140102bdf4831915337002974ab1987e2426
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 2df6fd5ea02be47d3fd604345bb8983183411ea1)
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-08-22 11:48:49 +02:00
Tor Arne Vestbø
0ac44dd870 tst_qgraphicswidget: Avoid redeclaration of Size from MacTypes.h
If an included header brings in MacTypes.h it will cause issues,
so rename the enum to be on the safe side.

Change-Id: I29ec795be74a65d4f2267d8121a514bf192cf969
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 1ecfc4101cf41b1d3947ed938bb76c52919f360b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-22 00:22:11 +00:00
Mikolaj Boc
f236be7a1a Use the dead Mac path in QWasmEventTranslator::translateDeadKey
The path for is_mac is unused. Use it by querying the platform from the
new WASM plugin web platform API.

Task-number: QTBUG-105213
Change-Id: I9a8922b5e9d215090dbdcc534c056c2cc068c009
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit e8e584090ba8d360e56bec988bba74baf90ee668)
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-08-22 02:22:11 +02:00
Mikolaj Boc
e5743ee7db Only manually expose the wasm window on raise/lower if it is visible
If the window is manually exposed and the window is invisible, the result
is blocking the visual sync and repainting of the window, which makes
the window 'dead' from user perspective until they click/activate it,
which again sends an expose event to the window, restoring its updates.

Fixes: QTBUG-105363
Change-Id: Iaa42f3ffeca179b8e6da19c9c02a6f01458ca66a
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit 5a76837a7f4134454de65547043b78d51e3d7bef)
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-08-21 22:28:09 +02:00
Marc Mutz
6ce5d0908d QContiguousCache: fix streaming into QDebug when indices are > INT_MAX
As usual, int/qsizetype mismatch.

Task-number: QTBUG-103525
Change-Id: Ic5d9fb4fd42e4534ec0358ca7c4d79650c6ac919
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit db4480062796482da766a58f4812faf63d8acab0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-21 20:24:36 +00:00
Marc Mutz
d7807ee3fa [docs] QAnyStringView: mention automatic U8→L1 reclassification
...for US-ASCII literals.

Amends eaabd0c5450ad849e24878d38dd05d5b23d7eec3.

Task-number: QTBUG-101014
Change-Id: Id0acccb9bf2dfb01bca93f62da634e8dfe299fbc
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit c51c4aa2c5593e0fbe2b309f0014a49ae6297606)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-21 20:24:28 +00:00
Marc Mutz
a886dd9f0c QDebug: finish porting put{String,ByteArray} to qsizetype
The underlying QTextStream seems to support qsizetype-sized data and
the private API of QDebug that is under consideration in this patch
takes size_t, but, as so often, there're int/uint casts in-between
that break things.

Widen the int/uint casts to qsizetype/size_t, respectively.

Task-number: QTBUG-103525
Change-Id: I10bca093dc2d6f136871c94ca43f5b42fd1c8971
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit bc2b8411c9e510a1101ed09b627317854c6e7d45)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-21 20:24:18 +00:00
Marc Mutz
51495e36da QDebug: port putEscapedString() from int to size_t
All callers of the function pass size_t values, so remove the
impedance mismatch and preserve the value.

Adjust local variable runLength to qsizetype, because with this change
the int variable may now overflow, which would cause infinite looping.

Adjust callers to not perform narrowing conversions.

Task-number: QTBUG-103525
Change-Id: I2a9d3301118855fc95245a55bf64de6c46fa2f51
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit a888239cf15fb18034122a06c687526c83dbdaa9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-21 20:23:40 +00:00
Marc Mutz
78c8cd581f Port QtDebugUtils::toPrintable() to qint64/qsizetype
Some callers pass qint64 arguments to the len parameter, so take the
size as qint64, not qsizetype, to avoid silent truncation.

Task-number: QTBUG-103525
Change-Id: I4bc5673297f24aea0cfc9d20887dc8a877743214
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit bcc32bc1128544cceb41d337ee16bc36c3eb188f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-21 20:23:33 +00:00
Marc Mutz
c99bee92a0 QDeviceDiscoveryUDev: use NSDMI
This also fixes 0-used-as-nullptr warnings from clang-tidy.

Change-Id: Ibf10f1719a6c8cf22046cf30298dadb307a853d5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 401041f958c9a6a9535eb4590e8c4009cc491b5b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-21 20:23:24 +00:00
Marc Mutz
4260287620 QAbstractFileEngine: port indexed to ranged loop
... fixing a int/qsizetype mismatch in the process.

As a drive-by, replace SESE with an early return.

Task-number: QTBUG-103525
Change-Id: I961728ba818c4cb43c0e2c9056c70c8f37ad042e
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
(cherry picked from commit f40679dcdd8278aca5838101b2d4c3c7733ea130)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-21 20:23:21 +00:00
Marc Mutz
96fea6e142 tst_qbytearray: remove qCompress_data for QT_NO_COMPRESS
The _data function is useless without its test function (and it's not
used in other _data functions).

Change-Id: I7aa6006ed1a9d89008577b750af4ea717dae237f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit b5d5385201e74c216c69aff78c383738e801a839)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-21 20:23:19 +00:00
Mikolaj Boc
4db3a15803 Use the correct module exports in qtloader
Refactoring of module exports in qwasmintegration.cpp was not followed
by adjusting the qtloader. Do this now.

Fixes: QTBUG-105264
Change-Id: Ibb0a4a20c0df1409cdcbba04ebd42c1569ae586a
Reviewed-by: David Skoland <david.skoland@qt.io>
(cherry picked from commit b7802b401fa40b3594b603102378f9a0c2b46421)
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-08-21 09:15:16 +02:00
Mikolaj Boc
c0129e6ad3 Modernize QWasmCompositor::windowAt
Use a well-known idiom for finding a matching window in the window stack
(std::find_if)

Change-Id: I677ef6ad8ee88bbd9eee1405be592ec2527ca3b9
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit 0881b5d75c8ad01b295edb96ffd1392d4b804e61)
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-08-21 09:14:27 +02:00
Volker Hilsheimer
77a892affc Don't access QObjectPrivate::declarativeData unguarded
The QObjectPrivate::declarativeData member is stored in a union with
currentChildBeingDeleted. The QObject destructor always sets the
currentChildBeingDeleted member of the union. It also sets the
isDeletingChildren bool, which is the only way to find out which union
member we can safely access.

While the QObject destructor is deleting children and isDeletingChildren
is set, we must not access the declarativeData member of the union.

Add a test case that initializes the function pointers for the
declarative handlers and constructs a situation where an object
emits a signal while it is destroying children.

Fixes: QTBUG-105286
Change-Id: Iea5ba2f7843b6926a8d157be166e6044d98d6c02
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 3be99799a675a631c67e05897383af9abbc377b3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-21 02:36:51 +00:00
Mikolaj Boc
196c38a846 Remove QWasmCompositedWindow as dead code
No fields in QWasmCompositedWindow, apart from visible, are used for any
computation. They were write-only. Remove the class entirely and create
a hash of visibility state instead.

Fixes for z-order will follow.

Change-Id: Icb7ff1865d1f9a67c0fde43cfa331ca1242ebcaa
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit 4b165c6bcc0e2d29dda230854766a5359a7e8db9)
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-08-20 23:31:51 +02:00
Mikolaj Boc
c5e659be7c Do not invalidate the entire window on window move on WASM
The invalidate on window move is redundant - the previous texture can
be reused for the window. Just request another refresh on the compositor
and don't update the window texture. Makes window moves smoother.

Change-Id: Ied2922a000d3c8e6143e64d029154d74bc4f3480
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 503018ae070d9d39ab85b66499e14a8085adf51e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-20 00:51:43 +00:00
Mikolaj Boc
bf94566694 Avoid image format conversion when drawing window nonclient area
This radically speeds up window resizing and dragging.

Fixes: QTBUG-105709
Change-Id: I844601a5b139d21024db0c373482af18f350d0eb
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 2a23652bbbba8def270b78d76c91a5a96d391106)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-20 00:51:20 +00:00
Mårten Nordheim
e70018c814 QSslServer: Re-enable read notifications when a client times out
Otherwise new clients will not be handled when they try to connect

Amends 29a1fe72a0888eb1f22a5ae9fe1b3d87257f3246

Change-Id: Ifff052d1bf27682df2782faa285a257c9b41d86f
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 50f8a9578dd54f74e8a5f99481f7f34d969d867f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-20 00:51:20 +00:00
Alexey Edelev
3eb367095f Fix Multi-ABI builds when CMAKE_<C/CXX>_COMPILER_LAUNCHER contains list
Add list-escaping for CMAKE_<C/CXX>_COMPILER_LAUNCHER variables when
passing them to an external ABI-specific Android project.

Amends c7231177df71879b6d3ebc48288a6d3d8fdab6d0

Change-Id: I0c98eee6594c395dc6a37465a99ea32b1af39b84
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit a2809d9ec1c4351bc356e05e8f3c1db0363bef86)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-20 00:51:20 +00:00
Edward Welbourne
70783deaa1 Update QTimeZone benchmark's list of tested zones
It purports to be a list of those named in QDateTime's tests, but was
a bit out of date. In the process, sort them into somewhat coherent
order (to make it easier to verify whether one is missing next time I
check) and reformat.

Change-Id: I16e7ded6f8b00e226513bd06d6174a79f7a0c675
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 0ed89870788f28daf1504a6204343d6b158b2cf3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-19 21:26:41 +00:00
Sona Kurazyan
b000770c20 Move QT_SHARED, QT_STATIC and QT_CONFIG macos to qtconfigmacros.h
Change-Id: Icf4621fa22f41355f98ed38b47560706258b41b7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 43b59a842a86140fa5f5da2f0d66d0d916883c8f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-19 23:26:41 +02:00
Sona Kurazyan
f4d3b191a0 Rename qtnamespacemacros.h -> qtconfigmacros.h
But keep qtnamespacemacros.h for now, some modules include it
explicitly, so need to change those to include qtconfigmacros.h first.

The plan is to move QT_SHARED, QT_STATIC and QT_CONFIG macros there too.

Change-Id: I945b3dfffbd9cd394a6cf42a36df6657d1703d5b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 22b16a1db143ff6764a55d3b58bd26b1f3c95a8a)
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-08-19 23:26:41 +02:00
Tatiana Borisova
1cf503fd62 Put code related to timezone functionality under QT_CONFIG(timezone)
Change-Id: I0d1573dbb4ae4f9740fc19546950ae4316aa4c0c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 6a3509baa20ba049b84a7774a9b270bb81748148)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-19 21:26:41 +00:00
Michael Weghorn
db0db36ddc a11y atspi: Send correct D-Bus reply for GetAttributeValue
Only return a string for the attribute value
(an empty string if the attribute is not set).

The previous implementation was based on the incorrect
signature in the XML spec for the AT-SPI Text interface from
before the AT-SPI commit that removed the extra out params [1]:

    commit 8786849ce6e9914383aa766ff9ce7e00f5b2178d
    Author: Patryk Kaczmarek <patryk.k@samsung.com>
    Date:   Mon Sep 28 14:23:15 2015 +0200

        Fixed atspi_text_ functions

          * atspi_text_get_text_attribute_value
              Fixed dbus signature in _atspi_dbus_call function
              and add missing argument for string.

          * atspi_text_get_default_attributes
              Receiving return value by reference from hash table

        https://bugzilla.gnome.org/show_bug.cgi?id=755731

[1] 8786849ce6

Fixes: QTBUG-105752
Change-Id: I66d3c484ecc4b469684635723242c915e4365e6a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit e6599bfa6134cfd3097c9cb8ec45801ae810f3df)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-19 13:15:53 +00:00
Michael Weghorn
48fd29fa47 a11y atspi: Add missing closing tag in introspection XML
Change-Id: I4497353ef33a10b94141b24b9cda3fa7ee3e17b9
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit c2289ca582a1b48fdb97146636fe29b680019260)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-19 13:15:43 +00:00
Volker Hilsheimer
4a5066c0fe Remove network dependency for tests with UNC paths
Windows VMs are provisioned with shared folders that are available as

\\${COMPUTERNAME}\testshare(writable)

so we don't need to access a remote SMB server over network anymore just
to test whether our string-parsing code handles UNC paths correctly.

Add a QTest::uncServerName() helper function to the shared filesystem.h
header and use that instead of QtNetworkSettings::winServerName. The
latter is now only used in tst_NetworkSelfTest::smbServer().

Change-Id: Id0da66369ad0f4a980d612de2a31a391f1192253
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 371214dea7f92b3170d0239b3d9944275adf951a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-19 13:15:25 +00:00
Mikolaj Boc
0edf92aa4e Deliver non-client area mouse events to WASM windows
QWasmCompositor now delivers non-client area mouse events to windows as
it should, which fixes a lot of issues with window manipulation. One of
such issues is re-docking of dock widgets.

Fixes: QTBUG-105092
Change-Id: I9de45b7e1b1a80b64387031eb0cc0b31a4be2571
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit 19507dc6788f252cd0795d80d9a39d22f1306882)
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-08-19 15:15:06 +02:00
Ilya Fedin
fe1319a4c8 Remove unneeded QWindow from QGtk3Dialog
It seems QWindow here is only for making the dialog modal,
but QDialog already handles that and this makes two modals
block each other depending on the order they created with

Task-number: QTBUG-98988
Change-Id: I6847cfab480395f62eaa0ebf79acf8b024192178
Reviewed-by: David Edmundson <davidedmundson@kde.org>
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
(cherry picked from commit 64e6233252117415d6765b6f7a8f4df39490b678)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-18 19:11:23 +00:00
Assam Boudjelthia
861780151f Android: skip tst_qvulkan vulkan11() and vulkanWindowGrab()
This fails on Android 12 in CI.

Task-number: QTBUG-105739
Change-Id: Ibf3deb6b84564f12b5172f2522875fe70f8ce87b
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 78c85616585d3e6b9346d0a0ed236c23127b3810)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-18 14:23:34 +00:00
Assam Boudjelthia
52acf391ec Android: skip tst_qopengl::fboRenderingRGB30()
This fails on Android 12 in CI.

Task-number: QTBUG-105738
Change-Id: I94fcefae3d88087cd96f4043b015f9469ed629a9
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 0fb59d68f79328215a5c3b3602c5baefdc0d1178)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-18 14:23:33 +00:00
Assam Boudjelthia
c28859a861 Android: skip crahsing tst_QFile's unixPipe() and socketPair()
... on Android 12.

Task-number: QTBUG-105736
Change-Id: I1a67ef34e2f3918d96bdcfdcde48c1c14fe01c2e
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 7c917a6dbff7ee837ad847f74be17d4cf6536371)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-18 14:23:31 +00:00
Assam Boudjelthia
29d6c1adf0 Android: skip tst_QPluginLoader::loadSectionTableStrippedElf()
... on Android 7+ because Android linker doens't accept missing or
bad section headers.

* https://android.googlesource.com/platform/bionic/+/refs/heads/oreo-r2-
release/android-changes-for-ndk-developers.md#missing-section-headers-
enforced-for-api-level-24

Task-number: QTQAINFRA-4748
Change-Id: I37fcf7995bbfe7d258b92f7425baf4722b0ad4ab
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit d1e97ada4eef35f43ff09049dfd8bbe8b522b6b3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-18 14:23:27 +00:00
Assam Boudjelthia
a660f97478 Android: tst_QByteArray::base64_2GiB() times out or gets terminated
Android kills this test case which tries to use too much memory,
or it times out.

Task-number: QTQAINFRA-4748
Change-Id: Ifce92533d50f4c463ee10fe80e7654ad16172a35
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit cf4f147c23aad772a523b79390b1b5e86037a294)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-18 14:23:26 +00:00
Assam Boudjelthia
5b08cc0f2a Android: fix Android filedialog and completer tests
* https://developer.android.com/training/data-storage/use-cases#opt-out-
in-production-app

Task-number: QTQAINFRA-4748
Change-Id: If6abb48b730b9b33807f5f6648e1360defc090a6
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 2c6e71e562555c25e25b36d894dc42024fe35d55)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-18 14:23:18 +00:00
Mårten Nordheim
906396185b QSslServer: Make sure maxPendingConnections applies to all sockets
Not just the ones we added to the pending sockets list

Change-Id: I0a0016fe39df7ca2fc3f0c4e4111195bc6d90198
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 1ee75e47401d0ed4646d4fef7ce8e09eb90f4d5e)
2022-08-18 16:22:55 +02:00
Mårten Nordheim
2a276e0dbf QSslServer: Implement handshake timeouts
If a client doesn't send any data then we would leave the socket open
for as long as it needed, wasting resources. Add timeouts to limit the
amount of time this can happen for.

Since there is a limit on number of sockets that the server will have
queued, having idle sockets stick around forever is a vector for ddos.

Change-Id: Ida6251c92c625eeadf2065861b840b14255654b8
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 29a1fe72a0888eb1f22a5ae9fe1b3d87257f3246)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-18 10:32:39 +00:00
Mårten Nordheim
7537006c76 QSslServer: Check that first byte is ClientHello
SecureTransport ignores any content that comes in until it is large
enough to be a handshake. So a plaintext client may be left hanging
while it is waiting for a response.

Change-Id: I501ae61d89d516765c7ba5f0d916d9246fde5d4d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 1b68e0b71786ce509cadf0771a1c4c1d71a7294b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-18 10:32:35 +00:00
Mårten Nordheim
22c2568af7 QSslServer: pass 'this' as a context to connections to socket
Then we don't have to do a 'global' disconnect() on the socket object
just to disconnect the QSslServer from the socket.

Change-Id: Ie3c9680db2717e21a0c548c74374a58d533534fe
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit fb4123f36a88f6e890ed2e7f9b462665bfdcd6c0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-18 10:32:32 +00:00
Alexandru Croitor
66167500aa CMake: Add function to create qmake build tests
Uses CMake's add_test and fixtures to call qmake and make,
thus allowing to create tests that ensure that building qmake projects
works.

Task-number: QTBUG-96058
Change-Id: I6f03c4389896f9571bb4f9551f93295075c3d8e1
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit e76286fd4b5daaff4ff6bfabc1b6c98345cb3d22)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-18 06:48:40 +00:00
Alexandru Croitor
e6eaa053f5 CMake: Add simple widgets qmake iOS build test
Build a simple widgets qmake project when targeting iOS in the CI.
This ensure we don't introduce basic regressions in the .pri / .prl
file generation.

Make sure to target the ios simulator, so we don't require any
code signing or provisioning profiles.

Fixes: QTBUG-96058
Change-Id: I1a5564e838a5ce3cac89a37a5a4ddee74d3400f3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 9e3e167223d2d16b4b0dac0be72ce212e47665b4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-18 06:48:33 +00:00
Alexandru Croitor
75b3f7ef55 CMake: Add COMMAND_ECHO option to _qt_internal_create_command_script
Change-Id: I7884855b7934c1f65d8699759408f5c89632ba11
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 459f71466267a8fb5ff05de21e9a3865796d4e06)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-18 06:48:31 +00:00
Alexandru Croitor
0413d13f03 CMake: Move _qt_internal_create_command_script to a public file
It's needed for creating qmake build tests.

CMake / CTest has a limitation of not allowing to create single-config
tests when using a multi-config generator using the add_test(NAME)
signature.

Using add_test(NAME) forcefully creates per-config tests, which means
that it's not possible to just run ctest to execute tests, without
specifying a -C parameter, which we do in the CI.

qmake tests need to use the add_test(NAME) signature
to specify the WORKING_DIRECTORY option.

Because of the above limitation, a work around is to not use the
add_test(NAME) signature, but instead delegate the working directory
assignment to a generated cmake script, which
_qt_internal_create_command_script can already do.

Task-number: QTBUG-96058
Change-Id: I6f439165994671724157f0edb7a71e351271e329
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit edb88a3b2914bcce4a0a99b17ef14e3d4db0a220)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-18 06:48:30 +00:00
Alexandru Croitor
e6ee26fe07 CMake: Allow building and running tests targeting iOS in other repos
Allow building iOS tests in other repos, if DisableTests is not
specified.

The reordering in coin_module_build_template_v2.yaml is done to match
the same order that's in coin_qtbase_build_template_v2.yaml.

The change in coin_module_test_template_v3.yaml is just cosmetic.

Amends 80705298ca11587782beed49c4ae55f533cfc0c2

Task-number: QTBUG-96056
Change-Id: Ic69ef938cb9319fa9a0eb063046b009de34bebc1
Reviewed-by: Toni Saario <toni.saario@qt.io>
(cherry picked from commit 74d6ca276830969b151e168d0fd8a26ac4ec361c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-18 06:48:20 +00:00
Michael Weghorn
37045f8efc a11y atspi: Send D-Bus reply for "GetCaption" in expected format
Just like for the "GetSummary" case, the argument in the
reply for this AT-SPI table method needs to
be wrapped in a variant.

Fixes this warning from the output of the client side
using libatspi:

> (accerciser:181933): dbind-WARNING **: 11:50:36.394: atspi_dbus_get_property:
> expected a variant when fetching Caption from interface org.a11y.atspi.Table; got (so)

Fixes: QTBUG-105520
Change-Id: I18167359e4cd3bb14a94289ac7481f9e39a18ad0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 7594e8ca4d91935400f065e138ff1e4b4f212478)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-17 20:29:52 +00:00
Mårten Nordheim
0f7390e410 QAuthenticator: Fix crash when using NTLM / Negotiate
With NTLM/Negotiate we delete the context used to generate replies once
we get SEC_E_OK. Due to some faulty logic in the http backend we could
end up trying to generate another response. Qt would then pass
references to some offsets of nullptr into the API calls causing it to
crash. Add some sanity checks before the "sspi continue" calls to make
sure this won't happen, and update the condition in the http
backend to check that we have not already sent our credentials.

As a drive-by: correct the initialization of the handles to use
SecInvalidateHandle instead of memset to 0.

Fixes: QTBUG-102359
Change-Id: I884ff8fc70609fe8746b99a1d56eeafcda9d2620
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit c684b8e939650b5c007b990c5c39eea750f45970)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-17 16:05:30 +00:00
Laszlo Agocs
0c3d791e66 rhi: tst_qrhi: Check for OpenGL cap on the platform
Running tst_qrhi -platform eglfs will pass on RPi4 / Mesa 22.
This does not test Vulkan of course since the platform plugin cannot
create a Vulkan instance.

Running tst_qrhi -platform vkkhrdisplay will enable Vulkan but will
still try OpenGL since the autotest does not query the platform
integration about OpenGL support. Make this nicer by skipping most of
the GL test if the platform integration we have cannot handle OpenGL
stuff anyway.

For some tests the data-driven approach has to be removed since doing
QFETCH without any rows will crash. These two OpenGL-specific tests
now check OpenGL support directly and QSKIP if needed.

While we are at it, fix up the Vulkan instance API version as well.

Change-Id: I2891c04540bc2dfd0ccf475629bd23542bff15f5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 2de14b81a9c76ce95c96385262467f41892a2a1c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-17 06:26:06 +00:00
Laszlo Agocs
496147fd3f vkkhrdisplay: Create the platform window always
No matter what the surface type was. We only support VulkanSurface, so
if the type is something else, then a a qWarning is in order, but instead
of returning nullptr (which will almost certainly cause a fail or crash
in some form), we can just carry on normally. The resulting window
will not be renderable from the application of course, but that is
not always needed in fact, plus failing gracefully is nicer.

The tst_qrhi autotest can now be run on the RPi4 also with
-platform vkkhrdisplay. While there are some odd messages occurring
from Mesa and co., the run now completes normally, with no failures.

Change-Id: I77bd249096aede8e05458559458581d702054540
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit e025b07c64a44e0fdf05b34bd183177d18a295a2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-17 06:25:59 +00:00
Laszlo Agocs
a5619e19f9 rhi: Fix instance API version when only 1.1 is supported
Looks like something inherited from the Qt Quick code that got
moved into the helper. Setting a request of API version 1.2 is
harmless in practice, but to be correct the version should be
1.1 when 1.2 and newer are not reported by the instance.

Change-Id: I62d2c143972d6753e4311c6907ccf846ae0e9088
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 73fe9a786c119a5763ae0ce9dd0575c088e0f29b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-17 06:25:44 +00:00
Morten Sørvig
39911a21b2 wasm: streamline the exec warning
State the problem and suggest possible solutions for the
app developer.

Change-Id: I0484c4eb31020ec0016005f43f910f32a319b850
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 83cf2985e941ee9ca6f0ef076ca4f5770cfb1f2c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-17 03:04:42 +00:00
Morten Sørvig
13bf20c8aa wasm: include asyncify support unconditionally
Emscripten's option for enabling asyncify (-sASYNCIFY) is a link-time
option, which means there is no requirement to have a separate asyncify
build, at least for static builds.

Replace the current QT_HAVE_EMSCRIPTEN_ASYNCIFY compile-time option
with a run-time option which checks if the asyncify API is available.

Keep support for configuring with "-device-option QT_EMSCRIPTEN_ASYNCIFY=1"
for backwards compatibility and for the use case where want asyncify
support to be on by default for a given Qt build.

Enable asyncify for the asyncify_exec example.

Change-Id: I301fd7e2d3c0367532c886f4e34b23e1093646ad
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit f347682fd52fd8e94f15a06cda9f1a64ebc4d552)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-17 03:04:42 +00:00
Morten Sørvig
51997a110c wasm: remove dead qt_asyncify_yield() code
The call to this function was behind a broken #define and
was never enabled. It also does not work, so remove it.

This means that calling processEvents() in a loop (as opposed
to calling exec()) most likely does not work either, which
is something we want to revisit.

Change-Id: I90802a69d3a48e7f2b5d0b657d89452c09d9571a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 238e90cd58433ec79e82325d06fb75d9038b9607)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-17 03:04:42 +00:00
Michael Weghorn
858e08a101 a11y atspi: translate coords for GetOffsetAtPoint the right way
The coordinate type for "GetOffsetAtPoint" describes the
coordinate type of the input coordinates and
`QAccessibleTextInterface::offsetAtPoint` expects the
coordinates in screen coordinates.

Therefore, if window-relative coordinates are given,
the screen coordinates of the window need to be added
(not subtracted) to the window-relative coordinates of the point
in order to calculate the screen coordinates of the point.

Fixes: QTBUG-105281
Change-Id: I5517335c0c0d6a47b8c45c7e4f8f8b5a91f0fcd7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit fa0e24b641ad241195cab24d008fed6e68983944)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-17 03:04:42 +00:00
Michael Weghorn
3e12229c67 a11y atspi: Take dialog into account as top-level window
Since a dialog is also a top-level window, it should be taken
into account when trying to find the accessible's top-level
window, relative to which the position will be calulated for
`ATSPI_COORD_TYPE_WINDOW`.

Fixes: QTBUG-105042
Change-Id: I74fae096fd886bab04187c122f268c26c91b86ab
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 49c966bc8561d1ca71a97b83ae40852233630eb9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-17 03:04:42 +00:00
Jaroslaw Kubik
42d8fe6b10 Provide a native interface instance in minimal platform plugin
The minimal platform plugin does not have any native APIs it could offer
through that interface, but needs to provide an instance anyway. A lot
of code within Qt assumes that a native interface is always available
and does not check the pointer value, which leads to segfaults when used
with the minimal plugin.

Change-Id: I625bd95afd49872cff3a34b29ceb0ffbbcd39db7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit e16f74247958329263b59fe1b9ad8bd2a25de564)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-17 03:04:42 +00:00
Michael Weghorn
c8268beef4 a11y atspi: Fix incorrect use of x instead of y position
Fixes: QTBUG-105031
Change-Id: I26fcbfbd5a90982b87dda89b2880efe937f099d8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit d40dacf5f4697a57314ec77709e4551977d97c29)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-17 03:04:42 +00:00
Alexandru Croitor
c810c93018 qmake: Fix tool paths generated for androiddeployqt json file
They should contain the executable suffix .exe when
androiddeployqt is run on Windows, because androiddeployqt does not
add the suffix itself when the tool paths read from the json file.

Amends 4fc14b19336531c96f5883ff4b06f9af1ddaa30d
Amends 176136ce60f22ac14335b92aaa473e53b9022bc1

Fixes: QTBUG-105133
Fixes: QTCREATORBUG-27868
Change-Id: I8c5bac2fa6c82d122f8a70c5ff2a561298327a34
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 64b84977eb281363bb096d602c0706b299b2d926)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-17 03:04:42 +00:00
Thiago Macieira
6676b7ca69 QSemaphore: Fix warnings about shift exceeding size on 32-bit
error: right shift count >= width of type [-Werror=shift-count-overflow]

Fixes: QTBUG-105687
Change-Id: Ic6547f8247454b47baa8fffd170bd9cd0e2a8ca3
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 1022922037e794f3687d7c58f8b2caa44343a43b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-17 03:04:42 +00:00
Thiago Macieira
5bf5159011 qdbusxml2cpp: be consistent in the annotation suggestion
Some lines were suggesting the method name as context, while most of the
others were the parameter or property name.

Change-Id: Ie4bb662dcb274440ab8bfffd1709c0a71abc27dc
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 478b1afbe1544a5c88d26d714ea6307cdcba3bb1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-17 03:04:42 +00:00
Tor Arne Vestbø
bd712d5195 Rename QPlatformFontDatabase::handleAvailableFontsChanged()
The function name was easy to mistake for a function you should call
after adding fonts via e.g. registerFont or registerFontFamily, but
in reality it's meant to be used when the platform font database
knows that fonts have changed in a way that needs a full populate.

Change-Id: I4a897944aaa5df891562f729440b5d98b54f61e0
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit ed631011faab42071f5e4fd4ea978ec0a95b4633)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-17 03:04:41 +00:00
Alexandru Croitor
cfdf9a19bf qmake: Fix non-Xcode asset catalog handling for iOS simulator
If an iOS project was built with qmake using the Makefile generator
instead of the Xcode generator,
so -spec macx-ios-clang, and not -spec macx-xcode,

Asset catalog processing failed with an actool error like
 Unknown platform: "ios-simulator"

This is because we used the deployment identifier (which is meant for
creation of the -mios-simulator-version-min flag) to pass a value
to actool's -platform option, rather than the sdk name.

Introduce a new variable called platform_identifier, which will be set
to the currently processed macOS/iOS sdk name (e.g. macosx,
iphonesimulator, iphoneos).

Use it when processing asset catalogs using the Makefile generator.

Relates to 9daeb6fe9d35b10ed739ea0a0566533524ffd532
Amends 5574aa986b69277881fe5fc694d97514c668024f

Fixes: QTBUG-102053
Change-Id: Ic4ea3b9e11c21ae535d6544cbed3670f9db44e72
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit e38956e4f754ef8faa2ee4e76b787d71c773dcdb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-16 20:43:39 +00:00
Mikolaj Boc
c5dd7efdfc Improve window dragging on WASM
Window dragging has been considerably improved by replacing the mouse
events by pointer events and placing a pointer lock on WASM canvas, so
that off-browser window events are delivered to us.

Translation of the drag origin has been limited to inside the canvas, so
that a window cannot be dragged so far that it becomes offscreen and is
unreachable.

Change-Id: Id177c630a6466f04464a513371d6b97d3a098b6a
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit 5a4e5c62af0d462e0c26d691d3971e82f3241f4b)
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-08-16 13:47:51 +02:00
Edward Welbourne
a5754b484c Include current test name in crash reports
Previously a crashing test's output would end with the last completed
test's output followed by a crash report, leading readers
(understandably enough) to conclude that the last-named test is the
one that crashed. In fact the crashing test is typically the next one
in the class definition.

Include the current test function's name (when non-null) in the output
accompanying crash logs. This always goes to stderr so does not show
up in the expected output.

Conflict resolved: dev has changed some uses of printf(...) to
fprintf(stderr, ...), so apply to the printf() calls the same
transformation as the fprintf() ones got on dev.

Change-Id: Icab0ccd1fe434827ee92459ab0c97f9dc034754e
Reviewed-by: Jason McDonald <macadder1@gmail.com>
(cherry picked from commit f9b58b5c14518e5fcad634a3dae91b47f3068190)
2022-08-16 10:52:04 +02:00
Sze Howe Koh
69676296b2 Fix ignored name filter in QFileDialog::getOpenFileContent()
Fixes: QTBUG-104948
Change-Id: I83a565bfe604472fcdeb8757464e0e350da5d766
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 709ca8212ec2b8c4bd2d7acea04e5a70fcec3c2d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-16 01:35:26 +00:00
Tor Arne Vestbø
0ae7128102 cmake: Pick up project and target version when setting bundle versions
And update the default version number to 1.0, which more closely matches
the Xcode default.

Change-Id: I2cd785fffe8b960e5fa5db4803eaeee10791b7aa
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit e1b140fc5dc706a022c8170e33aee9edf64f9ead)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-08-16 03:35:26 +02:00
Tor Arne Vestbø
49edec3888 CMake: Override simulator architecture to x86_64 for Xcode generator
The simulator build of Qt for iOS is currently x86_64 only, instead
of universal builds with an arm64 slice as well, since we don't
support xcframeworks. This means we can't rely on Xcode's default
simulator arch settings, which on an Apple Silicon Mac will be
arm64.

Instead we override the simulator arch, like we do for qmake.

Change-Id: I8b52389db1b83f4f9679c724bcde53b44dbc76f1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 6ec21881dd68dfd88dee03b11036c3c862ccbbab)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-08-15 23:45:22 +02:00
Tor Arne Vestbø
dc00cffa8a macOS: Ignore deprecation for ReleaseIconRef
There's no good replacement yet for our use of GetIconRef
and ReleaseIconRef, so for now ignore the deprecation.

Change-Id: Iffcaa2af3c9e2ee053303a2272e8874913dd74d4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 7fc4bcd0f3e44f6335b94f13b75e43ea212b2be1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-15 21:44:37 +00:00
Tor Arne Vestbø
8d4411b8ec Remove unneeded @available check for macOS <= 10.14 and iOS <= 13
All versions down to Qt 6.2 require macOS 10.14 or iOS 13.

Change-Id: I5048921ea5a149346a0fa84228227d9156004675
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 1e97a44e765a61305f3d8ffbca5d33c05008744c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-08-15 21:05:29 +02:00
Tor Arne Vestbø
2c35ba6a36 darwin: Remove unneeded SDK version checks for older versions
All versions down to 6.2 require at least Xcode 12, which ships with
the macOS 11 SDK, and iOS 14 SDK.

Change-Id: I128321ec9e97b670b7c027f1233978e1b8856f88
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit eb774dfc7b3e4cbaeab41f345612ae079361141b)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-08-15 21:05:29 +02:00
Mikolaj Boc
1a836a2abd Fix losing grip on dragged window on WASM
When a window is being dragged, we should not check for the target
window's resizability in QWasmCompositor::processMouse as:
1) the target window under the cursor might be different from the
dragged window when the pointer is moving quickly
2) we have checked that already when qualifying the window for dragging
when handling EMSCRIPTEN_EVENT_MOUSEDOWN at line 1022

Therefore, the condition for target window's resizability has been
removed.

Change-Id: Ib999d213f1e0a770fa76324fc7bf44c6d4ab806a
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit a7e187cf1631e0f5434c09c4c398a7c4ef138593)
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-08-15 21:05:28 +02:00
Tor Arne Vestbø
bc1ef19c11 cmake: Share most finalizers between macOS and iOS apps
The macOS app code path was missing a bunch of finalizers that also
makes sense for macOS apps.

Change-Id: I2b779a1d64086824f43e304f2c7d3b1cd2780070
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit d5580aa7194b84306da52efb189cf126dbaee1f7)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-08-15 19:05:28 +00:00
Tor Arne Vestbø
e59b9ea4db cmake: Set CURRENT_PROJECT_VERSION and MARKETING_VERSION for Xcode projects
This provides a better user-experience, as the two settings have
dedicated fields in the project UI, and matches how new projects
are generated by Xcode itself.

Change-Id: I23acc7c6506f1818ef4a90f6f595bc449f83c57b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 25d27de126a3dfa4cd53b9ecc061c131ab29abce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-15 19:05:28 +00:00
Mikolaj Boc
649b1774a1 Make wasm finalizers work for standalone tests and other repos
The wasm helpers file is not included in QtBuild and is thus not visible
when standalone tests or other repos are being built. This fixes it.

Amends 1f9c1f032c5d8af2c6758081eb8de076fe678b53

Fixes: QTBUG-105615
Change-Id: I6c9229e1f259fa5043d7d11b8ee0293e26077f3e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 644ae42e12feb0056385ddb28f444e72107c9dc7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-15 19:05:28 +00:00
Eskil Abrahamsen Blomfeldt
cb9eb8e8fd Fix QFontDatabase::hasFamily() for ambiguous families
If a font family has several instances from different foundries,
we disambiguate this by adding the foundry name in brackets behind
the family. But QFontDatabase::hasFamily() would only check for
families().contains(familyName). So if the database contains e.g.
Foo [Bar] and Foo [Baz] then a check for hasFamily("Foo") would
fail.

So we need to actually check for the family name instead. In
doing this, we also skip the extra step of building the list
and then searching it, but just go directly to the source.

This removes the BLACKLISTing of Ubuntu and also introduces a
QSKIP on Unix-based platforms without fontconfig, since there
is no way to know which default fonts are acceptable on those
platforms.

Fixes: QTBUG-86967
Change-Id: Id8ad80a1671daf1c14fbad8bb8f4c51ee1c59709
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 360f1547f70fd5752a3a44892bfe5009a4357f3c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-15 19:05:28 +00:00
Laszlo Agocs
4f4dbbac78 vkkhrdisplay: Silence validation complaints about presentation support
Zero reason to do this query, but the validation layer complains otherwise.

Fixes: QTBUG-105527
Change-Id: I7a72e4d6d89f41279db94efe663a696302f05ded
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit dea9ed7e4c688ce073deb4b15cc64587598a32df)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-15 16:19:16 +00:00
Edward Welbourne
09268a5702 Fix initialization of QDateEdit and QTimeEdit
Since 6.3 these use Qt::UTC as time-spec but I neglected to take that
into account in QDateTimeEditPrivate::init()'s construction of a
QDateTime from the QDate or QTime. This amends
commit c00ee2f31013e99c79b820a0db57003c110a5510.

Fixes: QTBUG-105322
Change-Id: I11dec9808a54cf7da401b1734a9a2812f5fd2e63
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 607c5a90c5c575be6ef7755d7e48e37dded2f74e)
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2022-08-15 18:19:16 +02:00
Edward Welbourne
7af7683622 Fix handling of invalid input to Q(Date|Time)Edit constructors
Change to match how QDateTimeEdit()'s overloads taking a QDate or
QTime work, substituting a default value in place of an invalid one.
This fixes one surprising anomaly in a recently-extended test, so that
it now only fails the way I expected.

Task-number: QTBUG-105322
Change-Id: Ied4da6160b7efe70990f956798fb826b5b36d8bb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit a46a426b43309c5585bcb8891dd77ac1ab92ff09)
2022-08-15 18:19:16 +02:00
Edward Welbourne
f02b132eaa Expand QDateTime edit constructor tests to cover Q(Date|Time)Edit
The constructor_qdate() and constructor_qtime() tests only tested
QDateTimeEdit with a QDate or QTime. Extend them to also test
QDateEdit and QTimeEdit constructors, respectively. This revealed one
surprise; the QDateEdit constructor doesn't replace an invalid QDate
with the usual start-date, as the QDateTimeEdit does. It also serves
to reproduce a bug reported in Qt 6.3, see Task-number. These are
all marked XFail for now.

Adapted on cherry-picking to make the tests work with their old
columns rather than simplifying to a single column.

Task-number: QTBUG-105322
Change-Id: Ifafb40a9b78d9314b74ca9a1710d362b9a3cb18d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d1d43b231f4c7c5663cb49875c2e5876f352b564)
2022-08-15 18:19:16 +02:00
Alexandru Croitor
0fac2ae499 CMake: Enable public executable finalizers for iOS tests
This ensures that tests can be executed on the simulator or device, by
doing the necessary steps like setting a bundle identifier, Info.plist
file, launch screen, etc.

This is done by calling _qt_internal_finalize_executable in the
implementation of all internal test adding functions.

The finalizers are limited only to iOS for now, as an incremental
step, and to ensure we don't accidentally break tests on other
platforms.

At least WebAssembly uses its own finalizers which would likely cause
duplicate calls if the _qt_internal_finalize_executable was
unconditional.

Fixes: QTBUG-104754
Change-Id: I729d56385dd206b22c975fc2ce4e2c683e6e4e2c
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 6c9f4f5ebcd35dc1a68c442d9fbf3ec48f30baca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-15 16:19:15 +00:00
Alexandru Croitor
d5eae411bc CMake: Tests on iOS must be app bundles to be runnable
Task-number: QTBUG-104754
Change-Id: I05053d0f242f45e56e7a95ac75f5ef63ca8a5e0e
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit c76bf583504091f91f119135befdef0e02a5ddf5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-15 16:19:15 +00:00
Elias Hautala
15f15fa8db Sliders: Add function that changes widgets position on layout
Changes the layout to QGridLayout and adds function to change widgets
position on the layout depending on the windows aspect ratio. Before
this the widgets wouldn't fit on screen when using the example on
Android in portrait.

Fixes: QTCREATORBUG-27685
Change-Id: I00009cb6c8c250a8333ac3dfa635f70da4576d5e
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Jani Korteniemi <jani.korteniemi@qt.io>
(cherry picked from commit 1a6019438881b9aa54cfc8dbd3f8fc06ddc35d67)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-15 16:19:15 +00:00
Alexandru Croitor
807fd5684a CMake: Use the Xcode generator for qt-cmake-standalone-test on iOS
Task-number: QTBUG-104754
Change-Id: I43aae05f7e101a619d2c1b97d9a96c74d8498bfa
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 3608bb543d4a862a185ffba55043f736c42c9ace)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-15 16:19:15 +00:00
Mikolaj Boc
d65c618915 Refactor code focused around QWasmCompositor::processMouse
Refactoring of the logic around QWasmCompositor::processMouse has been
performed for readability and easier modification, in preparation for
further fixes for event delivery and handling in windows. There should
be no logic changes, just cleaner code.

Change groups:
Members of QWasmCompositor have been prefixed by m_ for easier discerning
of stateful and stateless variables in functions.

Variables renamed to more descriptive, e.g. window2->targetWindow,
globalPoint->targetPointInScreenCoords.

Magic numbers eliminated, e.g. mouseEvent->button == 0 is now
button == Qt::MouseButton::LeftButton.

Some common condition checks have been wrapped into single constants,
e.g. !(htmlWindow->m_windowState & Qt::WindowFullScreen) &&
!(htmlWindow->m_windowState & Qt::WindowMaximized) ==
isTargetWindowResizable

Some nested if-conditions were collapsed.

Some unnecessary checks have been moved to outer if conditions (e.g. for
draggedWindow in EMSCRIPTEN_EVENT_MOUSEMOVE, since the code would crash
anyway because only some parts are guarded against it being nullptr).

Consts introduced so that variables are only used for one purpose.

Made QWasmEventTranslator::translateMouseButton constexpr

Made QWasmWindow::isPointOnTitle behave correctly when the window has
no title bar so that no flag probing is needed prior to calling it.

Made QWasmCursor::setOverrideWasmCursor accept a const ref - having it
accept pointer suggested it might dangle.

Change-Id: I8910622fddad764ee86eb0260b5ad23c7ee7f97a
Reviewed-by: David Skoland <david.skoland@qt.io>
(cherry picked from commit ec58600cc923d6b7de5266e20e27d377fcc1540a)
2022-08-15 11:49:55 +02:00
Joerg Bornemann
d052236a2f CMake: Add QT_ANDROID_SIGN_AAB variable
[ChangeLog][CMake] Added the QT_ANDROID_SIGN_AAB variable that can be
set to ON to enable signing of .aab packages.

Fixes: QTBUG-105529
Change-Id: Ic06cc452851dc81b10a2721b544641cb5eeea8be
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 042290d0fb8ea99b2e6c6a5f17359ffc58222ded)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-15 07:15:42 +00:00
Marc Mutz
2b5b8395e1 QLocale: port findTag to std::string_view
QStringView lacks the equivalent of find_first_of, so use string_view
for now.

Fixes an unnecessary QString ctor/dtor call, as well as the
int/qsizetype mismatch, looking for which I found this code.

The function can now be properly noexcept.

Task-number: QTBUG-103531
Change-Id: I1198c082a2ee0addbe7c0d2192073b017d9f8dd7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 496b4294c90ed080ed5b83e1dd465f07652706ea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-15 00:10:46 +00:00
Kai Köhne
663e5259f5 Mark C++11/C++14 portability macros as deprecated
Fixes: QTBUG-105542
Change-Id: If99a47858c5b48a726ad323fba6bf871bfda37d0
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit b0576592555f08002d53d1ec78dc991b1a07e2ac)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-14 14:52:48 +00:00
Marc Mutz
f8bf0150ff Finish porting cross-platform parts of QStringConverter to qsizetype/size_t
There are still problems with platforms-specific APIs that are 32-bit
only (cf. QTBUG-105105), but this patch finishes the port of the
cross-platform parts of QStringConverter.

None of these changes have a user-visible effect. They just avoid the
Code Smell that int has become since Qt 6.0.

Task-number: QTBUG-103531
Change-Id: I267e2e1268a18c130892fa2fd80d1b5dabb3d9b9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 48c8072bb8862b442170687a9a5f8780332c39b5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-12 20:45:23 +00:00
Marc Mutz
1540857174 Port qt_readEscapedFormatString() to qsizetype
More of the usual missing int -> qsizetype porting...

Task-number: QTBUG-103531
Change-Id: I53faff5fe306c1d207741bc93a1e5c15d3eefa4f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 1aa00c993be4d7e27555bcd5c13f945766090b9c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-12 20:45:13 +00:00
Marc Mutz
da2092aef1 QStringConverter: add Q_CONSTINIT to function-level QBasicAtomic
Task-number: QTBUG-100486
Change-Id: Ia55b743fd7ad4716b82425410ed0cf9ff2ee30e8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit bd9c7048233e570fbda256fc903684c379421cd6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-12 20:45:08 +00:00
Marc Mutz
9f4f6ae2cb QTextBoundaryFinder: fix a flawed buffer size calculation
There were two problems:

1. The cast to uint truncates the input qsizetype bufferSize mod
   UINT_MAX, which, if the original value was qsizetype(UINT_MAX) + 1,
   would yield a false negative check, so remove the cast.

2. The multiplication of the input string size with
   sizeof(QCharAttributes) looks like it could overflow, esp. on
   32-bit platforms. It can't, because sizeof(QCharAttributes) == 1
   atm, but the next attribute that's added to the struct will turn
   that into sizeof 2, so play it safe and use division on the LHS
   instead of multiplication on the RHS to avoid this arithmetic 101
   antipattern.

Task-number: QTBUG-103531
Change-Id: Icae3bea1c3cb52a235b8aae181af35c86c3f5d6f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 3e1c6e74967e0c283655f4377a0e72efa551ddb0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-12 20:45:04 +00:00
Marc Mutz
7ad965b145 QUnicodeTools: mark a test-only flag constexpr/constinit
For QT_BUILD_INTERNAL, mark the flag constinit, because tests may want
to set it (which they better do before Qt spins up threads, because
otherwise this non-atomic flag runs into UB (data races)).

For non-QT_BUILD_INTERNAL, mark the flag constexpr, so dead code
elimination can do its job.

Inconsistently, of the two readers of the flag, one was ifdef'ed on
QT_BUILD_INTERNAL, while the other wasn't. Settle on exposing both,
which increases the compiler coverage of the code.

Task-number: QTBUG-100486
Task-number: QTBUG-100485
Change-Id: I6e041359b8214b40d80eefa92c26422aada3eb59
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 0c716c687a8c65e7907912d6d5d6beb891238a95)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-12 20:45:00 +00:00
Marc Mutz
f26c254feb QStringConverter: make a narrowing conversion explicit
Int variables are a code smell these days, so make the narrowing
conversion (from ptrdiff_t to int) explicit and add a comment.

Task-number: QTBUG-105105
Change-Id: Ia4e14f1cc132ca36d15e9684bfcb4605d7b9251f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit eb55e2980efc435f8728838910272e32287a841d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-12 20:44:56 +00:00
Marc Mutz
d31b750f4d QStringConverter: fix -Wc++20-compat
GCC 13 warns:

  qstringconverter_p.h:29:6: warning: identifier ‘char8_t’ is a keyword in C++20 [-Wc++20-compat]
     29 | enum char8_t : uchar {};

Fix by calling the replacement qchar8_t (and making it a typedef to
char8_t when the latter is available).

Change-Id: If59a9d55667bf1f5245e3a34189687995b000daa
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 42fbd063e24855df444f31e8c4b8ef25416d111c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-12 20:44:51 +00:00
Marc Mutz
c8218521a5 QLocale: port locale_data indexing to qsizetype
Not a bug, just porting to avoid the next reader having to wonder
whether the ints and uints are 64-bit safe.

As a drive-by, make a static variable constexpr and replace sizeof
foo/sizeof *foo with q20::ssize(foo).

Task-number: QTBUG-103531
Change-Id: Iccc5a5896ab87981f4535820cea7f274e568f325
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 013574a5fdb7538acad1a9a5d8449efe62d868e9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-12 18:32:53 +00:00
Marc Mutz
de46f4aed2 QChar: replace uint with char32_t in the implementation
Finishes the port from uint to char32_t started in Qt 5.

Task-number: QTBUG-103531
Change-Id: I97c29deb30a9a4563e2eafdb25e1f290a079726f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit bbcdee2afa99f8b5e436197a99b8a3fe5b41862f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-12 18:32:52 +00:00
Edward Welbourne
d90e38740d Fix DeferredFlag implementation for QTestEventLoop
As discovered in the expanded testing of QTRY_COMPARE() using the same
class, the timer needs a context object and a slot to call.
This amends commit 35ad157d88c7bfcb9b90b01111b0f43dd2e012d9

Task-number: QTBUG-104441
Change-Id: I41fc23de84ce8c7d6608db0005276a2071974494
Reviewed-by: Jason McDonald <macadder1@gmail.com>
(cherry picked from commit 45cbb1e31efab23294cd1a5e475986bd3ea9bb10)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-12 18:32:50 +00:00
Thiago Macieira
660014156d QMetaType: don't use global relocations to the lambdas and structures
The way the Qt 6.0 QMetaTypeInterface was designed, using a static
inline variable in a template, would normally require the linker and
dynamic linker to merge all copies and choose a single copy as the
official one. But because of hidden visibility and of Windows DLLs,
QMetaType already copes with multiple copies NOT getting merged. So we
may as well ask the linkers not to bother and use simpler, local
relocations to find those symbols.

They are all supposed to still be equivalent and it's an ODR violation
if they're not.

The Apple ld64 linker complains if you use this type of global
relocation:

 ld: warning: direct access in function
  [...]
   to global weak symbol
   'QtPrivate::QMetaTypeInterfaceWrapper<int>::metaType'

Fixes: QTBUG-93471
Change-Id: Id0fb9ab0089845ee8843fffd16f98a10aa719434
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 6234182d82b5f645a61c89219d71ab6a4ac03609)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-12 18:32:49 +00:00
Edward Welbourne
e9e5e549eb Test QTRY_COMPARE() and expand testing of QTRY_VERIFY*()
In the process, simplify the latter while adding some actual
time-variation for the QTRY_* loop to navigate round - based on the
extendedcompare test's ClassWithDeferredSetter. Testing remains
primitive, but is at least a bit more thorough.

Change-Id: I40be8fb485f3f18f0a4f4bc62ad36cccac691979
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Jason McDonald <macadder1@gmail.com>
(cherry picked from commit 54bcefb25c8050b8a3ce9e5afb9fd70d9dff5bca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-12 18:32:48 +00:00
Marc Mutz
d4f4bc6c6e QLocale: fix UB in defaultIndex() (using < on unrelated pointers)
It's undefined behavior to compare pointers with <, >, <=, >=, unless
they point into the same subobject (or one past the last element, for
arrays). The Q_ASSERT() should detect UB. For that, it mustn't cause
UB itself.

Fix by using q_points_into_range(), which uses std::less, which is
guaranteed to define a total order on pointer values.

Change-Id: I725eb9e4a9304d2edcd0776e756e6a67e224c1a7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 62aec32dfa27867e693f13976c4e3a3df11805d1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-12 18:32:44 +00:00
Thiago Macieira
9e92dd2034 QMetaType: add a test to confirm that types are equal across libraries
Because of the template shenanigans. This is just to make sure.

Change-Id: Id0fb9ab0089845ee8843fffd16f989e7d555894f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 985e24dd5f1e0b148a79b0c5f9459233cf03dba4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-12 18:32:42 +00:00
Marc Mutz
00afad6e70 QString: finish migration to qsizetype
These don't look like they could cause bugs, because their range of
values is physically limited, but port them to qsizetype nonetheless,
for consistency, and to save the next reader the task of proving that
they're, indeed, ok.

Task-number: QTBUG-103531
Change-Id: I337ea327b54bcf5960928f5d1d72c6fc80dcda31
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit cd0f6968916739795b47597b1e00ea87d577fa15)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-12 18:32:41 +00:00
Laszlo Agocs
c514812aaf Be more graceful when objects die by the time the dnd loop exits
The main issue fixed in 7f23dd963536eb8123ee4c5c22bf43b6f866d008 can
manifest in another form on platforms where QBasicDrag is used (xcb).

Make sure that we recognize if an object (e.g. a QWidgetWindow) is
destroyed by the time the nested event loop exits.

Task-number: QTBUG-104596
Change-Id: Ib82dd8230cb6f13d804bd992234b2a3ce85a7061
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 742ae9ea1cadbb438e2d02bb58ae900c676dc41c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-12 16:25:04 +00:00
Alexandru Croitor
fe6f7de8ce CMake: Improve tool not found error message
Change-Id: I7f04e4af80c4d23b855c8c9d5f5017f8afb112ea
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit e671b852e70b5ed960ab2a4286aabb458e39df40)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-12 16:18:35 +00:00
Marc Mutz
a04981505e QString: fix arg() for >2Gi repeated lowest-escape-sequence-numbers
Building on 15a80cf8a9d59203f8e2b436a5c804197c044807, this patch fixes
the case where there are more than INT_MAX occurrences of the
lowest-escape-sequence number, as in

   QString("%0").repeated(qsizetype(INT_MAX) + 1).arg(42);

by replacing the corresponding int variables with qsizetype ones.

Task-number: QTBUG-103531
Change-Id: I6f4593a86d8d605031bc1d6520a247676091b2c2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 32c0d32a4fef615a717d4950361dce361fc1e08b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-12 00:42:36 +00:00
Lorn Potter
6b2af05f27 wasm: allow apps to override EXPORT_RUNTIME_METHODS
Developers can add to Emscripten's EXPORT_RUNTIME_METHODS
by defining their own using:
QT_WASM_EXTRA_EXPORTED_METHODS

Which will add on to Qt's default exported runtime methods
of UTF16ToString,stringToUTF16

for cmake:
set_target_properties(<target> PROPERTIES QT_WASM_EXTRA_EXPORTED_METHODS "ccall,cwrap")
or
set(QT_WASM_EXTRA_EXPORTED_METHODS "ccall,cwrap")

for qmake:
QT_WASM_EXTRA_EXPORTED_METHODS = ccall,cwrap

Done-with: Mikolaj Boc
Fixes: QTBUG-104882
Change-Id: I9678bdb7b077aaa8527057212ea4e161c0be0b60
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 1f9c1f032c5d8af2c6758081eb8de076fe678b53)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-12 00:14:00 +00:00
Marc Mutz
4729163507 QUnicodeTools: fix types used around th_brk()
Libthai's th_brk() takes the breakpoints array lengths as size_t, so
use that.

This still doesn't fix thaiAssignAttributes() for ≥ 2 Gi characters,
because th_brk returns break positions in an array of int, thus
limiting any results to the first INT_MAX characters. Created
QTBUG-105541 to track this.

Task-number: QTBUG-103531
Change-Id: Iba468cc9389f4533401bc18dd326c4ca7e85a5da
Reviewed-by: Lars Knoll <lars.knoll@gmail.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 50d1a8a3770df7ada3ef558db449c758444234bf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-11 18:44:42 +00:00
Marc Mutz
aa417c6c6a QUnicodeTools: fix truncation in debug statements
Instead of casting to int, cast to qlonglong, which is guaranteed to
be able to hold all qsizetype values.

Task-number: QTBUG-103531
Change-Id: I3e89892defd091fa6ef305b8ed5c3819a2cc13da
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 8dbc569538da7011d3c2c7099abe8069ed3db68f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-11 18:44:40 +00:00
Marc Mutz
b78ef8b437 [docs] Fix return value of QStringIterator::next()
It's char32_t these days, not uint.

Task-number: QTBUG-103531
Change-Id: Iaa03f97d0d1266a6763eb858edb45ae0f2a4729d
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit a8e6a0e546a6a90ff2daee79c3cf504b7160cb86)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-11 18:44:37 +00:00
Marc Mutz
859a626ccf QUnicodeTools: fix data race in initialization of libthai symbols
The facilities of qunicodetools.cpp are not limited to the GUI thread,
so initialization must be thread-safe.

The old code wasn't, though, and contained several data races

- non-atomic initialized was read while another thead may write it
- th_brk and th_next_cell were read while another thead may write them

Fix by using Double-Checked Locking. This also prepares the code for
an eventual port to th_brk_find_breaks() (th_brk is deprecated).

The function pointers don't need to be atomic, because all reads from
them are guaranteed to happen-after the writes to them (as long as all
users call init_libthai() and don't proceeed if it returns false; this
could be ensured by returning a struct with the function pointers from
init_libthai() instead of maintaining them as statically-visible
globals, but that's outsize the scope of this patch).

As a drive-by, remove a pointless static_cast<int>(~~int expression~~).

Fixes: QTBUG-105543
Change-Id: I492acd7e9a257e5c4b91f576e9bc448b6bb96ad1
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@gmail.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 7d021e3173a03d384ac4b987545f8fdf52593a61)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-11 18:44:35 +00:00
Marc Mutz
4bfce80f1d QUnicodeTools: fix types used around th_next_cell
Libthai's th_next_cell takes and returns lengths as size_t.

- pass size_t, not qsizetype (the value can never be negative)
- receive size_t, don't cast to uint

As a drive-by, scope variables tighter.

Task-number: QTBUG-103531
Change-Id: Ib1eeb1f0e8974ee8b0f88d080d06136b307c324f
Reviewed-by: Lars Knoll <lars.knoll@gmail.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit ea1e005cb18cbd4fe9ceda725aac47bbfb068389)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-11 18:44:28 +00:00
Andy Nichols
a1e6c79cd4 RHI: Take advantage of Apple GPU specific features when available
Change-Id: Ie59405bd8cf235086f7e9a675270ed25beb8aedc
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 4cf30d8c1b351d9d1f495913493250d8fc3e51e1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-11 13:38:37 +00:00
Assam Boudjelthia
38263bab26 Android: handle quoted args passed to an app
Currently, arguments passed to the app through applicationArguments
extra bundle treat every space as an argument separator. This then
doesn't handle the case where an argument is a space separated quoted
multi-word. This is more apparent when androidtestrunner is passing
test arguments to the app where an argument can be a test case with
a data tag that contains a space, which then is treated as two separate
tag names.

This change makes sure that androidtestrunner quotes each argument,
and the app doesn't split the arguments list by spaces, but rather
passed the argument string directly to c++ where
QProcess::splitCommand() is used to get the correct set of arguments
that will be passed to main().

Task-number: QTBUG-104730
Change-Id: I45d8ca979d90f2a383c84623f0eb2eec29bba727
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit edc024e826d41a98cb7779e9834e83d7ea5da171)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-11 13:38:37 +00:00
Friedemann Kleint
5577d934c5 Documentation: Fix "Using Model Indexes" in Model View Programming guide to work
The code introduced by 54d5ca0c2766e915c960fa437cee6c20a324c1a7
did not work since the variables parentIndex/numRows
were local to the lambda and the outer code would not wait.
Move the widgets population into the lambda to fix this.

Modernize the remaining code a bit.

Change-Id: I2a09878987df9edb9ff04f0ac4ad82af1a8b52c8
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit c49bf9fe27e0632aa8da393ff007cf4577a1c9cd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-11 10:18:16 +00:00
Giuseppe D'Angelo
6927221238 QTranslator: generalize a UNIX-only path
QTranslator builds a list of "candidate" names in order to find out
the translation file to load. Part of the name comes from the UI
languages, as determined by the QLocale object passed to load()
(via QLocale::uiLanguages()).

On UNIX this list of languages is processed by adding a lowercase
version of each language. In other words, if the list is something
like:

{"en-Latn-US", "en-US", "en"}

then it is changed to contain:

{"en-Latn-US", "en-latn-us", "en-US", "en-us", "en"}

(The last element is not needlessly duplicated, since it's already
fully lowercase.)

I am not sure why this is done only on UNIX: the commit introducing
this behavior predates public history. If I have to take a guess, it's
done because the language is then used to assemble a file name that
QTranslator tries to open. On UNIX file names are case sensitive, so
if the translation file is called "translations_en_us.qm" it would
fail to load under a "en-US" locale (the "-" -> "_" processing is done
later).

But what about Windows? In principle, turning the names in lowercase
is not necessary as Windows' filesystem is case insensitive; a
translation file called "translations_en_us.qm" will still be loaded
if opened as "translations_en_US.qm"...

... *except* if the file is in the resource system! In that case,
filesystem access is still case sensitive, and will fail to load the
translation file (which instead would load just fine on UNIX).

Plug this silly cross-platform difference by also lowercasing on
Windows.

Change-Id: I2573721e33d9da08f60a5bb56e35e4553cbe4efe
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit b779b8062cdeef5f2ac33c9164b5846780cfd495)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-10 23:35:19 +00:00
Ivan Solovev
a2334fd510 QtSql: establish removed_api.cpp for upcoming QT_SQL_REMOVED_SINCE
Change-Id: I6614ed13deee733e0cc53b3d8bb6514b2c000a9b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 62859ccaa666909c2db8ac4d0a46fa0f5163153f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-10 21:17:06 +00:00
Ivan Solovev
ec9a8c1925 QSqlQueryModel: guard the definition of deprecated method
... to prevent compilation errors when built with
QT_DISABLE_DEPRECATED_BEFORE >= 0x060200

This commit amends 14f9f00fdb2dc428610c08e3d9d03e38e9602166

Task-number: QTBUG-105048
Change-Id: I33c586508353ccb4c0af3f5da0cdaf9abe9f590e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 7ba39fff8d9d6c8b6d7629c599dd57d14a379cec)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-10 21:17:06 +00:00
Paul Wicking
e215d4d987 Doc: Remove repetition of word in text
While dropping the extra "does", rewrite as "doesn't"
as common contractions are preferable in particular in
negations. Reflow the remainder of the paragraph.

Fixes: QTBUG-105517
Change-Id: I1ad2d5ca753cb1d3a38cf96bdd6e52d2af80151b
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
(cherry picked from commit 998bd0b528760d320c56026c2dd96204ecfb3b5d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-10 21:17:06 +00:00
Joerg Bornemann
25ba921d50 CMake: Fix detection of system double-conversion
...if the double-conversion CMake package cannot be loaded.

The find_path call must specify the header exactly as it is included.

The select_library_configurations call always failed, because the
command expects the presence of DOUBLE_CONVERSIONS_LIBRARY_DEBUG,
DOUBLE_CONVERSIONS_LIBRARY_RELEASE, or both.

Upstream double-conversion's MSVC build system does not specify a naming
scheme for the debug build, and there are no debug/release binaries to
download that suggest a naming scheme.  Therefore we assume the usual
'd' suffix for the debug library like we do everywhere else.

Lastly, we need to set DOUBLE_CONVERSION_INCLUDE_DIRS.

Fixes: QTBUG-105501
Change-Id: I71ff5238f353541b8bf5ac6792b86134deba20d1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit a29af6656f1c33355c4cbfe8587b8f6eae691a21)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-10 21:17:06 +00:00
Alexandru Croitor
db169494bd CMake: Bail when configuring multiple configurations and plain Ninja
Previously configuration would not error out if you configured Qt
with -DCMAKE_CONFIGURATION_TYPES=RelWithDebInfo;Debug -GNinja
instead you would get an error like

 CMake Error at cmake/QtBaseConfigureTests.cmake:51 (message):
 Failed to find compiled architecture detection executable at
 qtbase/build/config.tests/arch/RelWithDebInfo/architecture_test.exe

Note that Qt code tries to find the arch test in a RelWithDebInfo
directory but due to using single-config Ninja,
CMAKE_CONFIGURATION_TYPES is ignored, and the executable is placed
in a non-config specific folder.

Error out early in such a case, and mention that for multi-config
builds, the Ninja Multi-Config generator should be used.

Change-Id: I0192185123be563671cbe154f968a03b7458e327
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 0ce5c0a9969bc8c763ab50b6271e203c2bcb90de)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-10 21:17:06 +00:00
Fabian Kosmale
84b0e89d67 QSqlQuery: Do not use deleted constructor in docs
QVariant(QMetaType::Type) is deleted since Qt 5 (sic!). Suggest usage of
the constructor taking a meta-type instead.

Change-Id: I50949dac9dfc35c80108debdeabc791afe0998b6
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit 879d30394a41b7b7124fc8139e787a9bdbe0dfee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-10 16:56:15 +00:00
Sona Kurazyan
c1b836cb18 Remove redundant define for QT_LARGEFILE_SUPPORT
It's unconditionally set in qconfig.h by configure.cmake.

Change-Id: If10b5a34111856f4c279a1cf7bfc4ea3a995ef2b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 64ac64ba6bb2f70ab6aafb9af91b142a765956c7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-10 15:35:47 +00:00
Tor Arne Vestbø
1311870125 macOS: Distinguish between return and enter when inserting newlines
In most situations the originating key event contains the information
we need, but during confirmation of input method composition the text
of the event might be "~\r", in which case the logic we have on macOS
for generating key events will interpret the key press as a tilde,
and we end up inserting "~~" and fail to deliver the return key.

We should probably treat NSEvents with characters > 1 as a special
case and go via the virtual key map in QAppleKeyMapper, but for now
we manually distinguish enter and return by looking at the modifiers.
This works for enter key presses both via the key itself, and via
Fn+Return.

Fixes: QTBUG-104774
Fixes: QTBUG-103473
Change-Id: I86d30b154867e8e2b6964967ede2bd0dadb83ef8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 6767ac20c972f0f2654076c22826c392e698edfc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-10 09:41:25 +00:00
Tor Arne Vestbø
a3c6755566 cmake: Don't reference global data in qt_internal_get_title_case
The only place the function was used was to generate the title case of
a target, so the issue wasn't spotted until now.

Change-Id: Iee66ecea569e7411c6b5a5e5312cde910a48fa01
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 3ad0f755f56eae4e8d94459f7cc17671e51e95da)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-10 09:41:25 +00:00
Tor Arne Vestbø
07043f2612 cmake: Work around bug in CMake's Xcode generator setting INSTALL_PATH
CMake will set the INSTALL_PATH for applications to an empty string,
which confuses Xcode and results in application archives that can't
be distributed on the App Store.

https://gitlab.kitware.com/cmake/cmake/-/issues/15183

Change-Id: Ie19f41c20fdca1e98b368e3ce4cc524c8df0b23b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit fef9e0e216d07d7e8a144f57a8ec4133ff94fac7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-10 09:41:25 +00:00
Tor Arne Vestbø
c8cdc3eb96 Windows: Account for not finding child windows when calling ChildWindowFromPointEx
The main code path of findPlatformWindowHelper had a check to verify
that the resulting child was not the parent HWND handle itself, but
the code path for handling QTBUG-40555 was missing this check, resulting
in infinite loops when the top level window was a transparent window.

We add the same kind of check to this code path, where neither the
hwnd out pointer or the result out pointer is updated. This is okey
since we return false and don't expect the function to continue
iterating based on an updated hwnd pointer.

Ideally the iteration logic should be moved into findPlatformWindowHelper
instead of having the outer loop outside of the function, but that's
left for another day.

Fixes: QTBUG-103571
Change-Id: I9465253bca52bebf9137b24d7ce36646553d8d39
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit cb51ab41e89516031abb2cf704cc22a376c21ef0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-10 09:41:24 +00:00
Tor Arne Vestbø
1d8e144b6a Disable bitcode for iOS
It's deprecated as of Xcode 14, and generates a warning message if a
project explicitly enables bitcode. The App Store no longer accepts
bitcode submissions from Xcode 14.

Change-Id: Ib1f9d5114ca4d8b1845ecc7a9de0473ee015db33
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit e27a0d5a0f8818653ff125409db8187454409749)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-08-10 09:41:24 +00:00
Lu YaNing
95fdc63a99 QIcon: remove icon from cache if the cached engine fails to load
An icon that is not null by the time it is inserted in the cache can
become null, depending on the QIconEngine implementation.

For example, when an application with a shortcut exists on the desktop,
uninstall the application, and then install the application again, the
acquisition of the application icon will fail. The reason is that after
installing the application for the second time, the qtIconCache will not
be updated when the icon is acquired.

Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io>
Change-Id: I6dc8cf435815b92da270d74fe992843336af23e2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9e7c5670509ac81efdf78b691e70e5ce3d408a09)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-10 09:41:24 +00:00
Joerg Bornemann
cebcabc5af Doc: Document the .base modifier for qmake resources
Change-Id: If8484e9bcf0aa7f0f59102b7b0120defdcd7b3fb
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 4d68db43e6634b71e88085df8d57746b33ad7846)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-10 09:41:24 +00:00
Joerg Bornemann
628d2c8108 Remove cmake/FindCups.cmake
All supported CMake versions provide this file, and we did not modify
it.

Change-Id: I4b21a99159ba8315491dc64ab737b7e5a28a6966
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit d405713647da23b8d218c097fb4f2457d853c669)
2022-08-10 11:41:24 +02:00
Eskil Abrahamsen Blomfeldt
7aa31947cf Wayland: Remove XFAIL after underlying bug was fixed
The intialSize bug has been fixed in Qt Wayland Client, and thus
this test will now start XPASSing.

Task-number: QTBUG-66818
Change-Id: I4b9cb8bd9306a67f04295eb23f09574dad0e97f7
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
(cherry picked from commit f49d35084c90aeec910cb6f37aeceba8c4194ca5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-10 07:06:20 +00:00
Paul Wicking
995572a3ab Doc: Drop parentheses around \since command
The closing parenthesis ends up in the output.
As the fix to QDoc is rather involved, clean up the docs
to fix the symptom.

Fixes: QTBUG-105339
Change-Id: I35a1e7615125781d950649213c08e5760b0235e7
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
(cherry picked from commit 1a825d884907c7c30064b655bc1dda76d5009d87)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-10 04:17:07 +00:00
Thiago Macieira
28ab5fd54d QGraphicsScene::render: fix int/qsizetype mismatch
Also suppresses the warning that we may be trying to allocate -1 items
in call to new[].

Task-number: QTBUG-105388
Task-number: QTBUG-105471
Change-Id: Ie4bb662dcb274440ab8bfffd17096d3606354647
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 70d040fa1abb5c195643a9e2c5d8681ba1ea54c9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-09 08:11:04 +00:00
Thiago Macieira
4ddba5939c QDBusMetaObjectGenerator: use qsizetype for counting things
Even though the meta object format stores 32-bit integers, which means
we can't have anywhere near 2 billion properties, methods, method
parameters, etc. This suppresses the warning that we may be trying to
allocate a negative amount of data in

qdbusmetaobject.cpp:438:60: warning: argument 1 value ‘18446744073709551615’ exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]

Task-number: QTBUG-105388
Task-number: QTBUG-103548
Change-Id: Ie4bb662dcb274440ab8bfffd17096df93614be8e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 68eb0e673ce43dc25b479932aedc98aff1b727e3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-09 08:11:03 +00:00
Ivan Solovev
0d29ebc2f5 Fix QT6_CALL_NEW_OVERLOAD_TAIL
There was a typo in the used macro name.

This commit amends 0a3ff697380555538a0d035b768ddf10f772b55a

Change-Id: I6b8cb1e3872cb96780af26bfaf722d83d17ba4fe
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b5e2607a6dae335ebbd0fc4b053de8b3fe460894)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-09 08:11:03 +00:00
Friedemann Kleint
002796928b Polish the model/view tutorial examples
- Reorder the class declarations, moving private sections last
- Make constructors explicit
- Add space to the comments
- Introduce auto
- Replace slot MainWindow::showWindowTitle() by a direct
  connection to slot QWidget::setWindowTitle().

Change-Id: Ic229162434dfef5f2767d0b4e186759ca0f821f3
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 8751ca3daeaa2a500a37b070cdcce5a5bb7a165f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-09 05:34:33 +00:00
Edward Welbourne
78a5890355 Add some testing of QTestEventLoop
Fairly minimal for now, just enough to verify a bug and serve as the
sign of success when it's fixed. Tests fail in ways they shouldn't,
for now; see expected_eventloop.* for details, notably "Earlier test
failed to clean up" messages.

Task-number: QTBUG-104441
Change-Id: I59be4aa5f21fed23b19a0593a8c2f6c9956507df
Reviewed-by: Jason McDonald <macadder1@gmail.com>
(cherry picked from commit 35ad157d88c7bfcb9b90b01111b0f43dd2e012d9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-08 18:49:13 +00:00
Edward Welbourne
590d01c36c Don't skip QDoubleConverter's digit-count check for non-whole bound
Using convertDoubleTo() to get a whole number, from which to determine
the number of digits we're allowed before the fractional part, fails
if the double isn't a whole number, which lead to the skip being
checked. Use qFloor() of the double (as this should have as many
digits as the double had before its decimal point, which is what we
care about; qCeil() might round up to a power of ten).

This amends commit ff6d2cb0d5779d81e89d94d65c8d164602fa2567

Fixes: QTBUG-105341
Change-Id: I4e0105d4602682c59e9830ec9a37556c96db884e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit a79de46ac59e045fbbbb8e0490ea6981b041be73)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-08 17:48:03 +00:00
Janne Juntunen
02163f6b11 tst_qimage: skip exifReadComments when the feature is not active
We need to skip the exifReadComments test case if reading text from
image has been configured off, like in webOS's Yocto recipe for QtBase.

Fixes: QTBUG-105393
Change-Id: If45872ca7ed26620fa38bc6b47132363d661acdc
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit dfaefa6c5e3ed360e97101a7bc750ee0a46114f4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-08 17:48:03 +00:00
Richard Moe Gustavsen
5f953d02d4 iOS: ensure we close inputpanel after clearing focusobject
Change 7f72622c0f caused a regression where the input panel
would not close automatically when the focus object was
cleared. The reason is that it's apparently not enough to
just release the first responder, we also need to
explicitly tell it to release it's first responder status.
Before the failing patch, we did this from within update().
This patch will instead/in addition do an extra check from
inside reset().

Fixes: QTBUG-105323
Change-Id: I00bdd44fe54db69f44232226291e3c5715935749
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit e2e4428f0ffa79a032f56812dd89f0b8b8af63f9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-08 17:48:03 +00:00
Mårten Nordheim
5358cdd0bc QNetworkInformation: Add missing \since marker
The new name was introduced in 6.4, but the documentation stayed the
same since it was initially written.

Amends 8367be8ede233245f1c11ed1291c02afcdb0750e

Change-Id: Idb27b551760f0d0cb41220be18a4d87e5875baae
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 2a17034ddc513870bda49e5d76cb0b1bf358c754)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-08 17:48:03 +00:00
Elias Hautala
ba33df8fcd Basiclayouts: Add scrolling to example
Adds scrolling to basic layouts example because the user interface in
the example doesn't fit properly on smaller screen sizes.

Fixes: QTCREATORBUG-27634
Change-Id: I61e6eac2b28e5b3ff0f984894fe38167b3f46a9c
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Markku Nokkala <markku.nokkala@qt.io>
(cherry picked from commit 89ce9a1c5a29e3f420931baa88c705856b99ac25)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-08 17:48:02 +00:00
Eskil Abrahamsen Blomfeldt
fed79f4802 Freetype: Fix underline thickness for bitmap fonts
For non-scalable fonts, we calculate the underline thickness
based on the font size. To make the lines slightly thicker
for bold fonts, we also multiply a fraction of the weight of
the font into it. In Qt 6, however, the weight scale was
multiplied by 10, but the formula was not updated, hence
all underlines for bitmap fonts would be 10x too thick.

Fixes: QTBUG-105010
Change-Id: I108baed495048783b14afca6bd4c67dc83816c17
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
(cherry picked from commit 6fa2ce92af914d8fd6ab1fc32316b14bbae0bed0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-08 17:48:02 +00:00
Fabian Kosmale
2ebdf562b9 QProperty: Notify observers even when dependency is gone
Problem description:
--------------------
Assume we have two properties, P1 and P2. Assume further that we assign
a binding to P2, so that it depends on P1. Let the binding additionally
capture some (non-QProperty) boolean, and only create the dependency to
P1 if the boolean is true.

The state afterwards is
P1:[p1vaue|firstObserver]
                      |
                      |
                      v
                ---[p2binding]
	       /
P2:[p2value|binding]

If the boolean is set to false, and P1 changes its value, we still
correctly re-evaluate the binding and update P2's value. However, during
binding evaluation we will notice that there is no further dependency
from P2 on P1, and remove its observer.

The state afterwards is
P1:[p1vaue|firstObserver=nullptr]

                ---[p2binding]
	       /
P2:[p2value|binding]

Then, during the notify phase, we traverse the observer's again,
starting from P1's firstObserver. Given that it is nullptr now, we never
reach P2's binding, and thus won't send a notification from it.

Fix:
----

We store a list of all visited binding-observers (in a QVarLengthArray,
to avoid allocations as long as possible). After the binding evaluation
phase, we then use that list to send notifications from every binding
that we visited. As we already have a list of all bindings, we no longer
need to recurse on binding-observes during the notification process;
instead, we only need to deal with static callbacks and ChangeHandlers.

The pre-existing notification logic is still kept for the grouped update
case, where we already have a list of all delayed properties, and should
therefore not encounter the same issue. Unifying its codepath with the
existing logic is left as an exercise for a later patch.

Fixes: QTBUG-105204
Task-number: QTBUG-104982
Change-Id: I2951f7d9597f4da0b8560a64dfb834f7ad86e757
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit f1b1773d0ae636fa9afa36224ba17566484af3cc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-08 14:25:07 +00:00
Marc Mutz
3e8530d701 qputenv: defend against non-NUL-terminated QByteArray values
The old code assumed that a QByteArray's data() is always
NUL-terminated. Due to the conflation of owners and non-owners in
QByteArray (but also in case we ever get efficient substringing), this
is not always the case, e.g. QByteArray::fromRawData() does not ensure
NUL-termination.

From QString::utf16(), we learn that the condition to check for is
QArrayData::isMutable(). After working around the fact that
QByteArray::data_ptr() doesn't exist for const QBAs and that empty
QBAs always refer to QByteArray::empty_, which is !isMutable(), we can
detect this situation and re-allocate without introducing new API.

This is the fix for Qt ≤ 6.4. For Qt 6.5, we'll port the function to
QByteArrayView.

Manual conflict resolutions:
  - tracked changes into qglobal.cpp (was: qenvionmentvariables.cpp)

Fixes: QTBUG-105302
Change-Id: I3416535ab09d601e0e87b2767f2c024ba1217e64
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 15422d191fb03eb9cafe68b24484d59c1270244c)
2022-08-08 09:39:41 +00:00
Liang Qi
1af74fffd0 tests: make xembed/qt-client-raster better
Change-Id: Id45bcfb92eb24c4455cf50497e28312eb87e0f9a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit cef9cbdd52d737ce6ff01d12770b38c02a0e331a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-06 09:36:13 +00:00
Liang Qi
1c27eaf9b8 tests: make xembed/qt-client-widget better
See also QX11EmbedWidget::QX11EmbedWidget() in src/gui/kernel/qx11embed_x11.cpp in qt4.

https: //github.com/qt/qt/blob/4.8/src/gui/kernel/qx11embed_x11.cpp#L475-L477

Change-Id: I47504a2d8f3e33c367f092d01ee5d7e1b16b5106
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit a0ec35d5f290ce07c591fb3f075390e592326d2a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-06 09:36:10 +00:00
Liang Qi
eaa755dbc9 tests: replace gtk-embedder.py with a gtk3 app
All linux CI machines have gtk3 installed. And Python GTK things
are too complicate to setup.

Change-Id: I3c0d967f61aebea508784df79569b9d0064f66e2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit aef55501bccd52f63a84228cb2ee201ec4f5c301)
Reviewed-by: Liang Qi <liang.qi@qt.io>
2022-08-06 11:36:07 +02:00
Marc Mutz
e0ad7fa80d QMetaType: don't create a registry just to query its emptiness [2/2]
The previous commit, b0e4d53b637e6c34457d14ed3f0be705098bf2f5, missed
this one. Same rationale as back then.

Change-Id: Ibad4c130e0d61c64808275fa7b97b58ebd479acc
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5f5c4598fed4b4bdd95271d1fee8a57fbd21d033)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-06 06:19:54 +00:00
Marc Mutz
21c6fdf6a1 QMetaType: make all atomic operations explicit
In one case, optimize away an unnecessary extra load.

Task-number: QTBUG-103834
Change-Id: Iabbf58a09627dd2fd7a40c713a878d74cb522d60
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f4b60a0850ea9f67338bfd22d0847f0f0db72255)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-06 06:19:46 +00:00
Marc Mutz
3ddcb2b33e QFixed: add implicit conversion from long long
This will come in handy when porting some GUI code to qsizetype.

Task-number: QTBUG-104818
Change-Id: I426a4f425ebd7a9fdc2d2bba97dae4c640ded97e
Reviewed-by: Lars Knoll <lars.knoll@gmail.com>
(cherry picked from commit 13764280b450c90ed65197d86cb8887d62fb13cc)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-05 22:01:36 +02:00
Timur Pocheptsov
bb07d03e2a macOS: Check m_platformWindow before processing key event after shortcut
Processing shortcut events may result in the window being deleted, so
we need to check if m_platformWindow is still valid before continuing
with the key press event.

Fixes: QTBUG-105160
Change-Id: I9cd362873b19c078a4fced3ac3c815d70bfc7fbe
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 6a5cadb9557ebac00b8ddacf623dc38baa716680)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-05 20:01:36 +00:00
Joerg Bornemann
33bc1a80d1 Doc: Fix return type of QLEInteger/QBEInteger post-in/decrement ops
Those operators return a value, not a reference.

Fixes: QTBUG-104940
Change-Id: I117892f12d20c6bf32a12f37c1bdfec1817614c6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d336cfba8ad740dc812b8987bc04fb9f6da80666)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-05 20:01:36 +00:00
Laszlo Agocs
f95a5ec4ce rhi: gl: Unify end/finish behavior
Issue a glFlush in endOffscreenFrame. This matches endFrame which
flushes either implicitly (swapBuffers) or explicitly with SkipPresent
(glFlush). This will then benefit producer-consumer setups where a
context renders into a texture using begin/endOffscreenFrame and then
the texture is consumed in another context.

In addition, make finish() issue a glFinish().

Change-Id: I0a3115255ad2ac82b730e26d1ca7e88377c5a28c
Reviewed-by: Piotr Srebrny <piotr.srebrny@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit cb139dbdb8d7ff1f9e9be24623697035677c9774)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-05 16:18:04 +00:00
Alexandru Croitor
9d5b0a77da CMake: Fix mockplugins test not to fail in a non-prefix build
Explicitly running the install step would fail in a non-prefix build.
Do it conditionally on the no_prefix feature.

Change-Id: I78cd63f51c499a0df451b08290c6dfc84e52666c
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 6423a657c7179e7e0f00c14dccc94b237b3160b8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-05 16:18:04 +00:00
Marc Mutz
b61de3163a Pull some processing out of environmentMutex critical sections
Move most string handling code out of the environmentMutex critical
sections to increase parallelism (Amdahl's Law).

I drew the line at temporarily dropping the mutex to allocate memory
for the return QByteArrays, as that would have meant to loop over
obtaining the size, allocating it, and then copying the data which
would have overly complicated the code.

Change-Id: I980cbf7fda76fc8057f84b2539b4a299e06cae82
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 0beb58cf58968acca84bf5f612288fe9c09e5879)
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-08-05 18:18:04 +02:00
Marc Mutz
30e9cf6be0 Port qenvironmentvariables.cpp to qsizetype
I don't expect environments to allow values or names > 2 Gi
characters, so this is just for consistency (int is a code smell these
days).

As a drive-by, replace

   QString buffer;
   buffer.resize(n);

with

  QString buffer(n, Qt::Uninitialized);

Task-number: QTBUG-103527
Change-Id: I0e41a6e7e9c44ff1ec22377329735538d5f95181
Reviewed-by: Mårten Nordheim <marten.nordheim@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 c25cc34a05c0838052b9a5d6624336ef2a2ae8ea)
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-08-05 18:18:04 +02:00
Tor Arne Vestbø
b491bf11d6 macOS: Don't ifdef out code to resolve display name that might be used
The call to displayName is not guarded by the same ifdef.

Change-Id: I169777130ec316a2d2f837621280acb061072501
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit b9a9edc52fd88745f6f45c76e48f1c2e32677e5c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-05 16:18:04 +00:00
Alexandru Croitor
53cdf7525e CMake: Fix examples to build as external projects when cross-compiling
We forwarded the compiler path to the EP but not the flags that might
have been set via the CXX environment variable.

Make sure to also forward the flags.

Task-number: QTBUG-90820
Task-number: QTBUG-96232
Change-Id: I0fbf9b595f7885014b1f09d158db52e56a3d5243
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 7fb25609a41ab9cc20ddd62e90f30c0536502aef)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-05 16:18:03 +00:00
Alexandru Croitor
86f1d55e09 CMake: Fix Ninja Multi-Config dependency issues for top-level targets
When building qtsvg examples as external projects on Windows
with Ninja Multi-Config in a prefix build on the CI, the build would
fail with an error message like:

 ninja: error:
'C:/Users/qt/work/qt/qtsvg/lib/Qt6SvgWidgets.lib', needed by
'RelWithDebInfo/svgviewer.exe', missing and no known rule to make it

This can be reproduced locally on Windows if one calls
'ninja svgviewer' instead of just 'ninja'. I wasn't able to reproduce
it on macOS, although I have seen some peculiarities in the
dependencies there as well.

External project examples depend on the ${repo_name}_src custom
target to ensure all Qt modules are built, so one would expect that
dependency to be sufficient.

While trying to figure out what's going wrong, I noticed that running
'ninja -t query qtsvg_src:Debug' showed dependencies on Release
libraries, which should not happen. The :Release target looked fine
though.

I'm still not quite sure why the Release libraries are not built
on the first ninja run, despite the example having a proper dependency
on qtsvg:Release.

Running 'ninja svgviewer' a few more times ends up succeeding at one
point, because the SvgWidgets Release library does get built in
parallel with the failing example, and the next rebuild would
succeed.

While trying to fix the :Debug target to have proper dependencies, I
noticed that we add dependencies to the ${repo_name}_src custom target
via the DEPENDS option of add_custom_target(). That is incorrect,
that option should only be used for file level dependencies.

For target dependencies, add_dependencies should be used.

Doing that fixed both the :Debug dependencies as well as the Windows
issue, which is good enough for me.

Amends 08f46bb40075778e89ba9aed3cef53d990852022

Task-number: QTBUG-90820
Task-number: QTBUG-96232
Change-Id: I1888681e2e9362d3237acbdacc83222d6a60b48e
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 0e2f218ee7b7ff96cc227f743aa6df11b86a74fa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-05 16:18:03 +00:00
Dominik Holland
45071f540a eglfs: Fix crash when painting the mouse cursor in a multiscreen setup
Always make sure to initialize the OpenGL functions. Instead of relying
on the shaderprogram initialization, which is bound to the current
context, check for the d_ptr and initialize when not already done.

With this fix QEglFSCursor::draw works regardless of which context is
current and checking for that is not needed anymore in paintOnScreen.
This is important as the basic render loop only uses one context for
painting on all screens, while the threaded render loop uses multiple
contexts.

Change-Id: I4ac2f5184c2fce27421e92efe1b7f635c71c0e92
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit f9eb2a7bdb9c86166848b3ff96ac7e055a8f567b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-05 16:18:03 +00:00
Sona Kurazyan
2ef512f243 Fix generation of the forward header for QFunctionPointer
The forward header for QFunctionPointer was being generated by accident,
apparently syncqt is confused because of some of the preceding lines. If
the lines are rearranged or removed, the header won't be generated. Not
sure if there's much value in generating a header for it, but at least
one of Qt sources (qeglfsemulatorintegration.h) is using it in an
include statment, and there's a chance it's used in the user code as
well.

Change-Id: Iced505881ddb07e7a8336fcdfb7d3e5397c6466c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8b2145463b38291dfa0ca2acf4a85552b7383a60)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-05 16:18:03 +00:00
Laszlo Agocs
8531129c0a rhi: metal: Defer also compute pipeline releasing
Change-Id: Idca8020b5acc026e19beaa297017731deb92e1bb
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 800465a7c4754cc56a67fb5bea58993369132f1e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-05 16:18:03 +00:00
Tor Arne Vestbø
9aa4dca6ed Explicitly disable bitcode for iOS applications
We disabled building Qt with bitcode in e27a0d5a0f8818653ff125409db81,
but the default in Xcode 13 is still to build applications with bitcode,
leading to build issues when built against a non-bitcode-enabled Qt.

For qmake we already explicitly disable bitcode, so do the same for
CMake.

Change-Id: I3fd542373c3e1326eb1088a173e70955e61ff608
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 1d6ce38a826a7ee18165b4994175c1d5479fd90f)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-08-05 16:18:03 +00:00
Marc Mutz
8922ead397 QStringIterator: fix UB [2/2]: use std::less to compare pointers
The relational operators <, >, <=, >= do not form a total order for
pointers. In particular, they are only defined for pointer pairs that
point into the same array (incl. one past the array's last element).

Other uses are undefined behavior.

The iterators the class works on are user-supplied, so we cannot
assume that they are pointing into the same array. In fact, we have a
check in setPosition() that tries to catch such misuses, but similar
checks are absent from the ctors, e.g.

In addition, the implementation itself is checking for next-but-one
and prev-but-one in an unsafe way.

std::less can be used to provide a total order, so use that
everywhere.

Change-Id: I32fb0ef9f768d9336ae12cc0542ca18d1bf23adf
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 7cf2684e6a11892975946bd57d8cf672fe6dd43e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-05 10:38:10 +00:00
Sérgio Martins
7d92a8009d eglfs: Ensure correct z-order of windows
- The main window needs to be at the back always, since it's fullscreen. If the root
window gets in front then there's no way to retrieve the secondary windows.

- Qt::Tool and transient child windows go to front as in other QPAs

Change-Id: I4a2793628250756bc07daaee0763ea7174a7bebd
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 9ccbbeecbd76ba7dbc73737528ea613c8b21bd98)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-05 10:31:59 +00:00
Sergio Martins
ad2a55f8df eglfs: Fix mouse events not being delivered to the frontmost window
Since QPlatformScreen::topLevelAt() wasn't implemented it would just fallback
to use QGuiApplication's window list.

Possibly fixes any other bug that relied on QApplication::topLevelAt().

The fix is to consult the compositor, which has proper z-order information,
unlike QGuiApplicationPrivate::window_list.

Task-Id: QTBUG-105256
Change-Id: I4202dd5d87e41b69c461c808d29b809af5b52d09
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 40d781b7b5e7925e4559cd725ddbfef307d5f455)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-05 10:31:53 +00:00
Tor Arne Vestbø
e1b6d9e4fc Remove if_types.h workaround for watchOS
watchOS is no longer supported, nor should the workaround be necessary
anymore.

Change-Id: Id5898d14b10e8f4aeaf6ce42ab39dbfdff9338ef
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 8669949f0df98610d9e4ce71cb80368357cd78ea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-05 09:57:43 +00:00
Marc Mutz
de515e4008 Fix QString::arg() for format strings with a huge amount of placeholders
QString::arg()s placeholders are limited to triple-digits, so 1000
different ones. By the same token, the length of any one of them is
bounded to five (%L?\d{,3}). But the total possible length of escape
sequences is _not_ 5000B, because there's no limit on the number of
_equal_ placeholders, so a format string where the total escape sequence
length exceeded 2Gi characters, e.g.

  QString("%L100").repeated(INT_MAX/5 + 1).arg(42);

would produce corrupt data.

Task-number: QTBUG-103531
Change-Id: Id27ee02579387efcbb5928de1eb9acbeb9f954c9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 15a80cf8a9d59203f8e2b436a5c804197c044807)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-05 04:29:15 +00:00
Marc Mutz
7cf3c80f54 tst_QFocusFrame: fix -Wparantheses
Says Clang 10:

tst_qfocusframe.cpp:73:28: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
    QTRY_VERIFY(focusFrame = window.findChild<QFocusFrame *>());
                ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[...]
tst_qfocusframe.cpp:73:28: note: place parentheses around the assignment to silence this warning
    QTRY_VERIFY(focusFrame = window.findChild<QFocusFrame *>());
                           ^
                (
tst_qfocusframe.cpp:73:28: note: use '==' to turn this assignment into an equality comparison
    QTRY_VERIFY(focusFrame = window.findChild<QFocusFrame *>());
                           ^
                           ==

Amends f1812aad895ed2b8337a6d98d05623714680aba9.

Change-Id: I3920ab0da725b76fb6c19bbc7cde7920f351af4a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit a17d6f869b8f56213ab2292cdc491d28e4dc3f9b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-04 22:38:00 +00:00
Thiago Macieira
afec50df6f Fix several more improperly placed #include moc
Like commit qtbase/638893bea083b619b73b33a7dd5589fb2c4c4242.

Script to find them:

 git grep -l '#include.*moc' \*.cpp \*.mm | \
   xargs awk '/QT_BEGIN_NAMESPACE/ { i=1 } /QT_END_NAMESPACE/ { i=0 } /#include.*moc/ && i { print ARGV[ARGIND], $0 }'

Change-Id: I6f936da6f6e84d649f70fffd17058fd05cfc5c6d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit a8ebadac593572601adff912ca12047c5a980371)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-04 22:38:00 +00:00
Marcus Comstedt
5d6bc9140e Fix composition of render-to-texture widgets on big endian
Converting from QImage::Format_ARGB32 to QRhiTexture::RGBA8 requires
texture swizzling also on big endian.  But unlike on little endian it
is not a red/blue swap that is needed, but a rather rotation of the
alpha channel from the first component to the last.

Add a new swizzling mode to the backingstorecompose fragment shader,
and rename the uniform to reflect that it no longer covers only
red/blue swapping.

Change-Id: I001d275abdc88faaadea16e396ebe032b34e83f0
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit d2fcccd3f1c5e3729c280a6f0a3e12dc9835477b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-04 22:38:00 +00:00
Laszlo Agocs
9258a78b22 Skip potentially costly features in QVulkanWindow
QVulkanWindow has recently been updated both in 5.15 and 6.x to start
enabling at least the 1.0 core features, because modern validation
layers are likely to complain if a feature is used without the
corresponding flag enabled upon device creation, even if the driver does
not actually care.

There is a catch here however, namely that some features may be true
opt-in flags, e.g. robustBufferAccess, and when enabled, they may incur
a performance penalty. So we will keep that one feature disabled even
when it is reported as supported.

It is unfortunate that VkPhysicalDeviceFeatures mixes together flags
that are most likely used only to query if some feature is supported by
the implementation while not serving as a real toggle (because opting
in/out is meaningless for the implementations in practice), and flags
that have significant effects when the feature is enabled, for example
when it comes to performance.

As QVulkanWindow only cares about 1.0, and 1.1+ features are to be
handled by the application via the features-modifier callback, we can
get away by just disabling robustBufferAccess and passing in everything
else supported as-is for vkCreateDevice.

Task-number: QTBUG-105158
Change-Id: I963402ab50f6e5d3fa6824680f69cff8568b669a
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit f6dc0b4b20765175eb26aedb8c83920fc16276a1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-04 22:38:00 +00:00
Marc Mutz
f01fd007a6 Fix qYieldCpu() for ARM < ARMv7
Apparently, we still support these architecture versions, and there's
no way to detect ARMv6k-or-greater specifically, so exclude yield for
ARM < ARMv7.

Amends 877c158c5976bebffd0ff02c39b6b66a842c6344.

Fixes: QTBUG-104316
Change-Id: I51a2f0f8e0993dba41e47bb6110473ac8e7cd32a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8128abeaece5b05476f79ff493597b838b223512)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-04 22:38:00 +00:00
Michael Saxl
c76bd92017 update function argument of SSL_CTX_set_options
openssl3 uses uint64_t for the options argument in SSL_CTX_set_options,
older ones used long.
sizeof(long) is not the same on any platform as sizeof(uint64_t)

Fixes: QTBUG-105041
Change-Id: If148ffd883f50b58bc284c6f2609337d80fb5c58
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit e995bfc0ea783c15bb173f060099ca24f277c763)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-04 18:17:02 +00:00
Laszlo Agocs
8d89cf5385 rhi: vulkan: Enable all but one of the 1.0 core features
VkPhysicalDeviceVulkan11Features and co. need to be considered
separately, for now we just sync the enabling of 1.0 core
features between QVulkanWindow and QRhi, both in 5.15 and 6.x.
For QRhi in Qt 6 this will need to be amended separately once
the myriads of 1.1/1.2/1.3 features are investigated.

Like everywhere else, robustBufferAccess is disabled. We do not
want features that likely affect performance. To be checked
later on if adding some sort of opt-in mechanism for this is
sensible or not.

Task-number: QTBUG-105158
Change-Id: Ia3d8c1e6bb8be8643e80178954dca0aa8b92d3c0
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit e00e215e006374a2b8e232c413de75e4d6504f5b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-04 18:17:02 +00:00
Mårten Nordheim
c4e6d8f5fa QtHttp: Lower the severity of some log output
The output was only printed if the request was no longer available
queued, meaning that it had been removed before the socket had finished
its connection attempt. That means the result of the attempt is not of
much interest to the user so we should not print it out as a warning.
The reason for why the request was removed from the queue would be the
interesting bit, but it's not covered here.

Task-number: QTBUG-85248
Change-Id: Iac483b8bb600e1577fe88c3699e46d50615bfccb
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 373285857f5b68537db48244d61de3f755b0d95f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-04 18:17:02 +00:00
Marc Mutz
a4b3fc4121 QByteDataBuffer: assert an undocumented precondition
The alternative would be to return a null QByteArray, but the current
implementation makes calling read() on an empty QByteDataBuffer UB, so
this is behavior-preserving, just with a bit nicer error message.

Change-Id: Ia9db7acbfa47e601b466d6cc6a728859065c27b5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
(cherry picked from commit 011b68d3cd95295890b1ed724aa4331ff5680eed)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-04 11:18:06 +00:00
Marc Mutz
a905c3e683 Eradicate QT_STRINGVIEW_LEVEL
It was designed to gauge the impact of replacing QString functions
with QStringView ones, as opposed to just overloading, but that never
came to pass, for two reasons:

1. We never got to implement a full set of overloads with the pattern
   in a large enough library (QtCore) for results to matter.

2. QStringView doesn't accept everything that QString accepts, making
   it unsuitable as a drop-in replacement (QAnyStringView has that
   property, though, but we never added a QT_ANYSTRINGVIEW_LEVEL
   macro).

So, R.I.P. QT_STRINGVIEW_LEVEL.

Fixes: QTBUG-100861
Change-Id: I0a9318177acb295e8eeeddfb345449112070c597
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 046a5a8f4f49944e6bf94cded52f88535d16bb3f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-04 11:17:50 +00:00
Marc Mutz
0102ab6cd3 Statically assert that the __mips_dsp code is only active on 32-bit
I was told this is 32-bit-only code in Qt 5, where it didn't really
matter, because only QStringView could handle > INT_MAX character
strings. Put up a big stop sign now in Qt 6 to enforce that this
information is correct, incl. notes for when it turns out it isn't.

Task-number: QTBUG-59150
Task-number: QTBUG-103531
Change-Id: I4620a43e2e67776cc67531fa993a7bb8e01cffed
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 753079b7074b06d237a0ae7a58281c28df134fc0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-04 11:17:28 +00:00
Marc Mutz
4c08f71a11 Fix QString::arg() for format strings > 2Gi characters
The getEscape function truncated the qsizetype position it got from
the caller to an int, potentially parsing a previous escape sequence
(or, more likely, garbage), by getting the position in the string
wrong.

Task-number: QTBUG-103531
Change-Id: I3b921c0991d238bbacfe6699c56146fe032134df
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 841ff3b73f9951e49b6406007d76302b3f367f55)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-04 11:17:11 +00:00
Andy Nichols
cf89e21bde Defer release of QMetalGraphicsPipeline objects
Change-Id: Ia7ee1a1b13a8b5ac1ef4859330150f0558793dfe
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 3f450a6ba04ccfb14db7399305e54add172e4d81)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-03 18:58:17 +00:00
Fabian Kosmale
6040dece1f moc: handle attributes in class declarations
We already had code to handle attributes on funtcions, but we didn't
handle them correctly for classes so far.
Fix this by simply skipping over the attribute.

Fixes: QTBUG-105310
Change-Id: Ic4149f940e74820de4f2fa9540d9dc5b4e626a3a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 84ab6c1aa1fe4051edb9f96714f0f691d639b725)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-03 18:58:17 +00:00
Laszlo Agocs
97057cbf44 rhi: vulkan: Improve alpha swapchain logic
Fixes: QTBUG-105011
Change-Id: Iea113d92e3261711b4fce88733cc2d7472b10829
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 71e3840f3a36eb176fe5896c4fbc888a00968ad3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-03 18:58:17 +00:00
Alexandru Croitor
c9b3ac2210 CMake: Fix single standalone tests to use same Qt C++ language std
When using qt-cmake-standalone-test, we didn't tell CMake to use the
same C++ language standard that Qt used when it was configured.

We did tell CMake to do that when configuring tests with
qt-internal-configure-tests via the qt_build_tests macro.

To ensure the proper standard is set, we also need to
find_package(Qt6Core), because the std flag is derived from the
QT_FEATURE_cxxyz flag which is set by Core.

Change-Id: Ia41f2a24983ddab0107a6446743f7b054df8c033
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit effd6f63f1a4b7dc7b5e6bca41594f1d1562a713)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-03 18:58:17 +00:00
Andy Shaw
513c8f63aa SQLite: Update SQLite to v3.39.2
[ChangeLog][QtSQL][SQLite] Updated SQLite to v3.39.2

Fixes: QTBUG-103675
Change-Id: Ic75ffacc53cf17c08e328921dcc0f7abe09ed1ac
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 41c4f9a47ad8fdd3d7ee645b6fa821ad416b2b43)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-03 18:58:17 +00:00
Oliver Wolff
69df10ace6 Disable constinit for MSVC compilers
https://developercommunity.visualstudio.com/t/C:-constinit-for-an-optional-fails-if-/1406069
does not only affect constinit thread_local but also constinit in
general on MSVC compilers when C++20 is being used. So disable the
feature for these compilers in general for now.

This commit amends d9531593a248e19f7da7862b2870a6af2f413e75

Fixes: QTBUG-105234
Change-Id: I1855f0857d85487895460fc7c56675fb864bfa73
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 51acd4708296de4392232271b3d6c5d067bdffad)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-03 16:04:39 +00:00
Yuhang Zhao
24ccadbee0 QtBase: Windows: Replace some deprecated API usages
Microsoft recommends to use CoInitializeEx()
and SetWindowLongPtr()/GetWindowLongPtr() in new code.

Use COINIT_DISABLE_OLE1DDE to avoid overhead of
initializing and using obsolete technology.

Change-Id: I9d16943e864d4487dd4f46fd9325579c298c52b9
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 8a0e0f8cc1f93d4f5fe205de75cacd2265017395)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-03 16:04:39 +00:00
Yuhang Zhao
0cead45f8c QSysInfo::prettyProductName(): add missing macOS product names
Change-Id: I9163917187b7a4cbf48e443303313b25473b229f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 870cfa4e17c42698b77504cfc19728acfbf7d659)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-03 16:04:39 +00:00
Alexandru Croitor
c711bf3158 CMake: Relax constraint on not having feature values change
Previously if qtbase was built with feature A set to ON, then building
qtsvg, then rebuilding qtbase with feature A set to OFF, trying to
build qtsvg would fail with an error message at configure time saying
that the feature value has changed.

This check was added quite early in the Qt CMake port, presumably to
catch accidental reconfigures that might cause long rebuilds.

This has dubious benefit though. We constantly had people telling us
they get the error without knowing what to do. The usual advice was to
remove CMakeCache.txt and reconfigure.

Instead of forcing people to suffer this dance, relax the constraint
by issuing a warning instead of an error, and make it more clear why
a rebuild might happen (a changed feature value might change
the generated module C++ header file which in turn might be included
by various project sources).

Amends 20633d97abed0f6025572f87c9359272b4713384

Fixes: QTBUG-95834
Change-Id: I992bd61024958869f3b995471b4c7ff75e3a33a0
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 15117f84bb9a5fd191105b2a4d8ebafc6c819fb9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-03 16:04:38 +00:00
Laszlo Agocs
833d6cdb30 Evaluate TranslucentBackground when (re)creating the window
The problem is reported in combination with the new 6.4 way of
handling texture-based widgets, but this looks like something that has
always been missing:

Setting WA_TranslucentBackground changes the QWidgetWindow's format,
and this is done upon calling setAttribute(). That's good for most
cases, but the changes to the QWindow's format are lost when the
window is destroyed and then the widget gets another window
later. This is not that common, but can happen.

For example, if a top-level widget is parented under something else,
and then later it is parented to null again, so that it is toplevel
once again, background transparency can be lost because nothing
re-evaluates the WA_TranslucentBackground flag after the initial
setAttribute(), and so the widget's second QWidgetWindow is not set up
accordingly (because this new QWindow may not have alpha specified in
the QSurfaceFormat which may or may not be a problem, depending on the
platform / windowing system)

The simple solution is to evaluate the attribute not just when setting
it, but also when a new QWidgetWindow is created for the widget.

Fixes: QTBUG-104952
Change-Id: I92746caea5561544f90395d5473ac28d43143924
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 856bb38eafcf55113a3debbdd6905dc71600cc61)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-03 16:04:38 +00:00
Laszlo Agocs
d2ed18382d rhi: gl: Avoid magic adjustments to the context/window format
...by removing the entire adjustedFormat() helper.

Qt Quick has never used this, which indicates it is not that
useful. Same goes for Qt Multimedia or Qt 3D. Ensuring depth and
stencil is requested is already solved by using
QSurfaceFormat::setDefaultFormat() or by adjusting the formats
everywhere as appropriate.

The helper function's usages are in the manual tests that use it as a
shortcut, and in the GL backend itself. Remove it and leave it up the
client to set the depth or stencil buffer size, typically in the
global default surface format. (which in fact many of the mentioned
manual tests already did, so some of calls to
window->setFormat(adjustedFormat()) were completely unnecessary)

By not having the built-in magic that tries to always force depth and
stencil, we avoid problems that arise then the helper cannot be easily
invoked (thinking of widgets and backingstores), and so one ends up
with unexpected stencil (or depth) in the context (where the GL
backend auto-adjusts), but not in the window (which is not under
QRhi's control).

It was in practice possible to trigger EGL_BAD_MATCH failures with the
new rhi-based widget composition on EGL-based systems. For example, if
an application with a QOpenGLWidget did not set both depth and stencil
(but only one, or none), it ended up failing due to the context -
surface EGLConfig mismatches. On other platforms this matters less due
to less strict config/pixelformat management.

Change-Id: I28ae2de163de63ee91bee3ceae08b58e106e1380
Fixes: QTBUG-104951
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 5b334729d30d89ad7433f7051d94acb21a1938fb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-03 16:04:38 +00:00
Laszlo Agocs
40e8e9c55f rhi: gl: Reset the buffer bindings on beginExternal
Play nice with old renderers like the OpenGL paint engine for
QPainter.

When combining Qt Quick and QPainter targeting the same GL window,
calling QQuickWindow::beginExternalCommands() is not currently
sufficient to ensure problem-free operation, it also needs a
QQOpenGLUtils::resetOpenGLState() afterwards to get rid of the buffer
bindings. (which is important when using legacy code with client-side
vertex arrays) Which in turn is not what the documentation promises,
so resetting the bindings is now ensured on the rhi level when
Qt Quick calls beginExternal().

Fixes: QTBUG-104801
Change-Id: Ibd82753996768aad0118bff87d4e1f8bcc388c58
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 4fdadd2348eb2c952650fbd8b9e5d18ed41405dc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-03 16:04:38 +00:00
Laszlo Agocs
2c2a69498b eglfs: Fix screen cloning when atomic is enabled
The problem was introduced in the atomic code path only, the legacy
one has always specified the correct crtc id.

Amends 56149c0fbb19946050a3249acef4e86e511d3cd4.

Change-Id: Ie3a99ec4bc24901e1303631097a395fde8dbe110
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 61806a058a17e35f082dfbf59719a9216b2aebf7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-03 16:04:38 +00:00
Sona Kurazyan
5aea02c72d qUtf16Printable: avoid creating a copy of a QString
Amends daa7f5375c58464bbe92744599f1e2258445e259.

Change-Id: I569efc4556341bfbce452bdf169c50a3b4be9ca7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 357db9ceabddcdce95ee1bc7f534eb00e6e10bad)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-03 07:40:26 +00:00
Thiago Macieira
edd3c0e6a7 tst_QMetaType: fix warning that buffer may be unused
We pass a pointer to uninitialized memory to QMetaType::create().
There's no harm because we're using the invalid QMetaType, but GCC is
actually right to complain for any other type.

qtestcase.h:54:25: warning: ‘buf’ may be used uninitialized [-Wmaybe-uninitialized]
qmetatype.h:454:11: note: by argument 2 of type ‘const void*’ to ‘void* QMetaType::create(const void*) const’ declared here

Change-Id: I3859764fed084846bcb0fffd1703eb7967acf0d7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit f1457b7b4742a3903b441d04c12cf500038f80b8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-31 17:53:26 +00:00
Volker Hilsheimer
b36803316f Windows: Implement dark mode palette and accent color support
Use the WinRT API to read the basic colors, and construct a usable
palette from those. None of the Windows.UI.ViewManagement.UISettings
APIs returns a full set of usable colors -UIElementColors returns the
old system colors, or useless values. And UISettings::GetColorValue only
gives access to a basic palette, where e.g. the background color is
just black, which doesn't match what Windows itself uses.

However, we know if we want to be dark or light, and can construct a
palette from the basic colors. The most relevant color to read from the
system is the accent color.

In the course of doing that, refactor and clean up the code somewhat to
standardize the handling, and remove hardcoded color values as much as
possible.

This is opt-in: unless the application is started with the QPA darkmode
parameter set to 2, nothing changes.

Task-number: QTBUG-72028
Change-Id: If603bb34c8f7478a05aafef2552a67e1e3460d29
Reviewed-by: Marius Kittler <mariuskittler@gmx.de>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit 2ffab52a4f0403468999516a4e8d6d961d778e27)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-29 15:18:28 +00:00
Alexandru Croitor
dc05e60962 CMake: Rename tests to be unique for top-level builds
Task-number: QTBUG-105238
Change-Id: I6c0276d14b4d90046b0fcfd281e198f59318e804
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit d528e96e732d9d66ec4e3b17aa07cd6d396c25be)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-28 21:22:10 +00:00
Volker Hilsheimer
d98d9d27cd Revert "CUPS: Add support for accessible IPP printers"
This reverts commit 2f5f276b4a2a19b9f2669b84f28ce8e970aaa39f,
after which valid printers are no longer listed anymore.

Fixes: QTBUG-105242
Change-Id: I6a388acff2a8033ad1052319edcf7e41a2f72c8f
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
(cherry picked from commit f387bb55d4060c6bfac0cd6da736c80dd9a47066)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-28 18:50:50 +00:00
André Klitzing
5f04904c4d Fix race condition with QTest::ignoreMessage
If another spawned thread will log at the same time
a crash was possible because IgnoreResultList
was not thread-safe.

Task-number: QTBUG-104840
Change-Id: I251c83bb28cb75e55d477706bf2524c061a6eab7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit d1dd9442392f3a1ab90a081bc58a84444a7a64c6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-28 15:20:39 +00:00
Alexandru Croitor
26aa9294cd CMake: Export package name and 3rdparty flag for 3rd party libraries
Needed to get rid of warnings like

 CMake Warning at cmake/QtFindPackageHelpers.cmake:406
 (message): Could not find target Qt6::BundledLibYaml to query
 its package name. Defaulting to package name Qt6BundledLibYaml.
 Consider re-arranging the project structure to ensure
 the target exists by this point.

which were introduced with the integration
of dffcc2370e43722afb25d7aec7cd9d6a36f61e03 in qtbase.

This happened because we never set and exported the package names
for 3rd party bundled libs.
So export the package name as well as "is 3rd party lib" value.

Amends 6235f7fa62aab5c0e002fa2f93f46508f38b5472

Task-number: QTBUG-104998
Change-Id: I25fc1ffef766198974025e0097bced1cca4dd28d
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit ea668ff16366a860cbbae759471a4050217ae98b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-28 15:20:39 +00:00
André Klitzing
44830d2fd6 Fix build with missing qml-root-path
Commit 42d0089d44bec5628884d8cf6bf2b910a298a141 added support
for multiple root paths. This works fine but it also added
"options->inputFileName" as fallback if nothing was provided.

The inputFileName cannot be used as root path (directory).
So let's use absolutePath() of that file.

Change-Id: Id76a2cd79a82966bdac8240644b3c03ac4248066
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 7da51c14d9fba59288535d0a5acca5a6479f18a0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-28 12:47:04 +00:00
Alexandru Croitor
000b710c54 CMake: Add per-target support for iOS launch screens
To support per-target iOS launch screens we need a way to specify
custom Info.plist entries without using cache variables, which we were
forced to use due to the implicit configure_file done for
MACOSX_BUNDLE_INFO_PLIST.

We now introduce an extra configure_file call done in a finalizer,
before we hand off the Info.plist file to MACOSX_BUNDLE_INFO_PLIST.

This extra configure_file call allows us to insert / substitute
additional Info.plist entries that CMake does not allow setting.

If a custom Info.plist file is provided, the finalizer will simply
skip the logic for creating a new one.

Amends e5b3436255ce095af58608b03b913fc9bcb8e61f

Fixes: QTBUG-101064
Change-Id: I65496da146c9430a949a8163817021d54da28386
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 578f4ba00c9fce9af922c9924ca104bc47e50f03)
2022-07-28 11:57:42 +02:00
Thiago Macieira
866d63f659 QMetaType: fix QMetaTypes for non-const references
Namely, they shouldn't be supported. Even trying to create such a type
(as in QMetaType::fromType<int &>()) should fail, because for the
purposes of the meta type, they are not the same.

However, they were being registered in the meta objects' meta type list
as a mistake since commit cb43aaca112c864a201b87037692cb8ae2e93b6d
("Introduce QMetaObject::metaType"), including for output parameters in
D-Bus remote objects' meta objects. despite the comment saying "type id
not available".

[ChangeLog][Potentially Source-incompatible Changes] Made meta types for
non-const references fail to compile. Previously, QMetaType::fromType
allowed this to compile, but returned the meta type for the base type,
which was incorrect. Const references are understood to be the same as
the base type.

[ChangeLog][Important Behavior Changes] The meta type for non-const
reference parameters in extracted methods (signals, slots, etc.) is no
longer available in QMetaMethod. This used to be the case in Qt 4.x and
5.x, but due to a mistake in Qt 6.0-6.3, QMetaMethod would incorrectly
report the base (non-reference) type. Additionally, both the reference
and the non-reference types may have been reported in different APIs.

Change-Id: I36b24183fbd041179f2ffffd1702384d2b64a5f9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 2d0c31e7d92a3e9df4ce2b9c1d41b94fb12735fc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-28 00:41:26 +00:00
Thiago Macieira
251d700b16 QMetaType: move is_complete template further up
Alongside the rest, makes the code better organized.

Change-Id: I36b24183fbd041179f2ffffd17025ca7fe988a5a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 7211771c64caad7880212b1a35d4a6070800c0fa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-28 00:41:17 +00:00
Axel Spoerl
1871ac7d12 Add nullptr guard in QStyleSheetStyle::drawPrimitive(PE_PanelLineEdit)
Drawing PE_PanelLineEdit in QStyleSheetStyle with the default argument
widget = nullptr causes a segfault.

drawPrimitive tries to fall back to a container widget's render rule
and therefore calls containerWidget() - which crashes when called with
nullptr.

Container widget fallback is pointless when drawPrimitive() is called
with widget == nullptr. This patch skips it in that case.

Fixes: QTBUG-104917
Change-Id: I09e57dccfebb81a308944c233846d5b9ef58819e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit effc8be3ce848770a093d51d5651908c375e83f8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-27 20:56:47 +00:00
Alexandru Croitor
d8515731c6 CMake: Make sure qtbase examples are installed into the correct path
The find_package calls need to happen after we set INSTALL_EXAMPLEDIR
to ensure that INSTALL_EXAMPLEDIR is overridden if necessary.

Task-number: QTBUG-102879
Change-Id: I3c2e6c5a68a8c6ff9b98b79dbd6c83445d8da052
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 818a15234c8fb80cd9adad54bd726cf69726fa79)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-27 18:18:47 +00:00
Alexandru Croitor
77bfa8bad5 CMake: Fix install destination of in-tree examples
Previously we called _qt_internal_override_example_install_dir_to_dot
in Qt6CoreConfigExtras.cmake as part of a
find_package(Qt6 COMPONENTS Core) call, and we assumed that the
Extras file would always be included in each example project.

But our package dependencies handling code skips calling
find_package(Qt6Core) if Qt6Core_FOUND is already set to TRUE,
which will definitely happen due to root-scope find_package
calls when configuring other repos.
That means we wouldn't override INSTALL_EXAMPLEDIR to "."
and the install destination would end up being something like
${CMAKE_INSTALL_PREFIX}/example_relative_path/example_relative_path
aka a double nested path.

Make sure we call the
_qt_internal_override_example_install_dir_to_dot function
in Qt6ConfigConfig.cmake in addition to Qt6CoreConfig.cmake.

That way, even if Qt6Core is skipped during dependency resolution,
it's still handled by the Qt6 package itself.

Because the function is defined in the Core package, guard the call
with an if(COMMAND) and only call the function if it wasn't previously
called within the current or ancestor scopes.

Amends ac4a913f333561803003650817de453f43be924d

Fixes: QTBUG-102879
Change-Id: Id47e3ce06faec6d156ae1473942dae0f9b90cb46
Reviewed-by: Christophe Giboudeaux <christophe@krop.fr>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 0e0352ab4d38ca31bb8e488783e35c2f8955e540)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-27 15:41:15 +00:00
Alexandru Croitor
a1a5243d4f CMake: Mark PlatformCommonInternal as a Qt6 package
Add PlatformCommonInternal to the list of packages
compared in qt_internal_is_lib_part_of_qt6_package

It gets rid of the following warnings when configuring
standalone tests

 CMake Warning at cmake/QtFindPackageHelpers.cmake:406 (message):
 Could not find target Qt6::PlatformCommonInternal to query its
 package name. Defaulting to package name Qt6PlatformCommonInternal.
 Consider re-arranging the project structure to ensure the target
 exists by this point.

 CMake Warning at cmake/QtFindPackageHelpers.cmake:374 (message):
 Could not determine package version of target
 PlatformCommonInternal. Defaulting to project version 6.5.0.

Amends 606124c5cceba0dd4a406a9278588b58bb9f9800
Amends dd1030a4501ca067e96f50085c8cfda19d85afd4
Amends dffcc2370e43722afb25d7aec7cd9d6a36f61e03

Task-number: QTBUG-104998
Change-Id: I65c23c20b3c1b70dbfd54edd4f5b83c6781f5e6f
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 22c3b87b14cfc5cf38463d641f122cff31fb757e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-27 15:41:09 +00:00
Alexandru Croitor
489ade90c6 CMake: Don't look for Qt6 components that are already found
This matches what we do in Dependencies.cmake files, except this time
for COMPONENTS passed to the Qt6 package.

For example if a project does
 find_package(Qt6 COMPONENTS Widgets Core)
we'd end up looking for Core twice. Once as a dependency of Widgets
and once as a standalone request of the project.
Make sure to skip the second lookup if it was already found.

Task-number: QTBUG-104998
Change-Id: I61db7fbb99818b4b70a0bfe3e167b6f14732292e
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 63db26a47ec49699026a4b8f0e128ecdad2570e4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-27 13:49:02 +02:00
Thiago Macieira
22a4fc0e38 QByteArray: inline QByteArray::isNull()
Keeping it out-of-line is unnecessary and has been since 5.0. In Qt 4.x,
it was necessary to compare to the shared_null, which for QByteArray was
a static variable. The one for QString has always been inline because
the shared null was a static member of QString (in Qt 3, QString::null
was a QString variable).

See:
https://code.qt.io/cgit/qt/qt.git/tree/src/corelib/tools/qbytearray.cpp#n3249
https://code.qt.io/cgit/qt/qt.git/tree/src/corelib/tools/qstring.h#n505

Change-Id: I89c4eb48af38408daa7cfffd16fdd7696520f1b6
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 999654fec7660cd5a724df26a4bc9f54e117a1b1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-27 06:43:08 +00:00
Thiago Macieira
c4cea61cea QMetaType: fix isRegistered()
It's not registered until an ID is assigned.

Change-Id: I3859764fed084846bcb0fffd17034f5b369c5b4d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit b1d9331c156b7ff5c724600eee21ac50f4565868)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-26 21:33:41 +00:00
Thiago Macieira
fbdd3396c3 tst_QMetaType: suppress most warnings
It's not warning-free, but it's much better.

Change-Id: I3859764fed084846bcb0fffd170323c9ed12dd23
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 51905f8e7638e997653c3fc10b97a66fe305edf9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-26 21:33:40 +00:00
Thiago Macieira
dbed2c15d5 tst_QMetaType: merge flags and flagsStaticless
And rewrite them with templates. QMetaType::typeFlags() simply calls
flags() anyway.

Change-Id: I3859764fed084846bcb0fffd170323f9d8c80466
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit aae882b02f346740f5a6b6d8b4d2bcf7f90bdc09)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-26 21:33:30 +00:00
Eli Schwartz
a37581a5b0 CMake: include the libexecdir in generated pkg-config files
In Qt6, the installed tools can be in one of two different locations,
depending on whether it is considered a helper or not. This means that
when migrating from Qt5 to Qt6, the pkg-config files no longer reliably
described where to find tools such as moc, uic, and rcc, which
third-party projects need to know about in their build systems.

Add this information in, to match qmake -query and Qt6CoreConfigExtras.cmake

Task-number: QTBUG-105051
Change-Id: I6692a76e0491a1c5e28982aa5fbe8b8aec8dec56
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit d8f9ac784e919064ab2620a3bd77794d6e730c9a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-26 14:50:46 +00:00
Alexandru Croitor
cc6917cb2c CMake: Make tst_qdbusabstractadaptor depend on qmyserver
Change-Id: I8a38c6e2de7639ac8cd07e36a4f6d79830d34dc8
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
(cherry picked from commit 84c9a79a69f05bcc42bdd68ad3e5708fa14116e9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-26 14:50:46 +00:00
Alexandru Croitor
c7b7e00e95 CMake: Ensure build instructions are always shown the first time
Regardless of the current log level.

Somewhat similar to dd5c860a7b5f5bf347b698b9145c45d369325e42

Amends e2a0ddbb69640c94b4ee107260a088d5c1c7e273

Change-Id: Ib7bc87f07e195125c858dcece2df6e82303dd01c
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 12629c6b808e476b474e6db98ae5ded64f5fc44f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-26 14:50:46 +00:00
Alexandru Croitor
eef146b321 CMake: Change __qt_internal_include_plugin_packages to be a macro
The __qt_internal_include_plugin_packages function includes
PluginConfig.cmake files which in turn might look for dependencies
with find_dependency. The dependencies that were found not have their
_FOUND variables set in the calling scope, which could cause multiple
lookups of the same dependency packages.

Change the function to be macro, so that all relevant _FOUND variables
are set and no unnecessary package lookups are done.

As a result, no need to set the QT_ALL_PLUGINS_FOUND_BY_FIND_PACKAGE
variable using set(PARENT_SCOPE)

Task-number: QTBUG-104998
Change-Id: Iba0fc83d9e58651f095e7b70d1ed19f064c4e577
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 4720735103f0a1076873de1d77089747bc2192ad)
2022-07-26 14:28:08 +02:00
Alexandru Croitor
12b08d1802 CMake: Don't unset Qt6Qml_FOUND when including Qml plugins
Removing the variable would cause nested find_dependency calls of
FooQmlPluginDependencies.cmake files to look for the Qml package
again and again.

If we got to the point of including QmlPlugins.cmake, we already know
that the Qml package was found.

Set it to TRUE after every inclusion to avoid repeated Qml package
loading.

The second inclusion pass will ensure to set the found variable to
FALSE in case if some dependency is actually missing.

Amends aad4158959890b72afdd062614c1142c100c65b5

Task-number: QTBUG-104998
Change-Id: I562a1c2ea0abac61453a743ab2e7d2f228de7ff0
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 3892e86d6e22e0693f4b8225058627a09d410aac)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-26 12:03:54 +02:00
Alexandru Croitor
77d1b03612 CMake: Record the precise package name where Private modules live
Previously if a target depended on CorePrivate, we would write a
_qt_internal_find_qt_dependencies(... Qt6CorePrivate) call into a
FooDependencies.cmake file.
That find_qt_deps call would remove the 'Private' suffix and would run
find_dependency with NAMES set to both the altered and non-altered
names.
This would find the relevant package but it would set the wrong
_FOUND variable name, e.g it would set Qt6CorePrivate_FOUND instead
of Qt6Core_FOUND.
This in turn could cause multiple lookups of the Qt6Core package
during dependency handling because the correct _FOUND var would not be
set.

Instead of always looking for the Qt6CorePrivate package, make sure
we look for an appropriately named package for all Privates modules,
because we have the necessary info to determine the correct name.

Note that INTERNAL modules will still be looked up via a Private
suffixed package name because that's how the package name is chosen
for them.

Remove the code that accounted for Private modules in
qt_internal_remove_qt_dependency_duplicates because it's not needed
anymore.

Warn when a package name can't be queried from a target's property
because the target might not exist yet.

Add a TODO comment for the code that searches with two NAMES.
We can't remove it right now, because it might break user projects
that use stale Dependencies.cmake files.

The dbus subdirectory is added before the tools subdirectory
to ensure that the new package name extraction does not error out, due
to trying to access a target that does not yet exist.

Amends 425ff34aa10a02524f2d52f544dc00b539ef9a26

Task-number: QTBUG-104998
Change-Id: Ib34ae5ed92f68b4265518c2b8802daeb1a3a04d6
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit dffcc2370e43722afb25d7aec7cd9d6a36f61e03)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-26 12:03:52 +02:00
Alexandru Croitor
9003a90220 CMake: Split 3rd party libs to be built before and after corelib
The ZLIB and the PCRE2 should be created before Core, because
src/corelib does qt_find_package to find the bundled / built
libraries.

The libpng, libjpeg, and the rest of the 3rd party libraries should be
created after the Core target is created, because they reference
Core conditionally in qt_internal_extend_target.

Targets should ideally be referenced only after they are created, when
creating linking relationships, but if code needs to extract
properties from those targets, then the targets must exist.
This will be the case in a future change which will extract the
package name from a target's property via qt_internal_extend_target ->
qt_register_target_dependencies chain.

Task-number: QTBUG-104998
Change-Id: I732827e5bb4c88532c1e5261ef753d73bda6e638
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit d48e596b3ca07ed785a1bf7496fcc350590f6a54)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-26 12:03:50 +02:00
Alexandru Croitor
dac83d4d88 CMake: Don't use AUTOMOC for third party libraries
None of them have Qt sources that need moc-ing.
It's also needed to circumvent an AUTOMOC + PCH issue when AUTOMOC is
enabled for a target that does not have any C++ sources, but the
target links to another target that does have C++ sources.

Change-Id: Ib1b2aa766089f093117c1ba34e156dfe8b0957e6
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 82a00471acaffe947779a01f4c4a44b559671067)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-26 12:03:48 +02:00
Alexandru Croitor
abd0be7efc CMake: Create aliases for Internal targets using common function
Previously we did not create Qt6:: namespaced aliases.
This is needed as a workaround preparation for getting the package name
of a module target from one of it's properties.

Before it would fail in qtinterfaceframework because
ifvehiclefunctions-simulation-server uses PUBLIC_LIBRARIES
in its qt_internal_add_app call, and because _add_app does not handle
such an option, some weirdness in qtbase's _add_app -> _add_executable
-> _extend_executable -> _register_target_dependencies ended up trying
to register PlatformAppInternal as package dependency.
That issue will be handled in separate changes.

Task-number: QTBUG-104998
Change-Id: Ifd03528c95b08cb6837a6aaa26cbf97c0cbabbb4
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 976539b4afe673173c480a91711a1ac953ddc2ba)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-26 12:03:46 +02:00
Alexandru Croitor
df5b902b5b CMake: Export a few useful Qt module target properties
These include:
 _qt_package_name
 _qt_is_public_module
 _qt_is_private_module
 _qt_public_module_target_name
 _qt_private_module_target_name

Task-number: QTBUG-104998
Change-Id: I012463944de8fc333f477a7880f9d27a69d6ef47
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 6235f7fa62aab5c0e002fa2f93f46508f38b5472)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-26 12:03:44 +02:00
Alexandru Croitor
bb550bb6c2 CMake: Don't repeatedly look for the Qt6 dependency
When loading Qt packages, don't look for the Qt6 dependency if it was
already found in the given subdirectory scope.

This reduces the amount of find_dependency(Qt6) calls.

Task-number: QTBUG-104998
Change-Id: I737c4433daf30eed51a058b45cd539dff7657ca4
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 8dac271889277d05a411136e6a765b86f1ed65f5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-26 12:03:41 +02:00
Alexandru Croitor
f9adb7eb35 CMake: Move QT_HOST_PATH check and computation into Qt6 package
Instead of trying to compute and validate the QT_HOST_PATH and
QT_HOST_PATH_CMAKE_DIR variables in the generated toolchain file,
do it in the Qt6 package.

This provides better error messages when a project is configured
without using the Qt generated toolchain file.
Because it's not done in the toolchain anymore, remove the various
host variables from __qt_toolchain_used_variables.

Task-number: QTBUG-104998
Change-Id: I1ca239ff83b8f783897e171fee352fc43e8ad7a8
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 0f8017efb6d037c4f33f947eb3c56aeafa28313c)
2022-07-26 12:03:39 +02:00
Marc Mutz
f3e76c9cbf Port QStringIterator to qsizetype
Most of the API is formulated using iterators, but index() and one of
the ctors still used int.

Patch users. There appear to be no users of this class outside of
QtBase.

Task-number: QTBUG-103531
Change-Id: I097ce839d74ff76bd8c1925d09634ffeaaa2fc07
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 4ed2c92bf4d46e6d4c9d8c321a35aa0bfc368fbf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-26 03:34:08 +00:00
Marc Mutz
431d508216 Fix stringish::simplified() for strings > 2Gi characters
If, after simplification, the result string would have been >2Gi
characters in length, the code returned a shorter string, truncated
mod INT_MAX, because the algorithm had not been ported to qsizetype.

Task-number: QTBUG-103531
Change-Id: I57cfed34e5c69406f8d3f2913962d006b4bc6bd0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit ec35efd7f2cea4dcbe0188f0d44cde541803f53e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-26 03:34:03 +00:00
Marc Mutz
971e382bed Port QUtf8BaseTraits to qsizetype
It's unclear why the the char8_t overloads have int sizes. At the time
60aa0d086886aea58d6b7a09484645ad1d92a220 added these, the uchar
overloads were already using qsizetype.

Task-number: QTBUG-103531
Change-Id: I8ed4c5462de29a7d48255e440e34bcd5114755fe
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit ab512adf12a2ba36b51f36d7c998d1cbdcf6505a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-26 03:34:03 +00:00
Marc Mutz
8a28024a4b Port qt_doubleToAscii to qsizetype
Allows central handling of large buffers.

Adjust some callers.

Task-number: QTBUG-103531
Change-Id: Ib55974c3de250883cd0f6d11a7eee051c7fd11bc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit bd43c245e8c641c3a5c86762647f99658167b4db)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-26 03:34:03 +00:00
Marc Mutz
9d036b0c67 QByteArray: fix base64 round-trip w/more than 2GiB data
There was an explicit int cast in fromBase64Encoding() which was never
ported to qsizetype and therefore truncated the result.

Fix by removing the int cast.

Add a test, optimize it for as low memory usage as possible, given we
need to work in input and output data each in excess of 2GiB.

Fixes: QTBUG-104985
Change-Id: I9c0924957e62e5cb3003132cd811b8b0315d8ac1
Reviewed-by: Edward Welbourne <edward.welbourne@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 d76bf645316a13495672741e54d270bada03752c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-26 03:34:03 +00:00
Marc Mutz
19f9e7c045 QLocale: port to qsizetype [1/N]: indexed to ranged loops
Ranged for loops are independent of the container's size_type, so port
what we can to them.

Task-number: QTBUG-103531
Change-Id: I0fd5c9c721e892ea617f0b56b8ea423e7a9f0d04
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 88f2a78594e0272d7916e13aca39611a85571937)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-25 23:29:31 +00:00
Marc Mutz
4c5533bba3 Fix QString::vasprintf for strings > 2GiB
Both format strings > 2GiB, as well as result strings > 2Gi characters
were affected by the append_utf8() helper function being left unported
from int to qsizetype.

There were actually two bugs in that 5LOC function:

1. The len argument was an int, but the caller feeds a difference of
   pointers (even explicitly cast to qsizetype) to the function, so
   any stretch of verbatim text > 2GiB in the format would cause the
   output string to be corrupted.

2. If the result string was already > 2Gi characters in size, a call
   to append_utf8() would truncate it mod INT_MAX, because the
   string's size() was stored in an int variable and the used in a
   resize() call.

Task-number: QTBUG-103531
Change-Id: I0a09d27b7782093d3f8ea17bb621ff8dad375072
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit f73833809b87feb4046c7bdc1fedb3b3a14e80ec)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-25 23:29:28 +00:00
Marc Mutz
0d69de55c3 Fix QString::toLatin1() for strings > 16Gi characters on ARM64
More qsizetype truncation to int, this time in the number of chunks in
SIMD processing, so the limit isn't 2Gi, but 16Gi.

Task-number: QTBUG-103531
Change-Id: Ib584c8dc7aa8dedc1cb8181e7d6f20b582c93f8c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 0b5d4c3eae8cd8024bc6e1df6321e2ad5deabb76)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-25 23:29:28 +00:00
Marc Mutz
9c0c998698 QStringIterator: fix UB [1/2]: use has{Next,Previous}() more
Replace

- pos > i with hasPrevious()
- pos < e with hasNext()

Everything is inline, so there's no difference in assembly, but less
source code lines to fix later.

Change-Id: I3f9cf2716c96b811b29b75fa20f88cc3b461771a
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 34800d1f09447e921203561c0e4804c4f095136f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-25 23:29:24 +00:00
Christian Ehrlicher
ee37e7c69a MySQL plugin: fix escaping a QByteArray
1df974590f19dec7b632d000ab9408a4de6f117a introduced a regression which
kills the escaping of a QByteArray because QString::fromUtf8() gets a
wrong length from a QVarLengthArray.

Fixes: QTBUG-105078
Change-Id: Ic2f76c82c246e1e9eaf1d3f907d11fc345b5655e
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
(cherry picked from commit f9d002ea20e7d5075313e9dcc769ed5348d2b829)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-25 22:08:28 +00:00
Alexandru Croitor
29991ceeaf CMake: Improve Qt6HostInfo package lookup condition
Instead of checking if QT_HOST_PATH is set during user project
configuration to find out if Qt6HostInfo should be looked up,
record if QT_HOST_PATH was provided during Qt configuration
into Qt6Dependencies.cmake and look up the package in a user
project based on that information.

This improves handling of the case where cmake is directly used
to configure a Qt project (instead of qt-cmake), which means no
QT_HOST_PATH might be set by the user, and then cmake would error out
saying that e.g. Qt6CoreTools is not found, instead of saying that
Qt6HostInfo is not found.

Task-number: QTBUG-104998
Change-Id: I0377d5440e4b5b295af73cfd4b5188f61d48e440
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 7b24ffa936880619f54c8cc1a459a0328238657c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-25 20:23:35 +00:00
Alexandru Croitor
e14e134d86 CMake: Move Qt6HostInfo lookup into a function
Also replace the duplicate call in QtSetup using the
new function.
To do that, we have to actually the call it in QtBuild
after QtPublicDependencyHelpers.cmake is available.

That call is needed so that Qt6_HOST_INFO_foo variables
are available in qt_generate_qmake_and_qtpaths_wrapper_for_target.

Task-number: QTBUG-104998
Change-Id: Ic5776c214bee6bedcea714b213b0e5a42c1bae06
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit a41bef8edeffe7b77970968533793a587215d977)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-25 20:23:28 +00:00
Edward Welbourne
f42eb2aabc Skip some spurious parentheses on macro argument uses
When an argument to one macro appears as a single argument to another
macro, the usual "put it in parentheses" rule doesn't apply since it's
necessarily something the right shape to be a macro parameter. In some
cases, furthermore, the added parentheses could show up in the output
produced by a test when reporting an expression that was compared or
verified. Also removed the parentheses around one comparison.

Change-Id: I226f4356fb057351187dac2134cc12c06026c40c
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 2648b4ad2c5e90fc7a074b6e469d4b54fb0bf724)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-25 17:29:39 +00:00
Edward Welbourne
812c10fced Skip semicolon after uses of QTRY_IMPL() and QTRY_LOOP_IMPL()
The macros' expansions end with an if-block and a for-block,
respectively, so the following semicolon is superfluous. Since we
control these macros' use (they're internals), just skip the
semicolons, rather than wrapping their bodies in do-while(0).

Change-Id: I53f7786a66a0dc7709ac9f96d49985edafceec39
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit a670a00aed4dbc9601df62c1ffd15352f6787bb6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-25 17:29:33 +00:00
Edward Welbourne
ed93b197b5 Move the early-failure checks in QTRY_IMPL()
These checks should not be included in the #expr reported when the
test fails. They're an internal implementation detail of the loop.
Split a long line while I was about it.

Change-Id: Iaea0478967d01cd72ef5a5e9a6501d4be2324b18
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 4048efc80c3085b7174b746bec1fa8406c56ed42)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-25 17:29:27 +00:00
Ivan Solovev
c731bffdc2 QNetworkInformation: guard deprecated method definitions
The definitions of the deprecated methods were not guarded by the
QT_DEPRECATED_SINCE() check, which causes compilation errors when trying
to get rid of the deprecated APIs using QT_DISABLE_DEPRECATED_BEFORE.

Task-number: QTBUG-105126
Change-Id: Iff7a5bbde743b4351b98c58090da44fe05c4654a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 2979df59b97b06e0056e23bc81d30e831c3ef0ab)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-25 17:29:20 +00:00
Edward Welbourne
901e22ea01 Test skip and fail in cleanup() as well as in cleanupTestCase()
The skipcleanup and failcleanup tests were actually testing skip and
fail in cleanupTestCase(), not in cleanup(). Add almost-duplicate
tests and clean up so that we now have {fail,skip}cleanup(,testcase}
tests to cover all four cases. Generated expected output. The new
tests (with old names) get their fail or skip - during cleanup() -
reported against the test instead of the cleanupTestCase function.
(Results for {init,cleanup}TestCase() are always reported, even when
these slots are not defined, as no-op passes.)

Change-Id: I0988d1696b50c0e2f30c45ddc25e1bd0bfd2151a
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 21e9c223b753ade33c994c1efabbd67978eda3bf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-25 17:29:18 +00:00
André Klitzing
bf3afa7ba1 Provide more details of failed connection
Otherwise the errorString from qtls_openssl is lost that
would help a lot why a tls connection failed.

"Error during SSL handshake: error:1414D17A:SSL routines:tls12_check_peer_sigalg:wrong curve"

Change-Id: Iab74b73488219686e5926308db02bc4063818c9f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 4fde012a90ff6f791c672b8e97bf592171514392)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-23 10:38:15 +00:00
Thiago Macieira
bf06976ef0 Revert "Drop call to setPlatformScreen in QHighDpiScaling::setScreenFactor"
This reverts commit 7b2ae3faab15913e006ece25d785e6a8453dd27a.

Reason for revert: this breaks multi-monitor XCB with HighDPI.

Fixes: QTBUG-105079
Change-Id: I386c9480c33d1f67b3478332c8e03fe3eeeeee39
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Fushan Wen <qydwhotmail@gmail.com>
(cherry picked from commit 392566cf61204dd28be0a6f2a252f9b5bd064e00)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-22 19:43:07 +00:00
Thiago Macieira
9160cf6a07 QVariant: do allow non-default-constructible types
So long as you only ask us to copy it. Copying is mandatory, though.

I'll firm up the warning in a later commit, which may not get cherry-
picked as far back.

Fixes: QTBUG-105140
Change-Id: I3859764fed084846bcb0fffd170432abf65dc197
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit df0085d3a28005e84eb7688cc2575a121ba322aa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-22 19:43:05 +00:00
Ivan Solovev
89db5c3d34 QT_INLINE_SINCE: take version into account
This patch improves the QT_INLINE_SINCE(maj, min) macro to take
deprecation version into account.
If the specified (maj, min) version is less than or equal to the
version defined by QT_DISABLE_DEPRECATED_BEFORE, the macro will expand
to "inline", and the out-of-line fallback will be removed from the
library.

This is achieved by introducing the helper
QT_IF_DEPRECATED_SINCE(major, minor, whenTrue, whenFalse) macro.

Fixes: QTBUG-104131
Change-Id: I285029dad7b71126072b024a3be6d7b11341996d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 5a5bc86028b2967ffccf151a9463459e67b96a8b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-22 18:27:05 +00:00
Dimitrios Apostolou
7b3092c137 Fix test flaky-crashing on OpenSUSE with KDE window manager
Sometimes XCB_EXPOSE event is being propagated twice, once before and
once after qWaitForWindowExposed(). But the window has focus only after
the second expose event. Changing it to qWaitForWindowActive() fixes the
issue.

Fixes: QTBUG-104268
Change-Id: Ibc78dd4958ed1a4a8d0967b29d2a53457ab9ae8b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 60f61198f2308e4767d57ec22331d77d46c6eb44)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-22 18:26:53 +00:00
Axel Spoerl
475f6edbd8 Sync and assert StandardPixmap enums in QPlatformTheme and QStyle
Add missing enum values in QPlatformTheme::standardPixmap to sync with
QStyle::standardPixmap changes from:
785d2b9d0728bbbc0d2a92b7d4186a3114d54128
aa5a595a98f1af4a514485268a18e6cb9cfec783

Add enum values NStandardPixmap at the bottom of both enums as well
as an assertion in QStyle constructor that these values are identical.
Add omitvalue for NStandardPixmap in QStyle (QPlatformTheme enum is
not documented).

Change-Id: I9ee528d032c445bed5aeace716893b2af8367de2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 2f4204238c7ec6f52b688268b6d3b4b937630074)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-22 14:52:47 +00:00
Volker Hilsheimer
d8b98f8232 Update freetype to 2.12.1
ftdebug.c files are new, adapted the import script to copy the source
file for Windows as well.

Replaced the CMakeLists.txt content that was imported from the .pro file
with the respective variables and logic from the freetype CMakeLists.txt
file, which should make it easier to maintain this next time.

Fixes: QTBUG-105032
Change-Id: I1e846167b268df4b1b0a50dcec602def1a0bdcb4
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit e79d7f12e6ca15c499a553e4a701a2887e4b184c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-22 12:25:37 +00:00
Marc Mutz
d84b84ac82 Port QCollator/Posix to qsizetype
Task-number: QTBUG-105038
Change-Id: If0cbe82105b753dfebfe1fa1ca7cbd759012e3d5
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 538378f2297cf7299270b09ddca3e4a5e7f8be82)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-22 11:06:02 +00:00
Marc Mutz
a974968d61 Fix QString::toHtmlEscaped() for >2Gi character strings
More unfinished int → qsizetype porting.

Fixes: QTBUG-105104
Change-Id: I3470de31c476b3d7736661550916828e43546573
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit c1991c63fc081a42ed3e6a28f82f395c54ef42a1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-22 11:05:59 +00:00
Ivan Solovev
1fa58a3d8b Partly un-deprecate QMouseEvent::source()
We have deprecated the usage of Qt::MouseEventSource getter in
QMouseEvent::source() since 6.0. However, we have a lot of related
APIs, where the usage of this enum was not marked deprecated. Also we
have a lot of code in qtbase, qtdeclarative and some other modules
that rely on those values.
In most cases using QMouseEvent::source() is the only way to pass
the proper value to the other APIs.

This patch un-deprecates the method, so that we can safely identify
all of its usages in our code, and port away from it.

At the same time, we do not want the client code to use this method,
so documentation still mentions it as deprecated since 6.0.

Task-number: QTBUG-104857
Change-Id: I767002aa6dc754fb5a58cf8fbf35774dae9986ed
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 929bb153eeb9e2c49778f65829146d11b815767a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-22 09:42:48 +00:00
Thiago Macieira
e57d7dbfa6 QVariant: add missing const to QMetaTypeInterface pointers
They're ALWAYS const objects, though they also chock full of relocations
so they are never in read-only sections of memory (except maybe in final
executables that are position-dependent).

These are methods in a private sub-class of QVariant. No one outside of
QtCore (at least qtbase) should be using them directly. QVariant doesn't
have many friends (a bit anti-social); the one that matters is
qvariant_cast and that one does access QVariant::Private. This is not a
BC problem because QVariant::Private::type()'s signature is not
changing. In any case, QVariant's Q_CORE_EXPORT does not apply to
QVariant::Private anyway (see [1]).

[1] https://msvc.godbolt.org/z/r9cer8eWh

Change-Id: I3859764fed084846bcb0fffd17035355f823dc8f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit eb9ace1cee4bb48005797b0b2d2d3d576a4cb4ce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-22 01:45:51 +00:00
Thiago Macieira
55c2321452 CMake: disable auto-detection of no_direct_extern_access
The feature is not ready for prime-time. Too many linker bugs have been
found, Clang hasn't finished implementing it, and the status of gold and
lld are simply unknown.

Task-number: QTBUG-105002
Change-Id: I3859764fed084846bcb0fffd1702fead133a9a96
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 48675dfa33c4b99b41af487d75f057bb7399c709)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-22 01:45:51 +00:00
Thiago Macieira
afeee99f52 CMake: add one more test for no_direct_extern_access
Found while compiling qtdeclarative tests:

FAILED: qtdeclarative/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen
[...]
ld: qtdeclarative/tests/auto/qml/qmlcppcodegen/data/TestTypes/libcodegen_test_moduleplugin.a(codegen_test_moduleplugin_TestTypesPlugin.cpp.o): non-canonical reference to canonical protected function `_Z28qml_register_types_TestTypesv' in qtdeclarative/tests/auto/qml/qmlcppcodegen/data/libcodegen_test_module.a(codegen_test_module_qmltyperegistrations.cpp.o)
ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

See https://sourceware.org/bugzilla/show_bug.cgi?id=29377

Change-Id: I3859764fed084846bcb0fffd1702fe6da341a9e3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 2221b25dac767ad2d3988af37e711c12e1ac9d78)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-22 01:45:51 +00:00
Thiago Macieira
6ed288d17f CMake: fix the word order in "no_direct_extern_access"
And take the opportunity to remove the "m" in the qmake feature name and
.prf file.

Change-Id: I36b24183fbd041179f2ffffd170224ab75cdd968
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 396170d07b768ca53665c67046555e5fabe78801)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-07-22 01:45:50 +00:00
Thiago Macieira
dd4875b54c Fix attempt to use -mno-direct-extern-access with Clang
Clang has the option, but spells it differently.

Fixes: QTBUG-105002
Change-Id: I36b24183fbd041179f2ffffd170217e82ff6d14d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 78ef9e9d14f170c410c2fb52f5aada8421ed8f07)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-07-22 01:45:50 +00:00
Ivan Solovev
d8e584c7a6 QAction: add QT_DEPRECATED_VERSION_6_0 to deprecated methods
And fix all the new warnings.

Task-number: QTBUG-104857
Change-Id: I2a5791f495575d71d2344429aca3363f9922e31b
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 4b9c738185c771127eb8e7c73868f60bd31f7fce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-22 01:45:50 +00:00
Volker Hilsheimer
8523b68b51 Undeprecate QAction::setMenu(QMenu *)
We deprecated QAction::setMenu(QMenu *) in Qt 6.0 because QAction needed
to become part of QtGui, and QMenu is a QtWidgets class. To keep
existing code working, we added a private API operating on QObject *,
and a template overload of setMenu, which allows callers to pass in and
get the object as a QMenu without any change to their code. The
implementation relies on a virtual function in QApplicationPrivate.

This solution might be as good as it gets. Making QAction operate only
on QObject* in the public API breaks exiting widget code, and it is
unlikely that we will come up with a QMenu abstraction that unifies
widgets and Quick UIs without breaking code either.

So, undeprecate the existing solution. If we come up with something
better, we can still deprecate it again in time for removing it in Qt 7.

Change-Id: I1982b61feb1b1af99f4647e892c5fd74340d9c77
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 8fed0a6aa66bf2a78d7e00b60b1ff27979873b86)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-22 01:45:50 +00:00
Volker Hilsheimer
7801d05844 Undeprecate QColor(string) constructors
They are used in a lot of code, deprecating them now just creates noise
and porting effort without adding any value.

For Qt 7 we can remove them if we deprecate them in time for the last Qt
6 release, at which point porting effort is expected anway. Leave a ###
comment behind to that effect.

Change-Id: I0a4e78cf1723b02373d23d7cd52783b3f7095428
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit a18a88b19bbae81a407645df2bfdd7faa180e323)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-22 01:45:44 +00:00
Shawn Rutledge
21137dadbe Add qt.pointer.dispatch debug message for tablet->mouse synth
We have one for touch->mouse synthesis, so perhaps it's a good idea here
too; then we can confirm that it's missing on Windows, because Windows
normally does the synthesis (setPlatformSynthesizesMouse(false) is not
called on this platform, so the default is true, meaning we expect that
it does that). The cross-platform synthesis (and ability for a platform
plugin to disable) began with f931e5e72d4617023bbea46cba2c0d61bb1efa4f

Task-number: QTBUG-102764
Change-Id: Ic6913adbeb6b91e3953ddfe8b401975d95cd9af3
Reviewed-by: Doris Verria <doris.verria@qt.io>
(cherry picked from commit dcc691c77d7de0f52f8c37a3727efd088cd4d9b1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-22 01:45:44 +00:00
Shawn Rutledge
58df309425 Fix Wacom proximity on xcb again
Amends 8e506fdd299d2fa18172209bea316f484e234e19

Also remove the lcQpaXInputEvents().isDebugEnabled() check to ensure
that the qCDebug output is emitted. It was meant as an optimization, but
skipping of printf-style qCDebugs when the logging category is disabled
is efficient enough.

Fixes: QTBUG-104875
Change-Id: Id8dc710a8fdb596ddce70380a577205fc52df4cc
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 8824a4e19ca7a7c41e5a65a3305cb5a30900b8dc)
2022-07-22 01:45:44 +00:00
Ivan Solovev
1ea89d761c QGuiApplication: do not emit deprecated signals
... when QT_DISABLE_DEPRECATED_BEFORE is past the deprecation version.

This commit actually stops using the deprecated signals when we build
Qt with QT_DISABLE_DEPRECATED_BEFORE >= 0x060000. Otherwise we will
get a compilation error because the signals will be removed.

Task-number: QTBUG-104857
Change-Id: Ie513ecc9451bf2d88f80857cf19f3d2b4958d022
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 68ea9c022701359b447be076888331a4f9d9085b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-21 17:59:30 +00:00
Ivan Solovev
3f46c4cb5d Do not use QTextFormat::FontFamily when building with QT_DISABLE_DEPRECATED_BEFORE >= 0x060000
The QTextFormat::FontFamily enum is deprecated since Qt 6.0, however it
is still used in the code.

To retain backward compatibility with the old data stream formats, we
introduce a new internal QTextFormat::OldFontFamily enum value, which
has exactly the same value as QTextFormat::FontFamily, and use it
instead.

Task-number: QTBUG-104857
Change-Id: Ibf5258b621c2b0aa507005dfe2c1e80c26ddb0d4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 8b029ef142526722a0931ae02b681ad57d7fd99a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-21 17:59:28 +00:00
Ivan Solovev
84c40972fb QShortcut::parentWidget(): Add QT_DEPRECATED_VERSION_X_6_0
And fix the usage that raised a deprecation warning.

As a drive-by: fix the deprecation declaration of QShortcut::id() to
use QT_DEPRECATED_VERSION_6_0 instead of pure Q_DECL_DEPRECATED.

Task-number: QTBUG-104857
Change-Id: I5710127864909ce9352c7428e6aabbc89981b8f2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit fc172e3093397990da73e80b737c17ba63375f2c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-21 17:59:26 +00:00
Ivan Solovev
cf4df23f6d QCursor: add missing QT_DEPRECATED_VERSION_X_6_0 for deprecated methods
When the method is wrapped into
 if QT_DEPRECATED_SINCE(MAJ, MIN)
we also need to add QT_DEPRECATED_VERSION_[X_]_MAJ_MIN macro right in
front of the method declaraion, to actually trigger a deprecation
warning.

This patch does that for QCursor's deprecated methods, and fixes all
related compilation warnings in QtBase.

Task-number: QTBUG-104857
Change-Id: Ic8d059e8c852d4b2dee55e7ea94f4fc7a402cdf4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 24de000a9cb0b2dc2f959fa65502ef805a4fc544)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-21 17:59:20 +00:00
Fabian Kosmale
8826fb80f0 QVariant: Avoid crash when constructed from unsuitable metatype
If the metatype does not support copy and default construction, then it
it unsuitunsuitable for use in QMetaType. We cannot prevent users from
passing in such metatypes (as we have e.g. a ctor taking QMetaType), so
verify this in customConstruct, and make the variant invalid in that
case.

Change-Id: Ib1f0149c8fb9a1cce0049fd0311980754cc85d1b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 6a0e59ed506ecb7d6a1bc17beedd938d36a1d26f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-21 15:37:45 +00:00
Assam Boudjelthia
d726a463e7 Android: document the supported clipboard mimetypes
Fixes: QTBUG-82477
Change-Id: I31a48acbf5cadc18dfe1fe9a54243b710f4f280c
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit c1086e1fa74d4c6a39c769390830acad9ac8bf46)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-21 14:54:36 +00:00
Marc Mutz
a88f62b0c4 QByteDataBuffer: avoid silent failures of read(n)
On 32-bit platforms, the user can ask for more than INT_MAX bytes to
be returned from read(n), by way of its qint64 argument. We can, of
course, not return so much data because allocation would fail, so fail
early, by detecting this situation and do what resize() would have done
if it was not for the narrowing of its argument: throw bad_alloc.

Reviewers may ask themselves whether byteAmount(), which already caps
the request, would not have physically limited the request size to
INT_MAX, since we cannot possibly hold more data than that on 32-bit
platforms. But this is not correct, since QByteDataBuffer is
essentially a list of QByteArrays, and those can be shared copies of
each other (which isn't uncommon, if you consider how a user of the
class may be piecing together data by reusing existing QByteArrays).

The read(n) and readAll() functions are already documented to be
inefficient and should-not-use, we may want to remove them in the
future to force users to think about this problem in the context of
their domain.

Change-Id: Ia152db0a1fc65bbef35acd463f12fba1b7726d4a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit db09fec6a1e08b05cd832a68e90857376c8e914e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-21 14:54:34 +00:00
Fabian Kosmale
caa7970df8 QMetaType: fix documentation
The doc comments were missing the classname, and therefore did not show
up in the correct places.

Change-Id: I23a56356dcad862e2fe1f6f8c3da2f39852b80c7
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 2d6ca88512f9e318491c502f6f97d2e853ffca4a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-21 13:24:44 +00:00
Mårten Nordheim
f83a79f267 QHttpHeaderParser: fix int/qsizetype nags
These values won't extend past MAX_INT but it may produce warnings
nonetheless.

Found by clang-tidy.

Task-number: QTBUG-104452
Change-Id: Icd8aa80a318274be00a3b32ad26a92745903cecb
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 2ba153dd5f450c008d49d30b5868abbca1974e28)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-07-21 15:24:31 +02:00
Samuli Piippo
e0ed5b63a1 CMake: prepend build dir for examples build
In cross-compilation, the CMAKE_FIND_ROOT_PATH will have path to the
host Qt and examples build will pick up wrong Qt6Config.cmake unless
the build dir path is prepended.

Fixes: QTBUG-104270
Change-Id: I7fc7499369a2e5446e1c5257155f81c72716fef7
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 18ed6a8979a1f1910f1285b5b2e5a28c397b37aa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-21 13:24:31 +00:00
Kai Köhne
4efe690a97 Doc: Hide template magic for MSVC from documentation
QT_POST_CXX17_API_IN_EXPORT_CLASS (introduced in commit e996253774)
works around a deficiency of MSVC by marking affected methods as
templated. Anyhow, this doesn't need to be reflected in the
documented API.

Change-Id: I9d5dd8b979a84f2fecc582613c2e944bb33eb790
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5961dbc0e228bcf4c48bf0b2e69161cd9a468dbf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-21 13:24:30 +00:00
Kai Köhne
a8c0088b01 Examples: Use signals, slots instead of Q_SIGNALS, Q_SLOTS
Change-Id: I79a352d1bac11edf2d2b0443d2f1bb202fb4e254
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 65d9593413455e401e44006b07c555f27c293add)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-21 13:24:30 +00:00
Marc Mutz
c3a003085b Pass QFixed by value
It's a glorified int, so pass it by value instead of cref.

Change-Id: I1c7a37614cd0d2dac63d2d549563600d401d6dad
Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@gmail.com>
(cherry picked from commit 0a1fe50d0bc32353bb7aaf8eef4759afd54901aa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-21 13:24:30 +00:00
Marc Mutz
749bce16a0 Port QFontSubset API from int to qsizetype
Removing the impedance mismatch with the Qt containers.

Task-number: QTBUG-104814
Change-Id: I141d9056249644b90c404219792e0fcd87960f7c
Reviewed-by: Lars Knoll <lars.knoll@gmail.com>
(cherry picked from commit f2c9f8c83781fea73b148bf24472f1d3d191c26e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-21 13:24:30 +00:00
Marc Mutz
c677238643 Port QTextureGlyphCache to qsizetype
Reduces impedance mismatch with other Qt containers.

Task-number: QTBUG-104820
Change-Id: Ie8830a404240f34acc790296b608e1318c46535d
Reviewed-by: Lars Knoll <lars.knoll@gmail.com>
(cherry picked from commit 9d29c590f30a04b3dba0b7d1b4918c2db5419e0d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-21 13:24:29 +00:00
Marc Mutz
5fb843bfae Port QDataBuffer to qsizetype
Reduces the impedance mismatch with "normal" Qt containers.

Remove useless inline keywords as a drive-by. Functions defined in the
class body are implicitly inline since C++98. C++ declarations are
long-winded enough as they are, no need to add more cruft.

Also make the ctor explicit, we surely didn't intend to allow implicit
conversion from qsizetype to QDataBuffer

Task-number: QTBUG-104825
Change-Id: I563dcd825afd63937b87e87fbbd324daaeb49d08
Reviewed-by: Lars Knoll <lars.knoll@gmail.com>
(cherry picked from commit 3f32e4a73a95d287cf427bf0b16a99068a2b4daf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-21 13:24:29 +00:00
Marc Mutz
47c2bec017 Gui: mark types Q_PRIMITIVE_TYPE when they're held in QDataBuffer
QDataBuffer assumes that its template argument is a POD, iow: it's ok
to not run ctors and dtors and assign a value into uninitialized
memory.

In Qt, we call that Q_PRIMITIVE_TYPE. Asserting that the QDataBuffer
value_type is not QTypeInfo::isComplex, however, has shown that a
large number of types had not been marked as such, sometimes for good
reason, e.g. because their default constructor doesn't
value-initialize all members, but sets some of them to -1.

Since QDataBuffer doesn't memset the memory to zero, it doesn't
matter, as the code obviously has to have worked before, with
uninitialized memory, and all-zeros is just a special, if common, form
of uninitialized memory.

I also tried to assert is_pod in QDataBuffer (working around the fact
that that particular trait is deprecated), but found that almost none
of the types in question were, in fact, trivial. We should fix this,
because it means the compiler is generating code that's less efficient
than it could be, but that's for another patch.

All types marked as Q_PRIMITIVE_TYPE in this patch are private API, so
this doesn't affect users.

For PathSimplifier::Event, had to shorten the unnamed namespace to not
include the member functions, because Q_DECLARE_TYPEINFO cannot appear
in a namespace other than the Qt one.

Change-Id: I4431a2f269ec1ac4804a87ea71f983eaa34ef867
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@gmail.com>
(cherry picked from commit 04ab0905e3cff6371b21731aa7f26d2f7f32ce7b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-21 13:24:29 +00:00
Marc Mutz
71aaafbb54 QLine/F: mark as primitive type
QPoint/F are, then so are QLine/F, being a pair of points.

Found by static_assert()ing !isComplex in QDataBuffer.

Change-Id: I358a38d79820c9262a86018253002bc991c5a6e4
Reviewed-by: Lars Knoll <lars.knoll@gmail.com>
(cherry picked from commit 6b6b88774bc9176a9e5eb3b82778a8317bf99d45)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-21 13:24:29 +00:00
Marc Mutz
25280fc698 QFixed: stream-line relational operators
- make them hidden friends
- take lhs and rhs each by value
- noexcept
- remove useless mixed relational operators with int: Every fix op i
  is now compiled as fix op QFixed(i) with no loss in performance.

Change-Id: If4d0a43fd964547de59fed4ba2cdfea0cf176809
Reviewed-by: Lars Knoll <lars.knoll@gmail.com>
(cherry picked from commit 44653cdf4cf9469003c1278691c8f449d06a5e06)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-21 13:24:29 +00:00
Marc Mutz
530fbd2faa QFixed: remove user-defined assignment operators
They don't give us anything: For every op=(X), there's an implicit
QFixed(X) constructor that will resolve any

  fix = x;

as

  fix = QFixed(x);

with no performance penalty.

Change-Id: Ia5b0364617a646f3cf122b47363d6099548bb5c2
Reviewed-by: Lars Knoll <lars.knoll@gmail.com>
(cherry picked from commit 9b92f599406aaf218fd2be2f290dc4938049ade1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-21 13:24:28 +00:00
Marc Mutz
9222bc35da QRasterPaintEngine: replace a QPair with a struct
Gives better naming for the members. A range consists of {begin, end},
not {first, second}.

Task-number: QTBUG-104818
Change-Id: I3d6c7be2a137e1c03149d1d86ce9db38ec28a1fb
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 464607abb9e2528c2e1ccf41eec7c28703df8e2a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-21 13:24:28 +00:00
Marc Mutz
faa9cf9749 QFontSubset: remove unused glyphName() overload
Amends b7f3253f906594ec1971fbea3a5760dcf8f01cdd(!).

Change-Id: I39dd2efee241afc2a57d0eb614d3a396fef95b9e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 215f0e4ea631e6abe6653c80fb375d806b78c158)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-21 13:24:28 +00:00
Nicholas Bennett
e6e3cc82a0 Support pinch zoom gesture in the Mandelbrot example
Used QGesture for this as per the gesture example.
Moved the help and info text to separate lines.
Enabled word wrap to prevent text going off screen.

As a drive-by, the code to center the window at a size that's a fraction
of the screen is replaced with a simple sizeHint() override. The user
should have control over placement, particularly now that it should be
placed manually onto a touchscreen if the user has one.

Done-with: Shawn Rutledge
Fixes: QTBUG-96702
Change-Id: I8dba8b09bed474f585341e9a7a8c71fb60293eee
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit fc5482cac6e69364c9d09fb8d994065e2a5fb542)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-21 13:24:28 +00:00
Sona Kurazyan
0a5045a31f QtConcurrent::ReduceKernel: fix race conditions
resultsMapSize is modified inside the runReduce() method, and the
writes are protected via mutex lock. However, reads of resultsMapSize
through shouldThrottle()/shouldStartThread() (that can be called by
multiple threads) are done without a lock. Added the missing locks.

Task-number: QTBUG-104787
Change-Id: I700e7b66e67025bc7f570bc8ad69409b82675049
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 7afb093dd77f0ed9a1b4145d2d279810aba411c7)
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-07-21 07:48:24 +00:00
Alexandru Croitor
e456889840 CMake: Rename test to tst_gui_variant_no_application
Coin test collector expects tests to start with the tst_ prefix.

Change-Id: I5cd49bf75fddc121fdfbde80d8a24a6110098011
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 552605b0fcab7974f3293b10c8c914c94703ecd3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-21 07:29:27 +00:00
Alexandru Croitor
c71fcce82b CMake: Introduce QT_DEBUG_FIND_PACKAGE for troubleshooting
When a Qt component or dependency is not found, we will now show a
message that the user can reconfigure the project with
-DQT_DEBUG_FIND_PACKAGE=ON.

If the option is enabled, various variables that find_package uses to
find packages (like CMAKE_PREFIX_PATH, CMAKE_FIND_ROOT_PATH) will be
recorded before each find_package / find_dependency call that is
executed in any of the Qt package files.

If any find_package call fails (a package has its _FOUND variable set
to 0), the values of all those recorded variables will be shown.

This is useful to troubleshoot issues, especially when
cross-compiling, without having to manually modify the various
Config files.

Task-number: QTBUG-104998
Change-Id: I3654960597911bd704fbe3c419bcae347ab739a9
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 0d91f85f6cd96d321b7509c042e02636995c966c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-21 09:29:18 +02:00
Alexandru Croitor
7284864652 CMake: Suggest hints on how to debug missing packages
Depending on CMake version suggest usage of either
--debug-find-pkg or CMAKE_FIND_DEBUG_MODE to help troubleshoot
why dependent packages are not found.

To achieve that, append the hint message to the _NOT_FOUND_MESSAGE.

To ensure it works for qt dependencies, and not only tool and 3rd
party dependencies, _qt_internal_find_qt_dependencies
is modified to set variable names infixed by the target name, so the
name is consistent with the other dependency lookup functions.

The check and message are also added when a Qt6 component is not
found.

Task-number: QTBUG-104998
Change-Id: I4ef23d1c53ac8e04eb72c260d6860c1eeec8d7a3
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 50d0296ed483dd9202d644c745fff3a16d99c3d3)
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-07-21 09:29:16 +02:00
Alexandru Croitor
78491331a8 CMake: Allow setting Qt6_DIR to find packages when not cross-compiling
So far we always recommended that developers set CMAKE_PREFIX_PATH to
point to the location of the Qt installation so that Qt packages are
found by CMake.

In Qt5 one could also set the Qt5_DIR variable to $qt/lib/cmake/Qt5
to allow the following signature to work:
 find_package(Qt5 COMPONENTS Core)

This was not sufficient in Qt6 because the CoreTools dependency would
not be found.

Fix this by also looking into the parent folder of
CMAKE_CURRENT_LIST_DIR as well as _qt_cmake_dir, like we already do
for regular non-Tools packages in _qt_internal_find_dependencies.

Note that setting Qt6_DIR is not sufficient for cross-compilation if
the qt.toolchain.cmake file is not used.
Aside from platform specific options that would have to be passed
manually to CMake (like -DCMAKE_SYSTEM_NAME=iOS for iOS) and
passing a QT_HOST_PATH value, the code would also need to be
adapted to do the necessary CMAKE_FIND_ROOT_PATH manipulations
to ensure that dependent packages are found.

Task-number: QTBUG-97615
Change-Id: I10c419632d43bb929e184bab3b9d3d27a35ea87a
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 0e2b385c5b77549fb8a25651840821076fb6d93c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-21 09:29:13 +02:00
Alexandru Croitor
c01ba43c9b CMake: Display reason when a Qt*Tools package is not found
When a package's tools dependency is not found (e.g. Core's CoreTools)
set the _NOT_FOUND_MESSAGE variable the same way that find_dependency
does.
We can't use find_dependency directly because that returns immediately
without allowing us to reset the prefix paths vars.

Task-number: QTBUG-104998
Change-Id: I81e9817de8f30214fafbefe3d98ef7bc8848e715
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit f0c3cfb06712509c7aa8c8d994147dc4c0a8bcfd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-21 09:29:11 +02:00
Alexandru Croitor
a1ae8bb7c0 CMake: Don't propagate REQUIRED to find_dependency / find_package
If find_package(Qt6 REQUIRED COMPONENTS Core) is called, don't
propagate the REQUIRED option to all the dependencies of Core,
regardless if it's a 3rd party library, tool or another Qt package
dependency.

Propagating REQUIRED causes the find_dependency -> find_package call
to exit the calling file immediately when the package is not found,
not giving an opportunity for find_dependency to set the
_NOT_FOUND_MESSAGE variable.

Instead force all find_dependency / find_package calls
to be optional, set the calling _FOUND variable to FALSE if the
dependency is not found, also set the _NOT_FOUND_MESSAGE variable.
Then the find_package call that loaded FooModuleConfig.cmake file
will show that message as the reason for the package not being
found.

Task-number: QTBUG-104998
Change-Id: Idcf0b6ed6f6bb38dc082110bbd817b05e287c052
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit db07310c5183918346b852904938ea5f8df3ac57)
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-07-21 09:29:08 +02:00
Alexandru Croitor
762b182c27 CMake: Clarify if an optional or required Qt component is not found
Task-number: QTBUG-104998
Change-Id: Id35f128404eb49a655d52ef130f8acb02f8ed33a
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 8152053a0b06b8aa35d96c2b5973ca23c9022443)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-21 09:29:06 +02:00
Alexandru Croitor
3ff7cbaca3 CMake: Don't search for next Qt component if a required one is missing
If a project calls find_package(Qt6 COMPONENTS Gui Network) and Gui is
not found, there's no reason to look for Network, because the
COMPONENTS option implies that it is a required component. Failing to
find a component sets Qt6_FOUND to false, so we can break early.

If a project calls find_package(Qt6 OPTIONAL_COMPONENTS Gui Network)
then Network will still be looked for if Gui is not found.

Task-number: QTBUG-104998
Change-Id: I5c5edd27729635e6b7ade059656b49320364ad13
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit ecfc0df9b2011a458ae4622b53b4fa6aec37b2a9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-21 09:29:03 +02:00
Alexandru Croitor
9a170f03a5 CMake: Remove custom Qt6 3rd party dependency implementation
Use _qt_internal_find_third_party_dependencies instead.
We rely on the inner find_dependency call to set the
Qt6_NOT_FOUND_MESSAGE message when a dependency is not found.
This implies removing the custom FATAL_ERROR handling
and relying on the parent find_package to display the
Qt6_NOT_FOUND_MESSAGE message.

We also clear Qt6_FIND_COMPONENTS if a dependency is not found.
No need to look for Qt packages if the Qt6 dependency was not met.
This reduces the amount of recursive error messages.

Task-number: QTBUG-104998
Change-Id: I5c611aaededfa63eb507ec5385b37a2fb6fcc698
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 6a2358e20f03a89ce08724355b2f4863155272f9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-21 09:29:00 +02:00
Alexandru Croitor
8de14dcfc1 CMake: Rename _qt_internal_find_dependencies to something less generic
Task-number: QTBUG-104998
Change-Id: I99b69865f711ff57511f32df2f345cebb7445d44
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 4c0578253d0dbc7c372e7839dbb4050fd61bf012)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-21 09:28:58 +02:00
Alexandru Croitor
a5f614a8f8 CMake: Extract package dependency finding into functions
Aside from moving the code to reduce duplication, the only changes in
the code are the replacement of @target@ to ${target}, using IN LISTS
with variable names to avoid macro expansion issues and replacing
the if(var) conditions with double variable evaluation
+ NOT STREQUAL "".

The function implementations are now in the same order as they
are used in the Dependencies.cmake files.

Task-number: QTBUG-104998
Change-Id: Iaae926414fd2a7cc09c2f5716376caaa0aade74b
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 7853f80e39912460421df4e255fed8e91ca9915a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-21 09:28:55 +02:00
Alexandru Croitor
91b687ac24 CMake: Remove dead code
It was accidentally left when changes were made from patchset 1
to patchset 2 in 825cb50c27fc0942a76771f9fb2ec052dc9142bf

Amends 825cb50c27fc0942a76771f9fb2ec052dc9142bf

Task-number: QTBUG-104998
Change-Id: I04dd50cfb93655f0c224bb226695e7771e9bc5d1
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 2d2cf95fe12735a5fe7d8137f3b86c113282b8a9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-21 09:28:53 +02:00
Alexandru Croitor
f2386738d5 CMake: Record used package version for each target dependency
When recording which package version to look for in
QtFooModuleDependencies.cmake and other files like it,
instead of using PROJECT_VERSION, use the version of the
package that contains the dependency.

For example if we're hypothetically building the qtdeclarative repo
from the 6.4 branch, against an installed 6.2 qtbase, then
the Qt6QmlModuleDependencies.cmake file will have a
find_package(Qt6Core 6.2) call because qtdeclarative's
find_package(Qt6Core) call found a 6.2 Core when it was configured.

This allows switching the versioning scheme of specific Qt modules
that might not want to follow the general Qt versioning scheme.

The first candidate would be QtWebEngine which might want to
follow the Chromium versioning scheme, something like
Qt 6.94.0 where 94 is the Chromium major version.

Implementation notes.
We now record the package version of a target in a property
called _qt_package_version. We do it for qt modules, plugins,
3rd party libraries, tools and the Platform target.

When we try to look up which version to write into the
QtFooModuleDependencies.cmake file (or the equivalent Plugins and
Tools file), we try to find the version
from a few sources: the property mentioned above, then the
Qt6{target}_VERSION variable, and finally PROJECT_VERSION.
In the latter case, we issue a warning because technically that should
never have to happen, and it's a bug or an unforeseen case if it does.

A few more places also need adjustments:
 - package versions to look for when configuring standalone
   tests and generating standalone tests Config files
 - handling of tools packages
 - The main Qt6 package lookup in each Dependencies.cmake files

Note that there are some requirements and consequences in case a
module wants to use a different versioning scheme like 6.94.0.

Requirements.
 - The root CMakeLists.txt file needs to call find_package with a
   version different from the usual PROJECT_VERSION. Ideally it
   should look for a few different Qt versions which are known to be
   compatible, for example the last stable and LTS versions, or just
   the lowest supported Qt version, e.g. 6.2.6 or whenever this change
   would land in the 6.2 branch.
 - If the repository has multiple modules, some of which need to
   follow the Qt versioning scheme and some not,
   project(VERSION x.y.z) calls need to be carefully placed in
   subdirectory scopes with appropriate version numbers, so that
   qt_internal_add_module / _tool / _plugin pick up the correct
   version.

Consequences.
 - The .so / .dylib names will contain the new version, e.g. .so.6.94
 - Linux ELF symbols will contain the new versions
 - syncqt private headers will now exist under a
   include/QtFoo/6.94.0/QtFoo/private folder
 - pri and prl files will also contain the new version numbers
 - pkg-config .pc files contain the new version numbers
 - It won't be possible to write
   find_package(Qt6 6.94 COMPONENTS WebEngineWidgets) in user code.
   One would have to write find_package(Qt6WebEngineWidgets 6.94)
   otherwise CMake will try to look for Qt6Config 6.94 which won't
   exist.
 - Similarly, a
   find_package(Qt6 6.4 COMPONENTS Widgets WebEngineWidgets) call
   would always find any kind of WebEngine package that is higher than
   6.4, which might be 6.94, 6.95, etc.
 - In the future, if we fix Qt6Config to pass EXACT to its
   subcomponent find_package calls,
   a find_package(Qt6 6.5.0 EXACT COMPONENTS Widgets WebEngineWidgets)
   would fail to find WebEngineWidgets, because its 6.94.0 version
   will not be equal to 6.5.0. Currently we don't pass through EXACT,
   so it's not an issue.

Augments 5ffc744b791a114a3180a425dd26e298f7399955

Task-number: QTBUG-103500
Change-Id: I8bdb56bfcbc7f7f6484d1e56651ffc993fd30bab
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit dd1030a4501ca067e96f50085c8cfda19d85afd4)
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-07-21 09:28:50 +02:00
Alexandru Croitor
e0cf71f321 CMake: Rename test to tst_qobjectrace
Coin test collector expects tests to start with the tst_ prefix.

Change-Id: Idc991273bacc41b62dbbf70f2ae0f3e712d34ab6
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 5afb5fb8e0c7088ccf65ac194310d2d4909121ba)
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-07-20 11:31:25 +00:00
Marc Mutz
a0752a7f15 Port qt_repeatCount() to qsizetype
While it's true that the typical user of the function won't expect
more than half a dozen repeats, this function is fed with
user-supplied input, so it could be asked to return in excess of
INT_MAX matches. The truncation then means we're misreporting the
number mod INT_MAX, which is as good as a random number and leads to
false positive matches in users of the function.

Just return the true result instead of a truncated one.

Task-number: QTBUG-103531
Change-Id: I5e3aa23dec873c6f9af255e90748fb38619d2f5d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit d6b38be3dfa4579cbe99cc442452a45779a71e70)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-20 11:16:37 +00:00
Kai Köhne
f1324ccd89 Clean up qt-cpp-defines.qdocconf
Cpp.ignoretokens, Cpp.ignoredirectives, falsehoods are not
used anymore by clang based qdoc.

Most defines are not needed, either, because clang based qdoc
will get these defined by scanning the normal headers. And QDOC,
Q_CLANG_QDOC is actually set by qdoc itself.

What's left is Q_GUI_LIB, Q_WIDGETS_LIB, which is used in headers
modules to make some API conditionally available. Finally, there's
QT_KEYPAD_NAVIGATION, which seems to be a Qt 3 thing, but still
some documentation depending on it ;)

Change-Id: Ib9cf0debac8d569cc21271087168a46c0f8635ca
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 440f91bd0d7da0e3061b52bde1b60c93e2179b38)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-20 11:16:36 +00:00
Sona Kurazyan
cddb14b424 Add \brief descriptions to QtConcurrent topics
Fixes: QTBUG-104213
Change-Id: Ib787546ef74133aca4b963a4341283147d2e8fb2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 581a342a3c6b62ccb7b9df8a9985460fa366e265)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-20 11:16:35 +00:00
Kai Köhne
5f564b04bf Doc: Add default value for seed param to all qHash overloads
Change-Id: I4d559ccd60ec54d2584dceecaece7e0899c0eea9
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 74ed70f17abb7d5236b2fead51ab44f627d4de20)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-20 11:16:32 +00:00
Marc Mutz
5724d5c580 QtBase: eradicate QT_STRINGVIEW_LEVEL uses
It's not used and not useful.

The macro itself has to stay, for now, because Qt5Compat uses it, too.

Task-number: QTBUG-100861
Change-Id: I5d0557a6c959d6facf6e47f26786a9d365339e95
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 16c453069f7b44ba7328a178b4b9ce99a150813e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-20 11:16:28 +00:00
Sona Kurazyan
2d22353224 Move the docs for porting to QRegularExpression to a common place
Copy them from QRegExp docs in qt5compat to
doc/global/includes/corelib/port-from-qregexp.qdocinc, so that the
porting docs can be included from both Qt 6 porting guide and qt5compat.

Task-number: QTBUG-89702
Change-Id: I616e2333f60f36e4851398479939fd062016748d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 90f3e1d3494fcab722eee457608e80ec74d0e838)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-20 11:16:26 +00:00
Yuhang Zhao
ec27dba7ff MSVC: Fix the CET parameters
To enable CET for MSVC, only passing "/CETCOMPAT" to
the linker should be sufficient.

Enabling generation of EH Continuation (EHCONT) metadata
is additional protection and should not be necessary.
It also requires all the dependencies to be re-compiled
with EHCONT enabled, otherwise the linker will refuse
to link the obj files. However, this is rather hard
to achieve if your application depends on many 3rd-party
libraries, so to let people enable CET more freely,
we don't enable EHCONT guard by default.

Change-Id: Iba08a5ec56c474d291991fb751a0de764719bd85
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ce9799e4c40f679cbb65aa7d006705e36ce7de97)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-20 11:16:24 +00:00
Marc Mutz
5f56cff243 QLocale/Win: fix truncation bug in winIso639LangName()
The qstrtoull() function returns ulonglong, not int, so we'd be
incorrectly detecting 0x1'0000'0814 as NyNorsk. Paranoia? Sure.

Fix by using auto to hold the result.

As a drive-by, make the QByteArray const so .data() doesn't
attempt to detach(), and shorten a long variable name to stay
within line-length limitations.

Task-number: QTBUG-103531
Change-Id: I740d0c5934e54c9f716688fa9c00de0ac4029936
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 87fabf3e4b7a5ccc00a7b76b4098e2174e4514d8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-20 11:16:23 +00:00
Marc Mutz
2e1699d3b0 QCollator: port compare(ptr, n, ptr, n) to qsizetype
While the function is inline, the class is exported wholesale, so the
function forms part of the ABI on Windows (but not Unix), so we must
overload, can't replace.

To avoid ambiguities where users pass different integer types as the
lengths of the LHS and RHS strings, QT_REMOVED_SINCE the old overload.

Since the removed function has an inline definition, it suffices to
just include the header into the corresponding QT_REMOVED_SINCE
section of the removed_api.cpp file, to elegantly solve the BiC
problem only for those platforms (MSVC) where it matters.

Task-number: QTBUG-103531
Change-Id: I74d446f08fcd6247a2ec44575b8afef8d014c3b5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 749b2df889ac94c106e59b915ec5862384978878)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-20 11:16:20 +00:00
Marc Mutz
21c1b8606f QCollator: Extract Method Private::ensureInitialized()
Avoids repetition of if (d->dirty) d->init() all over the place.

Change-Id: Ifc819151b7c694e6cc1f48bbb837b37d108ca49a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit d4b7c81e9e77a38dd294e52f65ed5426b40f1396)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-20 11:16:18 +00:00
Sona Kurazyan
a7cb167a7d Include the QRegularExpression porting docs in Qt 6 porting guide
The instructions for porting away from QRegExp to QRegularExpression in
the Qt 6 porting guide were mostly copied from the similar docs for
QRegExp, which are moved to
doc/global/includes/corelib/port-from-qregexp.qdocinc. The later now
covers everything that the docs from porting guide did and doesn't have
the issues listed in QTBUG-89702.

Remove the old docs and include the docs from doc/global/includes
instead.

Task-number: QTBUG-89702
Change-Id: Ifdb79d5775bc0cadd02c21299d58adb27ae13337
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 93f7291387c03367e828b16299ddcbaf1f804e25)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-20 11:16:15 +00:00
Marc Mutz
26c7a1b52e QOpenGLBuffer: remove unused include of QScopedPointer
Nothing in this class uses one.

Task-number: QTBUG-97601
Change-Id: I09397ec55ef87ddb5ab05d51c705bab83d6995fc
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit ad17a1674c21223719ffcf54d35c1ea3eb2356cd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-20 10:56:39 +00:00
Marc Mutz
2b415fcb27 Long live QT6_{DECL,IMPL,CALL}_NEW_OVERLOAD!
We have in the past found ourselves in need of disambiguating new
overloads from older, QT_REMOVED_SINCE'ed ones, which we usually did
by adding a defaulted int argument, cf. e.g. QMetaType::id().

The problem with a defaulted int argument is twofold: First, an int is
a valid argument type, and users may get confused as to its meaning
when presented with the signature in the IDEs auto-completion popup,
and a lot of things implicitly convert to an int, so any errornous
parameter passing may stay unnoticed until we remove these fake
arguments come Qt 7.

Second, this way of doing things requires a lot of ifdef'ery to keep
the additional argument out of both the docs and future Qt 7 builds.

The solution presented in this patch is to create a tag type,
QDisambiguated_t, which a) more clearly communicates its purpose and
b) doesn't implicitly convert from anything.

To help with the invariably ugly ifdef'ery, provide a set of macros
that hide this stuff from qdoc and Qt 7 builds.

Use the macros to replace the fake int arguments that were added for
6.4.

Change-Id: I6916f38c8eb9793ad6dea5f61e7e5fff7e75e273
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 0a3ff697380555538a0d035b768ddf10f772b55a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-20 10:56:33 +00:00
Marc Mutz
bf53992d82 tst_QByteArray: fix custom QCOMPARE for QBAs > 2GiB
The tst_QByteArray test redefines the QCOMPARE macro to check the LHS
to be NUL-terminated. Because the code was never ported from int to
qsizetype, it fails for QByteArrays of size > 2GiB.

Fix by porting to qsizetype.

Task-number: QTBUG-104985
Change-Id: Ib3951b0efed5f734ae1324ea2d455bb7762fb9c4
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit cb9715557c414d5b3c90165cc8fc710fbdcdba77)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-20 10:56:30 +00:00
Marc Mutz
8107ff3971 Port qt_getJustfication* functions to qsizetype
They're self-contained; callers passing ints will not cause warnings.

Task-number: QTBUG-104820
Change-Id: I1dcc1b178b7d72d23dd0596835ab2868c0c6f8c1
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
(cherry picked from commit f8976a3e31ec07e191cd5bf27b64b030e3675748)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-20 10:56:27 +00:00
Thiago Macieira
af799ced01 QEventDispatcherCoreFoundation: fix #include moc location in the file
They must be outside the Qt namespace.

Change-Id: I3859764fed084846bcb0fffd17030ebc62812e09
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 638893bea083b619b73b33a7dd5589fb2c4c4242)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-20 08:17:28 +00:00
Volker Hilsheimer
d67deb7a11 QMutex: limit moreStress test to idealThreadCount threads
Or the previous limit, 10.

The test has a flaky and failing history, esp on macOS. Trying to
provoke race conditions with more threads than we have cores has little
value.

Change-Id: I99dd2b5a6f64faa83963c279c84fc547416f914f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4802eec2ff314c561ae54647b453e9d0e4665c6e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-20 08:04:17 +00:00
Alexey Edelev
dd8192c8f0 Fix build with the disabled 'translation' feature
Definition of QMetaObject::metaType() should be outside the
QT_NO_TRANSLATION guard.

Fixes: QTBUG-104959
Change-Id: Icb1bf6e9cbad8b4c70ca09b5e7eafd125d866557
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 4f56b7d841b9c882dfa12a8aa55c1ebe0f9ef0e0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-19 09:05:00 +00:00
Volker Hilsheimer
7e47bc09cc QColorTransform: remove unimplemented function from the private class
QColorTransformPrivate::simpleGammaCorrection is not implemented
anywhere, so remove the declaration.

Change-Id: I07debd84e49389a0f1ef1b3798f809447a342f3a
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 6b2cc49580bab245e970d5162207fb0086a2750c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-19 04:09:36 +00:00
Volker Hilsheimer
5f1c3fc935 QCommandLinkButton: Let the style set the text colors
Make the hack less hacky by letting the style polish the widget (it does
already for the font) to set a dynamic property that the button can
test. Use the available palette entires ButtonText and BrightText to set
the dark blue and bright blue colors, rather than hardcoding them in the
widget code.

Change-Id: Idfb3b7d18e456a9d14af4962cf723e12ff1c3370
Reviewed-by: Doris Verria <doris.verria@qt.io>
(cherry picked from commit 86d973ed077b3e8e89571b2c3327f15d3ad89eed)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-19 04:09:35 +00:00
Volker Hilsheimer
bc3e6af3ce Windows: better handling of darkmode support
43ef22045c6f4fbf76d5cfa4ca32160d919b9984 turned dark mode support on for
both styling and window frames. However, the default palette and style
support in Qt is too incomplete, resulting in unreadable UIs when using
certain styles (e.g. fusion). Also the vista style is not supporting
dark mode.

If we don't turn on dark style support, then dark frame support doesn't
look good either. However, many application developers have implement a
dark theme themselves, and we should have a dark frame for those
applications.

So partially revert 43ef22045c6f4fbf76d5cfa4ca32160d919b9984 so that
dark style support is disabled by default, and leave dark frame support
on. However, only activate dark frames if the palette is dark, i.e. if
the window background color in the default palette is darker than the
text color (or if DarkModeStyle is explicitly turned on by running the
application with -platform windows:darkmode=2).

This way, dark-themed applications get a dark frame on dark Windows, and
a light frame on light Windows; and light-themed applications (including
default Qt applications) get a light frame all the time.

Fixes: QTBUG-72028
Change-Id: I61f1b1e43b2a4ba69848d5d8bec921c0790fe511
Reviewed-by: Marius Kittler <mariuskittler@gmx.de>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 5ea7e3a8111b2939f0c91b750aa1c62ab16ab715)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-19 04:09:34 +00:00
Volker Hilsheimer
85077365c0 Fusion: better support dark themes in the dial
A UI in dark mode will have a dark background. Pick a light color to
draw the notches. Since in the mac style, the dark mode's 'dark' color
is lighter than the 'light' color, pick whichever is lighter.

Change-Id: I333ea95b80d7a19504000877337b28839b4a8b9f
Reviewed-by: Doris Verria <doris.verria@qt.io>
(cherry picked from commit 38114b83250cc9b14069d41935fb8822475de45a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-17 22:54:35 +00:00
Volker Hilsheimer
68ebfc4c2f QWidget: extend timeouts in flaky enterLeaveOnWindowShowHide test
That test has a very flaky history on Windows 11, presumably because
there are even more fade-in/out effects. Wait longer for those to
finish.

Fixes: QTBUG-102239
Change-Id: I1d59f4422469e60a8c4dc5a52c48f0344e954491
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 2738a80acd9e2f81a88dd270e45ad00284a910fe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-17 22:54:16 +00:00
Thiago Macieira
bf7088f411 QCborValue: attempt a bit of exception-safety around QList::reserve
We don't promise we're very good at handling exceptions.

Task-number: QTBUG-104718
Change-Id: I89c4eb48af38408daa7cfffd16fdcc171db437bd
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit b483c67e0fd9baf94e771c803c9c4378372d244d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-17 01:21:54 +00:00
Thiago Macieira
efc5fa9386 QCborValue: free container memory in case of parsing failure
Holding on to the memory we've just allocated could only make sense if
we supported resuming parsing, but I haven't implemented that feature
yet.

Change-Id: I36b24183fbd041179f2ffffd1700cf7e3558040f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 16641f625ec0ae71b34813b8eef4dcc1aeb81fc5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-17 01:21:48 +00:00
Thiago Macieira
3a27cf4c3d QCborValue: further clamp down on memory allocation for CBOR streams
We were allowing up to 1 million elements for each array, which meant 16
MB (32 for maps), and we considered that sufficient. However, because we
do allow up to 1024 levels of recursion, the memory consumption was
actually limited to 16 GB (32 for maps), which is a bit too high for
64-bit applications, and definitely too high for 32-bit ones.

So further clamp down, to a mere 16k elements on 32-bit and 64k on 64-
bit, which limits the memory use to 256 MB on 32-bit and 1 GB on 64-bit.
And additionally apply this exact limit to maps, instead of allowing
them to double the size.

As before, this does not limit the size of non-corrupt streams. This
only limits the initial memory pre-allocation.

Fixes: QTBUG-104718
Change-Id: I89c4eb48af38408daa7cfffd16fdcb34f08c1949
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f6e6ae092dd12cfb13c981efc64b48f3c74f3b65)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-17 01:21:47 +00:00
Shawn Rutledge
a85b274a37 Fix QPointerEvent::allPointsGrabbed()
Amends 8932e80d0c8879a1e720fef825ed0d9c4e384a01 to make implementation
match docs: the ! went missing during repeated patch rebasing, apparently.

Task-number: QTBUG-101932
Change-Id: I3fe910774f5bdf4ab0342a9cf1994bb489f20e87
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 65adfd5ec593a20223723c2b6f832da1a93c39b5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-17 00:28:03 +00:00
Thiago Macieira
0c9fc4bfa7 forkfd: implement vfork(2)-like support on Linux
fork() works by implementing Copy-On-Write for all pages that either the
parent or the child process write to. So if the parent process continues
running while the child is between fork(2) and execve(2), then it will
keep causing page faults and requiring the OS to duplicate those pages,
which may be expensive (page table updates, TLB flushes, etc.). This
problem is aggravated if the parent process is multithreaded, as the
simple act of running in the parent will cause those threads' stacks to
cause page faults.

The BSD solution for that was vfork(), which has two differences in
behavior: (1) it blocks the parent from running and (2) it shares memory
with it. But it's always been tricky, so POSIX.1-2001 deprecated it and
2008 removed its definition completely. Still, it is available somewhat
widely, and on Linux that can be achieved with clone(2) and the
CLONE_VFORK and CLONE_VM flags, for those two behaviors respectively.

Because of (2), we can't return from the forkfd() function in the child
(as that would trash the stack in the parent process), so to implement
this functionality vforkfd() adds a callback of the same signature as
glibc's clone(2) wrapper (something that hadn't occurred to me when we
attempted to use CLONE_VFORK last time).

On Linux, (1) is no problem, as clone(2) has native forkfd support. But
on other OSes, forkfd() requires the parent to run before the child
execve()s, in order to save the child PID in the list of children we're
going to handle SIGCHLD for in a non-racy way. Investigating if it is
possible to use vfork() anyway is left as an exercise for the reader.

Matching OpenDCDiag pull request:
https://github.com/opendcdiag/opendcdiag/pull/94

Fixes: QTBUG-104493
Change-Id: Id0fb9ab0089845ee8843fffd16fa63c7c6f7dd1c
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit e1a787a76ed462e4ed49db78a40c6d7e272182d7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-16 21:40:20 +00:00
Volker Hilsheimer
ca7a2f84de QGraphicsWidget: skip test if graphics view fails to show
We set Qt::X11BypassWindowManagerHint on the view, which regularly makes
the test fail on X11 systems in the

QVERIFY(QTest::qWaitForWindowActive(dummyView.data()))

check.

If the view fails to show, skip the test instead of failing, we are not
testing anything X11 specific here, running this test on other platforms
will be good enough.

Fixes: QTBUG-98921
Change-Id: I46dbcddf51ee1e92eb3bbb29bb57fcc314266bea
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit a2c7428e4dcfb30fa391083aff6618c1f54e777a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-16 02:28:14 +00:00
Fabian Kosmale
3073401ff6 QThread: Clean up bindingStatusOrList if object gets deleted
Deal with the case that the object gets deleted between a call to
moveToThread and the start of the thread by removing the object from the
list in that case.

Fixes: QTBUG-104014
Change-Id: Ib249b6e8e8dfbc4d1332bb99a57fa9d3cff16465
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 2c81ba2df95cc07d5d147c8f3c7999c34848d274)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-15 22:17:35 +00:00
Ivan Solovev
672b8dc4f5 Addressbook example: port to QLatin1StringView
This allows to fix the warning:
 qtbase/examples/widgets/itemviews/addressbook/addresswidget.cpp:115:
  warning: loop variable ‘str’ of type ‘const QString&’ binds to a
  temporary constructed from type ‘const char* const’
  [-Wrange-loop-construct]

Change-Id: Ibbfa7f9e85fe9ef79291f9da3d161667286b282e
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
(cherry picked from commit 7d2361b9da5c1ee9ef0724917108d6a3294e14c2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-15 22:17:24 +00:00
Timur Pocheptsov
7562089f4e tst_qnetworkreply: replace server.pem/key pair
OpenSSL v3 fails to set server's certificate, complaining that
"md is too weak".

Fixes: QTBUG-49205
Change-Id: Ib21b10ff13bc2621ae2aaaab962efaaf77a854bc
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit d8ff4d9f57f6eb3533ea274b6dbdeec2fe1f3053)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-15 22:16:56 +00:00
Volker Hilsheimer
b5ce6fcffc QGraphicsProxyWidget: make tolerance in mapToGlobal test at least 4
a61bf508e3c138c429e0a73498c745c3c0d3f0f7 reduced the tolerance from 4 to
3 in one case, making the test more rather than less flaky on systems
with a device-pixel-ratio of 1.

Change-Id: I245443f0dcb1aa40176c127025501b63f12f161b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit e6c7d049f4c737c8d98b0abf5d20e6ebeec1d646)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-07-16 00:16:37 +02:00
Volker Hilsheimer
583cbd607f QGraphicsProxyWidget: make tolerance for errors depend on DPI
The test already accepts an error margin for coordinate mapping. It is
still flaky, so make that margin larger if the DPI of the widget >1.

Change-Id: I0a598e5e94ac82c551cbeb935e2fa08cad048f84
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit a61bf508e3c138c429e0a73498c745c3c0d3f0f7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-16 00:16:29 +02:00
Ivan Solovev
886c7b8700 GroupBox example: port away from using deprecated QAction::setMenu()
We can achieve the same UI by using QMenu::addMenu() directly

Task-number: QTBUG-104857
Change-Id: I627f21bc93646943cf6dfbd3b388352b84f73f0f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 6db91c0df1900df2ddcd5abeb243b8852b02b7ab)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-15 13:46:33 +00:00
Volker Hilsheimer
67cff353e3 QPalette: detach before modifying resolve mask when resolving
Amends 1d961491d817490da156769ddce6fce48a0bce4a. We modify the resolve
mask after making a shared copy of 'other', so we must detach. Call the
setter designed for that purpose.

Task-number: QTBUG-98762
Change-Id: I4f45223e74764a341378992172787fae73efb8b7
Reviewed-by: JiDe Zhang <zhangjide@uniontech.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 37c829f511d67be1c226201b4bbbe73c53835078)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-15 13:46:33 +00:00
Umair Raihan
dedd2d35e3 Add new mkspecs device for Raspberry Pi 4 (64-bit)
The existing mkspecs for Raspberry Pi 4 (devices/linux-rasp-pi4-v3d-g++) was intended to compile Qt application for the 32-bit version of Raspberry Pi, thus it used compiler flags that are incompatible when compiling Qt application for the ARM 64-bit architecture. According to ARM compiler documentation, -mfpu flag is rejected by AArch64 state while its alternative, -mcpu, has to be avoided when -march flag is already defined. -mfloat-abi flag is not valid with AArch64 targets.

To support both 64-bit and 32-bit architectures, I proposed to add this new mkspecs.

See:
https://developer.arm.com/documentation/101754/0618/armclang-Reference/armclang-Command-line-Options/-mfpu
https://developer.arm.com/documentation/101754/0618/armclang-Reference/armclang-Command-line-Options/-mfloat-abi

Change-Id: I36574875e798281688601edd0f166922592d9830
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 55dd9439961b21f9b4929a80dbccfffc647678b3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-15 09:03:50 +00:00
Eskil Abrahamsen Blomfeldt
6a1a2e00a9 Relayout QStaticText when dpi changes
If the cached font has a different DPI than the one used in
QPainter, we need to treat this the same as if other font
properties have changed and redo the layout.

This happened when running the QStaticText test on Wayland,
because the default dpi was 100 and the QPixmap we ended up
drawing to was 96. This caused the pixel size of the font to
be calculated differently when doing drawText() (using 96 dpi)
and drawStaticText() (using the cached 100 dpi).

Fixes: QTBUG-100982
Change-Id: Ie4270341bb8a64b6458eb67ba460a282c65dc26b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit ade2df4c4b2df638fefd42d9b755ee7a789da503)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-15 09:00:55 +00:00
Morten Johan Sørvig
c676608442 wasm: add echo_client_mainthread example
This example connects an echo server running behind
WebSockify, on localhost.

For example, start websockify with

    websockify 1515 localhost:1516

to accept a webscoket connection on 1515 and forward
to echo_server at 1516.

Change-Id: Id71364e4ab8c46d3482b515fcd1b991b61d7404b
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit 5548b940fb52715d2a25a6316c2b44c83fdbbcbc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-14 08:56:25 +00:00
Volker Hilsheimer
6e1289638d QCompleter: make filesystem test robust against slow I/O
Use a signal spy to watch for the relevant signal from the file system
model and wait for that before checking whether the completer responded
to that signal by showing (or not showing) the popup.

If the file system model doesn't fire within the default timeout of 5
seconds, skip the rest of the test.

Fixes: QTBUG-46113
Change-Id: I9becfe19a220bdb178ed8275c327d55ea19aa342
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit d609b20842c0493b13a24653ad0064d6f98d957b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-14 08:56:21 +00:00
Øystein Heskestad
a0ce6b4461 Disable unit testing setting up QTcpServer on special Apple interfaces
The iBridge interface is used for the keyboard touch bar, and the Apple
Wireless Direct Link interfaces are used by Apple for various purposes.
Setting up a server on these interfaces does not work.
Only the tst_QTcpServer::linkLocal unit test on macOS is affected by
this change.

Fixes: QTBUG-103892
Change-Id: I29701ce51d5e40dff6c59547a8639c1fba330d36
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 1c563035c7b66349018898cb880ffef8c002a545)
2022-07-14 08:27:22 +00:00
Volker Hilsheimer
3a7be41607 QProcess: skip processesInMultipleThreads test on emulators
The test has timed out when run on ARM in qemu. We start more threads
than the ideal count, which is likely too much for the emulator when not
running the native architecture.

Change-Id: I42e11945070646551e77c10618df762a4bffc8ba
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 826a98cff1cd92d8b87ddd0df7f9a5b0828ac000)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-13 19:55:34 +00:00
Marc Mutz
073b9f856e QOpenGLContext: de-inline virtual dtors of private classes
... pinning the vtables to a single TU instead of duplicating them for
every user.

Task-number: QTBUG-45582
Change-Id: I728a5c47edaafe7ef4fdca1db8d0247ed4be9713
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 12f8b583cfd083f52b95248a798184f43314955a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-13 19:55:34 +00:00
Ivan Solovev
6ce64c72c4 QSystemTrayIcon: remove unused deprecated call to QAction::associatedWidgets()
This call was added in bcaff2b06fc46fce8a3ae6d613c025c8d097229c but
does not seem to be necessary. So just remove it.

Task-number: QTBUG-104857
Change-Id: I2068bd10c6de211dd31f09ff978e8b8ba9cb70db
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 4ae85ae441ea683cbc67fdc1d2bdfcf66fa00bc3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-13 19:55:34 +00:00
Axel Spoerl
aa3d8e7d0f Fix wrong debug output upon creation of floating dockwidget tabs
When a floating dock is created, a qCDebug message is logged to
indicate the hovered dock widget. By mistake, the target pointer to
the floating tab is dumped, which is nullptr at that moment.
This patch corrects the debugging output.

Change-Id: I317f057ef4b2d8fe508be687152bcede61c22f46
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit b36d7076e4c6f566a296215816111cf4d71606a0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-13 15:17:09 +00:00
Ivan Solovev
9693867fed Do not use QExposedEvent::region() in internal code
Task-number: QTBUG-104857
Change-Id: I5ee41802ecc4d6291aaaa1f0efddd20027c1c1e4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 12262adebad5e4af2cf2c9a6dd41a941c78f1988)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-13 14:45:12 +00:00
Volker Hilsheimer
d84ee92ecf Use debug stream in QTest::toString's default fallback if possible
For built-in types, this is a compile-time assert - we should not have
any types in Qt for which we have neither debug streaming nor a
QTest::toString specialization implemented. A build of most of Qt
submodules passes with this change, after minor modifications to some
tests. We cannot declare QSizeHint::Policy as a metatype after the
QMetaType has already been instantiated for it, and the QDebug stream
operator for QElaspedTimer needs to be correctly declared within the
namespace.

Add a self-test function for a custom type, and update reference files
of the self-test.

Task-number: QTBUG-104867
Change-Id: I2936db5933f4589fce45f47cf2f3224ed614d8c9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 92e696b4bad52c40c6cdc1c5bf7c0c0ea8a2b283)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-13 13:14:43 +00:00
Shawn Rutledge
e8298aea01 Add QInputDevice::name() to output in device_information manual test
Task-number: QTBUG-104878
Change-Id: I4299228c90777d71f01c3e2607f8ad4af6e081ed
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 8d9301b413cb06d5bcc4b166616c3802dff79071)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-13 12:35:24 +00:00
Shawn Rutledge
3e906cb5f9 QXcbConnection::xi2ReportTabletEvent(): get device, check capabilities
In Qt 5, RotationStylus was a device type; in Qt 6, we have the
Rotation capability flag instead. The event does not tell us whether
rotation is valid or not, so to distinguish a valid zero value from
a zero that means it's absent, we need to check device capabilities.
Anyway it's better to get the QPointingDevice instance earlier and
call the newer version of QWindowSystemInterface::handleTabletEvent().

Fixes: QTBUG-104877
Change-Id: I896c02727d586381489f79fd4ebea3451adfa403
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 6749d69a15381e05e89f72f6a53bf4449f6d3910)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-13 12:35:22 +00:00
Shawn Rutledge
399fea0d21 Change "delivering touch to same window" warnings to debug messages
When you touch-tap a QPushButton, and that opens a popup, it's normal
that the touch release is delivered to the main window rather than the
popup: in fact QWidgetWindow::handleMouseEvent() expects to see a
synth-mouse release. No warning is needed. Amends
efc02f9cc301f98c77079adae026ffd07f50d5ab

There may be other cases when it should have remained a warning (it's
been there since 2692237bb1b0c0f50b7cc5d920eb8ab065063d47), but that's
hypothetical at this point.

Task-number: QTBUG-103706
Change-Id: Ie8cc62af4d173ada5138fd099d9f02bd41f4cff4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 03a691cecb91ea91394d40b0b7e1b15210fc5687)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-13 12:35:12 +00:00
Eskil Abrahamsen Blomfeldt
70ec343b9e Skip test which depends on window activations on Wayland
Wayland does not support window activation, so rather than skipping
tests based on platform name, we can use the platform capability
(which will also cover future platforms with the same issue)

Task-number: QTBUG-104241
Change-Id: Ibf5f8968f3979b789ef68f92768419bef4500fb3
Reviewed-by: Inho Lee <inho.lee@qt.io>
(cherry picked from commit 3fee97c4ab0796fcafcdea692ff7c7e83005a2aa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-13 12:35:11 +00:00
Kai Köhne
34751307bf Doc: Hide weak overload template magic from documentation
Hide the 'template magic' to implement Q_WEAK_OVERLOAD from the
documentation. So far Q_WEAK_OVERLOAD void foo() lead to

  template <typename> void foo()

in the generated documentation, which is arguably confusing to the
uninitiated. And people interested in implementation details & exact
overload resolution will arguably just read the .h files themselves.

Fixes: QTBUG-104851
Change-Id: I5e0b1b337b28e621e6a627241aa8037da0a879a7
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit f71aeea9329faf33d7161e6af88e2a94a35edb9f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-13 10:52:13 +00:00
Ivan Solovev
3483f8d26c Remove QStringView metatype declaration
It was required back in Qt 5 times, so that we could use
qvariant_cast<> or QVariant.value() on it. Not required in Qt 6
anymore.

As a drive-by: cleanup some unneeded includes in qstringview.cpp

Task-number: QTBUG-102350
Change-Id: Idbcdc5cfe62cf4a55b86e227106d7a997997e0ba
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 593b0a01c574e969168062011607b389eab5b983)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-13 10:52:11 +00:00
Fabian Kosmale
1bf9ccb4c0 QThread: Initialize bindingStatus for adopted threads
If we create a QThread from QThread::current(), we want it to have a
correct value for its bindingStatus. Thus, initialize bindingStatus in
the ctor of QAdoptedThread.

Task-number: QTBUG-101177
Task-number: QTBUG-102403
Change-Id: I3ef27ed62c5dc25eed05d551c72743a1b8528318
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 268ff00ef50a74ffa58e53c2c8897b7a7319be41)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-13 10:52:10 +00:00
Morten Johan Sørvig
e030b3fcef wasm: secondary thread blocking sockets example
Connects to echo_server via websockify, like the async version.

Change-Id: I9ed560cd388cfddbd0d284d8d40fb7ddf964ba96
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit 7e0711e0c0cbafa8d5dc5b06412397a7c2b9d9ee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-13 10:26:38 +00:00
Samuli Piippo
cde97bb6aa rcc: fix build when cross-compiling
The zstd feature is now public, which enabled it in rcc even when rcc
was cross-compiled, but rcc was not linked agaist zstd library.
There is no need to test for cross-compilation anymore or to add
the extra define.

Amends eda4919f252c53f313441afbedb4d0f98e94c9a

Change-Id: I23987ae0903759cf4f3fd17059c71c8815b8d908
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit d56f80fd9afd31d9458da87c64a41b15a67ba3cc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-13 07:50:19 +00:00
Volker Hilsheimer
591d8b4cc0 Windows: Turn on dark mode support by default
The implementation was already there, and handles theme changes at
runtime as well. However, it was disabled unless the QPA parameter
"darkmode" was set to either 1 (supporting only the frame) or 2 (the
Windows theme also supports dark mode when reading the palette).

With both Windows 10 and Windows 11 now having dark mode as a fully
supported feature that is easily accessible to end-users, we should
respect that setting by default.

So change the default: support both dark window frames and palette, and
let users turn this partially off by setting darkmode=1 or darkmode=0.

This does not mean accent colors etc are fully supported by the Windows
styles.

[ChangeLog][QtGui][Windows] Dark mode, both for the window frames and
for the palette, is now supported by default. It can be turned
off (partially or entirely) by setting the QPA parameter "darkmode=0"
(no dark mode support) or "darkmode=1" (darkmode support only for the
window frames).

Fixes: QTBUG-72028
Change-Id: Ia55af101896c106cde21340b306aa81390e608a2
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 43ef22045c6f4fbf76d5cfa4ca32160d919b9984)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-12 23:42:24 +00:00
Ivan Solovev
c7c42bad2d QMimeData: fix the usage of a deprecated function
Task-number: QTBUG-104857
Change-Id: I85b4aced4db2f1a77e6d0734e082f129b8a263bf
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 4262e3b6efc7fe2ba19f70a2ccba4d1c2699be20)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-12 18:43:21 +00:00
Ivan Solovev
711b35f3de QtBase: #ifdef out definitions of deprecated methods
Some of the deprecated methods didn't have their definitions guarded by
 if QT_DEPRECATED_SINCE(MAJ, MIN)

This patch fixes such cases over all QtBase.

Task-number: QTBUG-104857
Change-Id: I0106128f3a35a30c9f2949819f39076e773559e7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 12535b0c03bb4e5f4a8682623b0366d4d65b9b54)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-12 18:43:11 +00:00
Robert Loehning
bde89d8cb0 Fix building with "-sanitize fuzzer-no-link"
This partially reverts commit c25a5b4e1fc9e74f1f3ab1001db4fbae267d7831.

We need qtemporaryfile.cpp in the bootstrap library, because qfile.cpp
uses QTemporaryFileName - even if QTemporaryFile has been disabled.

Re-adding qtemporaryfile.cpp does not increase the bootstrap library's
size significantly, because since c25a5b4e1f we have
     #define QT_NO_TEMPORARYFILE
in qconfig-bootstrapped.h, and that disables compilation of
QTemporaryFile but leaves QTemporaryFileName intact.

Fixes: QTBUG-103805
Change-Id: I6947ca303edb36fc359bd5d07c1cbd88098905fb
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit c0a5f17679b2803c6a6bf0b01367fd53c9c83a48)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-12 17:07:56 +00:00
Volker Hilsheimer
e51a6755a7 qobjectrace test: Don't hardcode the number of threads
Use QThread::idealThreadCount instead. This requires that we use
QVarLengthArray, as MSVC doesn't allow us to allocate arrays with a
non-constexpr size on the stack.

By using as many threads as the system has cores, we are more likely
to detect race conditions reliably. On systems with fewer cores (in
particular on qemu platforms like QNX, where this test has been
failing a lot), we'll less likely end up with false negatives due
to timeouts.

Change-Id: Ie8631aef544ca7b53c06a0729d05459016745486
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 0dadb951b5249d13e78b009759dab6a6ec9dc537)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-12 17:07:56 +00:00
Joerg Bornemann
a2af888604 CMake: Propagate qtbase's original staging prefix to other Qt repos
If qtbase was configured with CMAKE_STAGING_PREFIX set to a path without
drive letter on Windows, we must ensure that this exact staging prefix
is propagated to non-qtbase repos.

We already had code that does this for CMAKE_INSTALL_PREFIX.  But since
9a74d94ff5fa63bfb23dcad1209e2844ef39908b we build our cross-built
packages with CMAKE_STAGING_PREFIX instead of CMAKE_INSTALL_PREFIX.

Move said code into a function and use it for CMAKE_STAGING_PREFIX too.

This fixes Android non-qtbase release libraries not being stripped in
our Windows Android packages.

This amends commit 037fd545c485e73ac68377a264c84208592dc74f.

Fixes: QTBUG-104827
Change-Id: I909f7f39bd0ef7b559619b69f756c042d6c528b0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 8cc58fbbc70d45ce29dab3c50638d33765bebcf9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-12 14:31:49 +00:00
Volker Hilsheimer
36ad69f86f QJniObject: Add template overloads for get/setStaticField
Allow specifying the Java class on which to set/get the field via its
corresponding C++ type, removing the need to explicitly provide the
Java type string.

Those were missing from a085a14d76553ebd1fa4a4a11a27110ee544a531, which
was noticed when porting QtConnectivity over to the new template APIs.

Change-Id: I8f324c9fcc486b4c6c2f2b9051f7eca0cbec0e91
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 7b6350fa7743fa4ca10f5aebe0962b6544604e33)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-12 14:31:49 +00:00
Alexandru Croitor
7db3759df6 CMake: Don't propagate openssl headers for the tls plugin
There's no reason to. It's not a Qt module, it's just a plugin and
does not expose any public headers.

Amends d754e43721e4f40a8dffa8b69ef883ca383a4a61

Task-number: QTBUG-96283
Change-Id: Idf56c82025b81fd6614ef7e1efeb015e89c84f93
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit f344f3d58e4814f4d64f837fe6f4237f0eb0556d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-12 11:31:12 +00:00
Alexandru Croitor
f6175f337f CMake: Process extra dependencies for plugin targets as well
We started recording extra dependencies for the QtNetwork TLS plugin,
but we never actually processed them to write out the necessary
find_package calls.
This broke static builds of qtopcua, because the OpenSSL::SSL target was
no longer created in the root scope, but only in some child ones like
src/opcua, whereas the target was referenced in generator expressions
in a different sibling scope src/declarative_opcua, leading to errors like

 CMake Error at lib/cmake/Qt6/QtPrlHelpers.cmake:116
  (file): Error evaluating generator expression:
    $<TARGET_LINKER_FILE:OpenSSL::SSL>
  No target "OpenSSL::SSL"
 Call Stack (most recent call first):
  lib/cmake/Qt6/QtModuleHelpers.cmake:837 (qt_generate_prl_file)
  lib/cmake/Qt6/QtScopeFinalizerHelpers.cmake:21:EVAL:1
     (qt_finalize_module)
  src/declarative_opcua/CMakeLists.txt:DEFERRED

Make sure to process the extra deps for plugins as well.

Amends d754e43721e4f40a8dffa8b69ef883ca383a4a61
Amends 3c233175523a61e734dd5cd9bdcbb2994566f7f0

Task-number: QTBUG-96283
Change-Id: I11876e0844198b3a794bc06b6691ee694fd3b1c2
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 3d1464fc15b6fde298d925b898fd737d28e8f6eb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-12 11:31:10 +00:00
Alexandru Croitor
05edf4b39c CMake: Clarify qt_record_extra_third_party_dependency docs
Change-Id: I458a5b488741c639650c8b3b6668c82c80b5e93f
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 0d1c16861a3761e28ee64eece215e4e5f2256bae)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-12 11:31:08 +00:00
Sona Kurazyan
17b70ce87d QDomDocument: add a missing full-stop to a warning message
Change-Id: I3c44afa466cbcb12fc0b44ad8bd1b52ded5f4ddd
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 5e8cc498a13778347628792991e743d83988ee8a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-12 11:25:09 +00:00
Eirik Aavitsland
30357e55d1 Improve widget painting under dpr>1 by enabling smooth pixmap scaling
Smooth scaling of icons etc. give far better visual results,
particularly with fractional dpr scaling. So enable this generally in
QStylePainter, and make more of the relevant widgets use QStylePainter
instead of QPainter directly.

Differences can be seen in the widgets examples, e.g. textedit,
gallery, stylesheet (Pagefold), mdi.

Task-number: QTBUG-96223
Fixes: QTBUG-101058
Change-Id: I3c34a455d097e5f6a6a09d3b020528b4fbda4d85
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c78ec505293ed576779c0ee7342746cde39281d6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-12 11:25:07 +00:00
Eirik Aavitsland
15830162f5 Fix printing of dpr>1 images on Windows
The win32 printing paint engine copies tiles of the source image into
temporary target images for printing. It does that using QPainter
painting. If there is a difference in DPR between source and target,
the painting will be scaled, leading to distorted results.

Fixes: QTBUG-99990
Change-Id: Ie7368655ef3abeece49fb1a6421e2d6ea7ed5e95
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
(cherry picked from commit 9e453dacc3855bafd3d7b692d76699c3bf07b9c6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-12 09:48:42 +00:00
Fabian Kosmale
6dbb5d3e45 QMetaType: Do not warn about unknown types in isRegistered
isRegistered naturally has the potential to run into unregistered
types; in that case, we should not print any warning.

Change-Id: I060b23199ed1d41f67ebe656ed3c396094edffd4
Reviewed-by: Stefan Gehn <stefan.gehn@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit e19bd973e3d15d62c6e959f52ae5db297b2fad7c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-11 11:18:26 +00:00
Giuseppe D'Angelo
c5685f6654 QString: fix lifetime issues with QRegularExpression APIs
QString has several functions taking a QRegularExpression: indexOf(),
contains(), and so on. Some of those have an out-argument of type
QRegularExpressionMatch, to report the details of the match (if any).
For instance:

  QRegularExpression re(...);
  QRegularExpressionMatch match;

  if (string.contains(re, &match))
    use(match);

The code used to route the implementation of these functions through
QStringView (which has the very same functions). This however opens
up a lifetime problem with temporary strings:

  if (getString().contains(re, &match))
    use(match); // match is dangling

Here `match` is dangling because it is referencing data into the
destroyed temporary -- nothing is keeping the string alive. This is
against the rules we've decided for Qt, and it's also asymmetric with
the corresponding code that uses QRegularExpression directly instead:

  match = re.match(getString());
  if (match.hasMatch())
    use(match); // not dangling

... although we've documented not to do this. (In light of the decision
we've made w.r.t. temporaries, the documentation is wrong anyways.)
Here QRE takes a copy of the string and stores it in the match object,
thus keeping it alive.

Hence, extend the implementation of the QString functions to keep a
(shallow) copy of the string. To keep the code shared as much as
possible with QStringView, in theory one could have a function taking a
std::variant<QString, QStringView> and that uses the currently active
member. However I've found that std::variant here creates some abysmal
codegen, so instead I went for a simpler approach -- pass a QStringView
and an optional pointer to a QString. Use the latter if it's loaded.

QStringView has some inline code that calls into exported functions, so
I can't change the signature of them without breaking BC; I'm instead
adding new unexported functions and a Qt 7 note to unify them.

Change-Id: I7c65885a84069d0fbb902dcc96ddff543ca84562
Fixes: QTBUG-103940
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6f852935e0c847f91c7d6ffca455a74307ebe26d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-11 00:05:01 +00:00
Volker Hilsheimer
25695a4826 testlib: Don't print QCOMPARE values if they lack string representation
Before 0681a2dd5a8095baddb5905fb21a58ce19b958c5, QCOMPARE'ing types
for which no QTest::toString specialization exists did not output
Actual and Expected lines on failure, as that would only print <null>
for both values (which then look like the same value, confusingly).

Commit 0681a2dd5a8095baddb5905fb21a58ce19b958c5 changed that behavior,
and started printing the confusing <null> values.

Take care of the logic in the formatFailMessage function: if both values
are nullptr, then print only the variable names, but not the confusing
<null> text representation of the values.

Remove dead and duplicated code related to the formatting logic, add a
self-test function, and update the expected_cmptest files.

Fixes: QTBUG-104867
Change-Id: I4be98e79f91196b14690a2cc0a68ffd50b431a45
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 54b276be0b5885bbaee2c38f472eb39731fd684a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-10 19:59:57 +00:00
Yuhang Zhao
c6ceb1e53f QSysInfo: update docs to mention the latest os
Update to the latest stable version.
Beta/preview versions not included.

Removed Amazon Linux AMI because it's no longer maintained.
Removed tvOS because it now shares the same version with iOS and iPadOS.

Change-Id: I40e5286b132b8198bf315a2868f89428e8c2f23a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 14ce67629bd36f75b2a9a0b3caf5c4c5d59abeac)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-09 15:07:27 +00:00
JiDe Zhang
b98b683bdc Always update QPalette resolve mask, regardless of QBrush change
56bd1b76d2e81c58a80bf6b5d74219c6b1ab8499 changed the update
resolve mask behavior in QPalette to avoid detaching brush data
when modifying the resolve mask if the brush value is not changed.

But this behavior broke compatibility, it introduced unknown risks, and
we cannot ensure that other code in Qt does not depend on the old
behavior.

We both need to ensure that we don't detach when the value is not
changed, and ensure that the resolveMask is always updated regardless
of whether the value changes, so we need to split them up and
independently share the brush data.

QFont will update its corresponding resolveMask even if the value has
not changed, so it is better to correct this behavior so that QPalette
and QFont are consistent.

[ChangeLog][QtGui][QPalette] Always update resolve mask in
QPalette::setBrush, even if the value of brush has not changed.

Fixes: QTBUG-98762
Change-Id: Ib845361b30f21c3d78c16ced923c1678b12e05ac
Reviewed-by: JiDe Zhang <zhangjide@uniontech.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 1d961491d817490da156769ddce6fce48a0bce4a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-08 17:09:12 +00:00
Alexandru Croitor
d8808604b7 CMake: Don't create duplicate plugin targets in shared builds
when building Qt repositories.

When building for example qtquick3d, the Qt6QmlPlugins.cmake
file should not load the qtquick3d specific plugin config files
because the targets will be created as part of the build and cause
duplicate errors.

We already did it for static builds, but now we also do it for shared
builds.

Amends 7d6f1ee5a75cae9d122a3f0c7b3a6d03f380535e
Amends 98e8180e56322ce065e39cc1ef1d65b54caa8c25

Task-number: QTBUG-94066
Change-Id: I66ca71dfa6485eded94c1ecb5eb3b23daf908b39
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit bea66711d81a0fc66cde6638297b2b297963cc94)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-08 15:40:16 +00:00
Richard Moe Gustavsen
c0db9e9082 QWidget: use WA_InputMethodEnabled when ImEnabled is not implemented
In Qt 6.3, a check for WA_InputMethodEnabled was removed
in QWidget, to support IM queries also for read-only
widgets (7c6e4af48). This caused a regression on iOS, which
made the input panel open for widgets that didn't support
IM at all.

A patch was merged that solved the regression (3b12305575),
but it didn't take the widget attribute into account.
Since not doing so has the potential to cause regressions,
this patch will modify the affected code once more, so that
we instead fall back to test WA_InputMethodEnabled when
ImEnabled is not implemented. This will match closely
to the way ImEnabled was implemented in Qt 6.2.

Since we, with this change, now require that either ImEnabled
or WA_InputMethodEnabled is set, our own input widgets will
fail to support IM text selection when they're read-only, since
they actually don't implement ImEnabled.
This patch will therefore also make sure that we do so.

Task-number: QTBUG-104527
Change-Id: I70ad910aec38d0a74f4dd7d3115d3c45c16d2b3b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e44edaac2c575df9b2f065b18b716cb21a0c2b75)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-08 12:18:24 +00:00
André de la Rocha
c9c3f57883 Windows QPA: Implement Selection UIA pattern for QTabBar
Adding Selection pattern for tab bars and SelectionItem pattern for
tab items, which are required for accessibility compliance.

Fixes: QTBUG-104740
Change-Id: I0e3b1cfbf4838d8bc8b5bc2e2d7c9d372ac8b99d
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 083ff27518a735e39563d1bae9c40ffbc7c1d527)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-08 12:18:22 +00:00
Tor Arne Vestbø
4ef77e81b3 QFontDialog: Check if native dialog is in use before using
A call to platformFontDialogHelper() will lazily create the helper,
and is not enough to distinguish whether the helper is actually in
use. The explicit nativeDialogInUse flag also takes properties like
DontUseNativeDialog into account, which may be set after the dialog
is first constructed.

Fixes: QTBUG-104696
Change-Id: Ia00a39bba4aaae8c99ae0cdd6543c2e451f72ea6
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit efbcc80010005ee62d23f6814ec5c01310abf1df)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-08 12:18:20 +00:00
André de la Rocha
091cbe3e11 Windows QPA: Report the expanded/collapsed state of tree items
Implement the ExpandCollapse UI Automation pattern for tree items,
so that accessibility tools like MS Narrator are able to report the
item state.

Fixes: QTBUG-103988
Change-Id: I1529bdb0104c6e29d8f28bc0bbb8a7fa4670c7ef
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 9aaf105bad79203065d5e947acfc08d1c82faf86)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-08 12:18:17 +00:00
Morten Sørvig
8785f7014e Revert "Apply ScaleFactorRoundingPolicy to QT_SCREEN_SCALE_FACTORS"
Unblock the qtdeclarative dependency update.

This behavior change is causing a regression for QQmlPreviewHandler's
zoom feature. Back out of the change for now, until we can find a way
to make both use cases work.

This reverts commit 1c0a56a2f3300750978f2d6c703b2b917e03e718.

Change-Id: I1b3d84504bbcb4f2b2250a20194fdaf4ab4fd97f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 4cc84dc31c27f9c266106aba8e1e08f652e93c4c)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-07-08 07:29:16 +00:00
Shawn Rutledge
100c4cd130 Make it possible to check the accepted state of touch events in tests
QTouchEventSequence simulates a QPA touch event, potentially containing
multiple points. (Despite the name, it only calls qt_handleTouchEvent()
once, so it cannot really send a sequence of events; however, one event
can contain multiple touchpoints.) Delivery is synchronous, and we keep
return values through the QWindowSystemInterface::handleTouchEvent()
template functions; so the remaining step is to return a bool from
qt_handleTouchEvent(), so that we can return a bool from commit().
This allows tests to see the same perspective as a platform plugin can:
check whether the event was accepted or not, after delivery is complete.
Some tests in Qt Quick need to start doing that, to enforce correct
behavior in QQuickDeliveryAgent.

[ChangeLog][QtTestLib] QTouchEventSequence::commit() now returns a bool
so that tests can check whether the event was accepted during delivery.

Task-number: QTBUG-104656
Change-Id: I9cf87909a3f847dedbdeca257013e309ac19cf0d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit e1f25b1c8df04fbbc13af1e2e8ecc1def1cfb3dc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-08 07:29:16 +00:00
Juha Vuolle
d940c69884 Add support for scoped JNI callbacks
This commit adds macros for declaring scoped native callbacks which are
in namespace or for example defined as static class member variables.

The existing macros don't allow this as they use QtJniMethods namespace
and the introduced callbacks' namespaces are not enclosed in that
namespace, yielding a compilation error.

Change-Id: I754560bea7e9a1b57c2661d1ee7236e78db39ba1
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c5caab1f150dadc51219f3bbfb8d4fee7f23703f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-08 07:29:16 +00:00
Joni Poikelin
49dd11fe34 Fix crash in QKmsDevice::createScreenForConnector
Fixes: QTBUG-104809
Change-Id: Ic71311e5cb674da46a4a1065dae739bc9ac6e285
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit da43c180c84a5b159efc2535c29cf8b8fbff0f61)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-08 04:11:46 +00:00
Waqar Ahmed
8b8c26e0a6 Move QObjectPrivate::Connection* structs to a new header
Partially reverts 06c2478

Even though these structs are not meant to be used anywhere outside
QObject, some special applications like Gammaray need them to get
details about connections.

Fixes: QTBUG-104734
Change-Id: Ied73021e317cc6aed6192c229d9450ae48b6774c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 97ec867ab55e8df544d86827ee8868054a2deb59)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-07 19:23:31 +00:00
Mike Achtelik
68158a8ae9 Android A11Y: Add content change type to content change event
This fixes a problem where the accessibility tree is not correctly
updated, when using e.g. a StackView. The problem was, that sometimes
when pushing items of the previous view where still selectable via
TalkBack. When popping this sometimes lead to some views not being
selectable because the subtree wasn't updated. To solve this, lets tell
android directly that the subtree changed when invalidating a view.

Fixes: QTBUG-102825
Change-Id: Ifbf8da1b95f02935b9bcffabfe821547b1128103
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit d48ebb02fb171d0b6fe3749a28a312fc624f8b8e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-07 06:23:54 +00:00
Ilya Fedin
3f473f4025 QGtk3Theme: Respect xcb_xlib config option
Change-Id: I4b01a694e8a13a6f009296d8ccfa8f8eb21043e4
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit dbe858bf80f554c4d916ee230fc9dcde01699bd7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-07 01:15:11 +00:00
Ilya Fedin
c4e0c5fad6 QGtk3Theme: Ensure gtk uses the same windowing system as Qt
Fixes: QTBUG-69354
Change-Id: I254c5bf98bc3b2cc2577159e475a2105438bb96b
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 3d45f23b022878444454ec1a47c25678b88868c6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-07 01:15:11 +00:00
Sona Kurazyan
2b7c44f5cb QRegularExpression: fix a typo in docs
Change-Id: Id7db7d0b833fc6b6000a04ff7ee8a5a7d164d7de
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit a6acb2453f4f6010283426e0c099145c22292146)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-06 18:19:08 +00:00
Ilya Fedin
199d22e597 QGtk3Theme: Use GDK X11-specific API only built with X11
And respect xlib config option

Change-Id: I596097259ed008357e739c3cfe41ab2fc4e18db7
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit edee40a179021323ebc0f7aafff506be3d34ef55)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-06 18:19:08 +00:00
Sona Kurazyan
47b99a474c Revert "QFutureCallOutEvent: de-export again"
QFutureCallOutEvent is used externally, so it needs to be exported.

This reverts commit 3141a13b2a5c3cf770e072e49d43c86f376688e5.

Fixes: QTBUG-104732
Change-Id: I82c9e7414192ee948f78259bd74a404691a7805a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 6ad481c31f7a4658e185dd9c6832b81d91d5a1ec)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-06 18:19:08 +00:00
Sona Kurazyan
845f61b69a Porting guide: recover the missing section title
4cc1d81d79da912fefe1cd36fcde159e1bbd31e5 accidentally removed the
section title, recover it.

Change-Id: Idb4e5732f181505b8b9eebb1bf3635741a084657
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ed715cf8a70b26f1348769c28f0e07a03361e8be)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-06 18:19:07 +00:00
Samuli Piippo
adec393957 rcc: teach qmake not to use zstd when not available
The zstd feature might have different values between the host
and target, in which case qmake must tell rcc not to use zstd
when the feature is disabled.

Amends 14546d1816a877690cda71f02c275303ef42afa8

Fixes: QTBUG-103794
Change-Id: Ia0378742a50e2a85f59985dea2506d3dda5f28e8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 6eda4919f252c53f313441afbedb4d0f98e94c9a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-06 18:19:07 +00:00
Joerg Bornemann
a7dc4ce808 Make WrapOpenSSLHeaders an optional dependency of the OpenSSL plugin
When configuring Qt statically with OpenSSL support on macOS,
configuring a user project would fail, because WrapOpenSSLHeaders could
not be found.

Configuration fails, because we don't record OPENSSL_ROOT_DIR anywhere,
and WrapOpenSSLHeaders is a required dependency of the OpenSSL plugin.

Make the WrapOpenSSLHeaders dependency optional like WrapVulkanHeaders
for QtGui.

Note that when Qt is statically configured with -openssl-linked on
macOS, configuration of user projects will still fail like described
above.

Fixes: QTBUG-96283
Change-Id: I0893e18767387ea849c7e5661f5421b71e3f64ab
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit d754e43721e4f40a8dffa8b69ef883ca383a4a61)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-06 18:19:07 +00:00
Morten Sørvig
98f053f988 wasm: use simpler syntax for EXPORTED_RUNTIME_METHODS
Recents emsdk versions support specifying the method list without
using brackets. Switch to this syntax since that avoids any quoting issues.

Change-Id: Ib7bf8ec3f0d2ef67e8222a23e7af9b368ee99a00
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 5b23f08b811ac238d20767e48e0ee1457c0fb8e6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-06 18:19:07 +00:00
Morten Sørvig
c58b7974fe wasm: remove message handler lock
We have now upgraded the minimum emsdk to one where Emscripten properly
synchronizes stdout/stderr output.

Change-Id: I537897b31916a52303a3fdb1d255f03b4aeaffef
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 36fa489cb8e078b6b0c45647a4bef7260d78d7fb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-06 18:19:07 +00:00
Marc Mutz
afa7f494eb moc: fix GCC -Wuseless-cast warnings
When being queried for QMetaObject::IndexOfMethod, qt_static_metacall
would compare the argument with each of the class' methods'
addresses. Taking the address of an overloaded function is ambiguous
unless you cast to the right type, which the moc-generated code did
using explicit static_cast<>s. If the function is not overloaded, GCC
would warn about the static_cast<> being "useless", which isn't wrong.

Fix by using an implicit cast to a local variable of the correct type
instead of an explicit cast. Since there's no explicit cast anymore,
GCC doesn't warn.

Code before the change:

  using _t = void(Counter::*)(int );
  if (*reinterpret_cast<_t*>(_a[1]) == static_cast<_t>(&Counter::valueChanged)) {
                                       ^--------------------------------------
				              -Wuseless-cast
      *result = 0;
      return;
  }

After:

  using _t = void(Counter::*)(int );
  if (_t _q_method = &Counter::valueChanged; *reinterpret_cast<_t*>(_a[1]) == _q_method) {
      *result = 0;
      return;
  }

Since we're using a C++17 construct, we can't pick to 5.15.

Fixes: QTBUG-71938
Change-Id: If6ba4bf17b3bf7f64e9662ba9d085273882fb460
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 20a1526a23d23c32eca2bfd9b3194e30771902ac)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-06 18:19:07 +00:00
Marc Mutz
9e092ec83b Remove uses of Q_ATOMIC_INT{8,16,32}_IS_SUPPORTED
It's always true these days, assert so in qatomic.cpp and
tst_QAtomicInteger.

Update the docs.

Change-Id: I3684cff96c1d2e05677314e29514cc279bd6b1a1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 0587d4752d8fb814d47a599130d98724d78b1525)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-06 18:19:07 +00:00
Marc Mutz
d39c01b830 tst_QGraphicsScene: fix -Wsuggest-override
Add the override keyword.

Amends 2e12479e06d6869f568f0a7ee939453cda9afdbf.

Change-Id: Ic62dd33b1ee52983481e39e862b9bd87695f5044
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 0231971b3e9a21897fe8a0584d96a7f026b11710)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-06 18:19:07 +00:00
Morten Sørvig
a63e652d38 wasm: don't access deleted settings objects
The emscripten_idb_async_ functions are async, so there
is no guarantee that the QSettings object which made
the request will be live by the time the completion
callback is made.

Keep track of live QWasmSettingsPrivate objects, return
early from the callbacks if userData does not point
to a valid QWasmSettingsPrivate.

Change-Id: Ia319b1875dcf2c329ba27954e3f026e004fe0aac
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit 25c2d05340eee01cf55457b8327f8f69d408879a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-06 18:19:07 +00:00
Marc Mutz
7cdcbbeb07 QAtomicInteger docs: mention bool and char8_t as 8-bit types
Change-Id: If673ba1e891e034dfe5e441b1e3427f3365320e6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c0385f0cee52a5bb17e95cbdedda3dbff5f60b53)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-06 18:19:07 +00:00
Marc Mutz
fffc65cef1 QLocale: move some static_assert()s from _p.h into .cpp
There's no point in having each TU that includes this header unit-test
the ascii_isspace function anew.

Amends 7f9398fd4d23469c77c6a53eac0819f92dfc3928.

Task-number: QTBUG-97601
Change-Id: I17addc3256f4afafb8ec6a86116654b0099efcda
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
(cherry picked from commit 480a459f6543be2723c58b3eed711232e41f58b7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-06 18:19:06 +00:00
Morten Sørvig
be3f589d17 Apply ScaleFactorRoundingPolicy to QT_SCREEN_SCALE_FACTORS
QT_SCREEN_SCALE_FACTORS in many cases set on behalf of the user,
instead of by the user, so we should make it less sharp and more
in line with standard high-dpi configuration.

Specifically, make it subject to the rounding policy set by
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(). This
means that applications which support integer scale factors
only will see integers only, also when QT_SCREEN_SCALE_FACTORS
specifies a fractional factor.

Users who want to override can set

  QT_SCALE_FACTOR_ROUNDING_POLICY=PassThrough

to restore the default Qt rounding behavior.

[ChangeLog][QtGui] The high-DPI scale factor rounding policy (settable with
QGuiApplication::setHighDpiScaleFactorRoundingPolicy() or
QT_SCALE_FACTOR_ROUNDING_POLICY) now applies to scale factors set
with QT_SCREEN_SCALE_FACTORS.

Fixes: QTBUG-95930
Fixes: QTBUG-99546
Change-Id: Ibb0aa5cb9d3a356d33429d0efe69d984b2530728
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 1c0a56a2f3300750978f2d6c703b2b917e03e718)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-06 18:19:06 +00:00
Mårten Nordheim
d3d9c26896 Compiler macros: remove accidental undefs
I'm not sure why they're here, but they only undo the work
from earlier.

Spotted in the API review

Amends 20104bb237d5231640649bcc610d4e51e03ea617.

Change-Id: Ifc0fa66a304f819c1f59ef8e4e498ab14f859ef8
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 1e4673e8b0a88e017f66299208c688a6fd09cce5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-06 15:15:06 +00:00
Joerg Bornemann
5d40bebc85 Fix potentially wrong version in Windows resources of Qt plugins
qt_internal_add_plugin calls qt_set_target_info_properties with the
TARGET_VERSION argument and passes arg_VERSION.  However, the function
qt_internal_add_plugin does not have a VERSION argument.

If arg_VERSION is set before calling qt_internal_add_plugin, that value
will be used, and that could be wrong for the plugin.

Remove the TARGET_VERSION argument from the
qt_set_target_info_properties call.

Change-Id: I0ae9e0e6636d74fdc20e6ab9ca525c5a9126000c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit df764df3ea6264fd8e7ccdbd32ce11b2bcf26982)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-06 15:15:06 +00:00
Rami Potinkara
624f69e7a7 Update Gradle to 7.4.2 and Android Gradle Plug-in (AGP) to 7.2.1
Gradle 7.4.2 and AGP 7.2.1 versions are the latest at the moment.

Fixes: QTBUG-103711
Change-Id: I871d1331e0340e1cda7dbbc0799bb2c20aed6146
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 8bf9769d545234b1c654f82a77761c2e5f780f33)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-06 15:15:06 +00:00
Tor Arne Vestbø
bed48057e7 iOS: Explicitly link to IOKit
We use it to implement QSysInfo::machineUniqueId()

Change-Id: I9303001cbc3e5e6716ee57ce9ae785dba08ba88f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit b692d7b268948d9af0a9c0e9e188074e2347eecb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-06 10:18:08 +00:00
Tor Arne Vestbø
7b796be6b3 Darwin: Replace deprecated symbol kIOMasterPortDefault with equivalent
We can't use the replacement kIOMainPortDefault yet, as it's not
available in operating system versions we still support, but the
kIOMasterPortDefault documentation explicitly says that passing
NULL as a port argument indicates "use the default".

As the underlying type of a mach_port_t is potentially either
a pointer or an unsigned int, we initialize the default to 0.

Change-Id: I288aa94b8f2fbda47fd1cbaf329799db7ab988a0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 337f28c9abb12f28538cfe2f49e5afc460578b32)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-06 10:18:05 +00:00
Mike Achtelik
f1fe0e76ac Android A11Y: Fix deadlock in QtAndroidAccessibility::runInObjectContext()
On android the event loop is normally blocked, when the application
is suspended, e.g. when it enters the background or when the screen is
locked (see android.app.background_running). This leads to a problem
when we try to process events after this happens, e.g. when android
sends us an ACTION_CLEAR_ACCESSIBILITY_FOCUS event after the event loop
is suspended. While handling it we eventually call
QtAndroidAccessibility::runInObjectContext() which tries to do a
blocking call on the object context, however, with the event loop being
suspended we run into a deadlock which leads to an ANR.  So we need to
make sure to never make a blocking call while the event loop is
suspended.

Task-number: QTBUG-102594
Change-Id: I33f0440a3da84fb4bdae5ab0fc10d514c73f23ad
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit ac984bd8768b3d7e6439e0ffd98fd8b53e16b922)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-05 16:31:57 +00:00
Yuhang Zhao
f845a2f0b8 Windows: Fix OpenGL window's screen
The "GpuDescription::detect().gpuSuitableScreen" is a device
name like "\\.\DISPLAY1", not a user-friendly name.

Amends commit qtbase/75f22702933bad4f0da2b63a94ea183021771e4c

Change-Id: I525ecd026f3ee3bc467834449ae023ebfa1138c1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 100d5bd58296a02d989526a884f987dd9f388369)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-05 16:31:56 +00:00
Timur Pocheptsov
5dd3aebed3 tst_QSslKey: prepare for the migration to OpenSSL v3
Many algorithms (ciphers etc.) had become 'legacy' in OpenSSL v3,
meaning they are not available by default. Since we don't mess with
loading providers and don't load the 'legacy' one, we have to
skip tests involving such algorithms.

Fixes: QTBUG-104232
Change-Id: Ieceabeb080e531aeb24f733cb8c83ad08a25049c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 7949dab8abbc65b11650e1f91a797889fe834090)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-05 15:36:13 +00:00
Allan Sandfeld Jensen
b601eb7dab Remove Q_DECL_VECTORCALL when SSE2 is not available
It expands to sseregparm in gcc, and then can't build with SSE2
disabled.

Fixes: QTBUG-104726
Change-Id: I063ed87ed7f7ba683a19cd3f6e8a25c5111ef72a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d85dff3775b00dde079c50bcf417cae5ed884512)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-05 15:26:45 +00:00
Tor Arne Vestbø
fb7a866653 macOS: Ignore deprecation for kOnSystemDisk icon domain
There's no good replacement yet, so for now ignore the deprecation.

Change-Id: I56928b73c47b677e3fdafd35cc5ae558e5285314
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f7b4eaba590251339eea9a9ec981e80db55f263b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-05 15:26:45 +00:00
Ulf Hermann
17279d25a9 QStringConverter: Do not use std::optional::value()
value() can potentially throw an exception. We know that it doesn't in
this case, but the compiler doesn't know. And our code checker doesn't
know either and generates lots of false positives. Also, without the
exception propagation code the resulting binary is probably smaller.

Coverity-Id: 386110
Coverity-Id: 384314
Coverity-Id: 383835
Coverity-Id: 383784
Change-Id: Icdacf8e003fd3a6ac8fd260ed335239a59de3295
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit af6b6c8e7cd5ba13a7175db890b21970a1ff82d4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-05 15:26:45 +00:00
Tang Haixiang
4c0bbf5179 tst_qwindow: modify some abnormal touch tests
Under normal circumstances, when the second point is touched, the
first point has not been released, and the message at this time
should contain two touch points. We are simulating the case where
the message is lost when the popup is closed by touch. Amends
efc02f9cc301f98c77079adae026ffd07f50d5ab

Change-Id: Ic722e3dbd615c46076ede26611d0107501c5e274
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit c2a63b40140e09ad12bec54714302db5baad9d35)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-05 15:26:45 +00:00
Tang Haixiang
4795514230 QListview: PageDown/Up infinite loop
When item.height > viewport.height, the next item is not found
correctly, resulting in an infinite loop.

In this case, move directly to the next item.

Change-Id: I67a40a079ca9dd9189bf84ae550758c685b83d75
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 551127209e6c45fcbbd176a65ad425c47c9bc09c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-05 15:26:44 +00:00
Alexandru Croitor
f417af638f CMake: Create and include plugin packages in shared builds
Previously QtModulePlugins.cmake files were only created and
included in static library Qt builds.

Having the targets available in shared library builds would be
useful for custom project deployment purposes. One could query
the location of the plugins or use various generator expressions
referencing their location.

Ensure we always generate and include the QtModulePlugins.cmake files
regardless of the build type.

Allow opting out of including the files by setting
QT_SKIP_AUTO_PLUGIN_INCLUSION to ON, just like we allow for Qml
plugins with QT_SKIP_AUTO_QML_PLUGIN_INCLUSION.

Fixes: QTBUG-94066
Change-Id: I69a5dc17762a8e43265578fc33b82b5c4b7a1f5c
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 7d6f1ee5a75cae9d122a3f0c7b3a6d03f380535e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-05 11:32:55 +00:00
Alexandru Croitor
1134f9ed15 CMake: Move plugin package inclusion logic into a common function
Don't duplicate the logic of plugin package inclusion for each Qt
module. Instead move it into QtPublicPluginHelpers.cmake.

Task-number: QTBUG-94066
Change-Id: I5e1f5176a0e754ed56a792c97865752529462617
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit ff4be4cf30ec470ab00290c629bb1bc311b77e22)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-05 11:32:54 +00:00
Alexandru Croitor
8f728dcce2 CMake: Improve 'Generating Plugins' message
Use message(STATUS) for the 'Generating Plugins' message.

This way it will go to stdout instead of stderr, which follows the
convention we have for most of our other messages.

Also list only the modules that actually have plugins, rather than all
known modules.

Change-Id: I1ea0ed71418ede54790cabd32e03e82fc69f2858
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit eb8da02d055f8f761880da33b02342ca2d69b1a5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-05 11:32:54 +00:00
Sona Kurazyan
ffaa007e0e QDomDocument: some doc fixes
- removed outdated docs about QXmlParseException (a leftover from
   SAX-based implementation)
 - replaced 0 with nullptr
 - fixed a typo

Change-Id: I96362be8bb6a5f1b23eb8999416b6b04228e0a5f
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit d4f631ce515576b3613f1b2ed3f4da137b9708a5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-05 11:32:54 +00:00
Sona Kurazyan
3de5d107dc QDom: Use the default for assignment operators in QDom* classes
These classes are all derived from QDomNode, and their assignment
operators are directly or indirectly calling the ones from QDomNode
by explicitly converting to it. We can just use the default assignment
operators instead.

Change-Id: I1e3d4eef2188d124e5d54a909eb18bb93ddaa110
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 23d2d57d922dbb6e2b9e03ec27c7de254e4920aa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-05 11:32:54 +00:00
Marc Mutz
bf0b5dc516 qgraphicsitem_cast: replace 0 with nullptr
While headerscheck doesn't detect this (generic code), this might
trigger warnings in user code.

Change-Id: I6183323d0a1c73b021699d4c4afa2d1fcf71aad2
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit a9cabed4399fa73cdd741d781426205128c35ea3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-05 11:32:54 +00:00
Topi Reinio
2a056cd39f Doc: Fix QJniObject::construct() documentation
Even though QDoc accepted the \fn signature without a class scope,
the documentation does not end up on the class reference unless we
mark construct() as a member of QJniObject.

Change-Id: Icae44f8eb24aa6b269242084479e735f2637c312
Reviewed-by: Luca Di Sera <luca.disera@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 4a14a9c0141eba78d10628a92fc08a8765c5798d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-05 11:32:54 +00:00
Laszlo Agocs
909637b49f Harden drag and drop handling in widget window
User code in an event handler can do arbitrary things, including
operations that lead to destroying the QWidgetWindow. An example is
what the autotest does: reparenting the top-level widget to under
another top-level upon the drop. Internally this leads to destroying
the drop target's QWidgetWindow as the widget is now a child, not a
top-level.

In fact some of the existing drag and drop handling code seems to be
prepared to handle the case of having the drag target widget destroyed
in the user's event handler during a drag-move. But none of it is
prepared for having the QWidgetWindow destroyed upon returning from
forwardEvent().

The associated bug report has the same root cause, it is just popping up
now via the new 6.4 behavior: adding a QOpenGLWidget to a widget
hierarchy upon a drop leads to getting a new QWidgetWindow (if the
window only had regular raster widgets before).

To solve this, avoid touching members on 'this' after the
forwardEvent(). It looks like the handlers for mouse events follow
this pattern already, no member data is touched after forwarding events
(not sure if that is intentional or just incidental but it is the safe
solution, even if this is not feasible everywhere, but ideally input
events should take this into account).

Fixes: QTBUG-104596
Change-Id: I96c704cadcd799fc5619b776e939dfdf313a27dd
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit dab0ef367089869910c38fe772f31da14fd5386e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-05 11:32:54 +00:00
Ahmad Samir
b3a6136000 QLayout: add className() to a warning message
Since objectName() isn't always set, the className() makes it slightly
easier to find and fix the issue.

Also unify some wording "produce a warning", which is generic enough to
fit:
print warning in terminal
print warning in logviewer (if you're unlucky and have to use Windows?)
print warning in system journal (if you're unlucky have to use binary
systemd journal logs)

Change-Id: I7522d65666cb5829c33c45039b8646dd535e21ea
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 60c69b4da52b4b90e74af569c859c992e8e910fe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-05 11:32:54 +00:00
Volker Hilsheimer
f33f6ddada Doc: add missing "see also"
Change-Id: Ibeb7d48a8c4c3e0e2000280bd85db943fc73c1c7
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit 76b07b05f0dee0ff412910a45c600ca3ffb7fc23)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-05 11:32:54 +00:00
Juha Vuolle
814ccaa016 Add support for naming JNI functions with the unstringify macro
The manually defined native JNI function tables allow defining a name
that may be different from the actual function name; this name is then
used from the Java-side.

This can be useful to provide also as an option with the new
"unstringifying" macros which can help for example in porting code
to these new macros.

Change-Id: Icfebfb351cb8dfb122795d20b37e2eac167a41bf
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 58fd12a487cd2c628d713d1c42f8b53f8c4e9550)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-05 11:32:54 +00:00
Alexandru Croitor
64a0cbe9ea CMake: Fix qml plugin prl files not to have hardcoded paths
The previous fix 754512a64dffa20165e5b08b77e34b82c072f7f8
did not handle qml plugins, which meant that they would still have
hardcoded paths and see warnings like the one below when generating
the prl files

 CMake Warning (dev) at
 cmake/QtFinishPrlFile.cmake:103 (message):
  Could not determine relative path for library
  qml/QtQml/WorkerScript/libworkerscriptplugin_debug.a
  when generating prl file contents.  An absolute path will be
  embedded, which will cause issues if the Qt installation is
  relocated.

Handle qml plugins as well.

Amends 754512a64dffa20165e5b08b77e34b82c072f7f8
Amends f4e998125981038e5e50dab8cc56039faaa0b750

Fixes: QTBUG-104708
Task-number: QTBUG-104396
Change-Id: Icfb1069d1cb0a39a35004b20e58ee6e386d14f3b
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 9ea2f7f4b1192f3429aa2d3e278097008bc773bb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-05 08:18:23 +00:00
Alexandru Croitor
a83a943bff CMake: Don't force CONFIG mode when looking for system PCRE2
This allows picking up 3rd party Find modules. One use case is
Conan-generated Find modules.

Also add TODO in case we ever need to handle finding the upstream
target name rather than the Hunter chosen one.

Fixes: QTBUG-104542
Change-Id: I243987c657f74e8127076666d9734b2b657bc0ee
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit af56a6f0cb61b45b13fe9efde12bc39b01030fc7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-05 08:18:21 +00:00
Alexandru Croitor
3e36d8144e CMake: Fix confusing FPHSA zstd version warning message
Previously if zstd was not found, one would see such a warning message

 Could NOT find WrapZSTD: Found unsuitable version "", but required is
 at least "1.3" (found ZSTD_LIBRARY-NOTFOUND)

This is because PC_ZSTD_VERSION was a defined variable with an empty
value, which makes FPHSA believe that a version was extracted from
somewhere.

Avoid passing that value directly.

Now the warning message is

 Could NOT find WrapZSTD (missing: ZSTD_LIBRARIES ZSTD_INCLUDE_DIRS)
 (Required is at least version "1.3")

Change-Id: I88760d94db0d869d328085996298f4aaa88bc6c2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit d59628881e0b35d10fa4cf7ba7b892b07cc18106)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-05 08:18:14 +00:00
Alexandru Croitor
0284168bc3 CMake: Rewrite double-conversion find module
Rename FindWrapDoubleConversion.cmake into
FindWrapSystemDoubleConversion.cmake.
Merge contents of Finddouble-conversion.cmake into the one above.
This allows users to provide their own Finddouble-conversion.cmake
file (Conan can do it).
Don't mark the system package as required, because we have a bundled
one too.
Add link to upstream.
Make sure to show either Config file or library path when one is
found.

Fixes: QTBUG-104541
Change-Id: I9ea2330697c6fc280328849ca11522291c4073d8
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit a310319a0409c1faa1d2fc83c740e009f46dba84)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-05 08:18:13 +00:00
Alexandru Croitor
35e626cbbc CMake: Fix lookup of system PCRE2 version
The version option needs to be specified before the COMPONENTS
option, otherwise it is treated as another component.

This causes failures when a Conan provided FindPCRE2.cmake script is
picked up, which actually does validation of component names based
on the component information stored in the conanfile.py recipe.

Move the version value to be before COMPONENTS.

Amends 1007aac63a378c1b09f221f9b58b65bb56f9e9e8

Task-number: QTBUG-104542
Change-Id: I92c70f266a07c4aabdadcecda1ba7e107a033604
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit bfd9e195a3b5312c3814a933bbc1bc5d9c76973e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-05 08:18:11 +00:00
Lorn Potter
3757e14cfd wasm: enable sql/sqlite for non threaded builds
[ChangeLog][QtSql][Wasm] Enable sqlite for non threaded builds

Fixes: QTBUG-70505
Change-Id: I7cb6f52c81a6e8a60249f7bcaa8ee29f109f7b84
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 217c47eac4fca0594c7e7669e7d2cd267c15f29c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-05 08:08:16 +00:00
Thorbjørn Lund Martsum
4ac6d161bb QDockWidget warning log for an unexpected situation
It didn't enter the original patch because it would
prevent it to be backported to 6.2 and 5.15.

Change-Id: I9af30b86b98d5d101b0784cf45781cf46d216c6d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit d0505695dd7100412db442824b6b09b7b801fc38)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-05 07:08:48 +00:00
Tor Arne Vestbø
5fcdf04628 iOS: Send touch events asynchronously to avoid deadlocking UIKit event loop
Although CFRunLoop is documented to support nesting, the UIKit event
delivery machinery is not prepared to handle nested event loops. If the
user starts a nested event loop in response to e.g. a button press/release,
it will deadlock the entire UIKit event machinery, stopping processing
of both screen updates (CATransactions) as well as other events.

This became an issue on iPhone hardware device in iOS 15, but can not be
reproduces on iPads or in the simulator.

To be on the safe side, we deliver all touch events asynchronously,
even if that means the application code will always be one step
behind the event delivered by the operating system.

Fixes: QTBUG-98651
Change-Id: Id0a9fa60b7bb7aa98606d46257e99eac144a1080
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e56b2d7a9e1a762edaf6c34748a4bd2f63648069)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-01 16:51:21 +00:00
Alexandru Croitor
698f6a4bec CMake: Don't show the incompatible version warning when not needed
If a find_package(Qt6Foo) call has the QUIET option passed, don't
display the incompatible version warning.

Also if the find_package call has the EXACT option passed, and the
searched for version does not match the package version exactly,
there's no point in showing the warning because find_package
will reject the package anyway, even if we set
PACKAGE_VERSION_COMPATIBLE to TRUE

Change-Id: I78ef95cf4a045034fc50853465f3ba1db84bba63
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 74d832177169dd24ff06c9a584d0dc0f4f35d31b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-01 12:09:37 +00:00
Richard Moe Gustavsen
be918dd5e7 IM: Don't let all widgets support IM by default
A new property Qt::ImEnabled was added in Qt 5.3.
Since the already existing widgets with IM support
(3rd party included) didn't implement this property,
QWidget got the fall back logic that if a widget
was queried for Qt::ImEnabled, and the returned QVariant
was invalid (the widget didn't implement it), we
would, for backwards compatibility with Qt 4, return "true"
(meaning that the widget supports IM).

But a side effect from this fallback logic, is that now
any widget that doesn't implement ImEnabled (or input
methods at all) report that they support IM. This will
confuse platforms like iOS, which uses ImEnabled to decide
if the input panel should show, and if text selection tools
should be enabled. The result is therefore that if you click
on a QPushButton, the input panel will open.

This patch will implement a more careful strategy to check if
a widget implements IM, if ImEnabled is missing. Rather than
saying that all widgets that don't implement ImEnabled supports
IM, we now require that the widget also returns a valid QVariant
for Qt::ImSurroundingText. We assume then, that a widget that
doesn't do so will anyway not be in need of input method support
from the platform.

Fixes: QTBUG-104527
Change-Id: Ib391fd1daae92c4325e9ccb59730fbdd7c9328fc
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 3b123055755db3f11bd64b276a8f92fe39cf0e1e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-07-01 12:09:36 +00:00
Laszlo Agocs
18c71a29c8 vulkan: Have a dummy format type if there is no Vulkan header
...at application build time.

Follow what is already done for some other Vk* types.

Supports 1df2cf6bad7207f16ddca17344cc1324e50f287e in qtdeclarative,
which puts now also VkFormat into a header. We need the function
declaration to compile without a Vulkan SDK (so without vulkan.h).

Fixes: QTBUG-104501
Change-Id: I09c87149a53a45f03c9f75b87baec4323db16b1d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit c0509ef586e939fbc60b52f80f2cf1b40e5bd9be)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-30 08:24:58 +00:00
Tor Arne Vestbø
90b19e39ad Windows: Don't rely on top level QWindow to scale children on DPI change
The native size of a QWindow on Windows is the logical size of the window
times the window's device pixel ratio. We manage this relationship
for top level windows via the WM_GETDPISCALEDSIZE message, and during
WM_DPICHANGED we then applied the same scale to child windows.

This is problematic in the case where a child window does not have
a QWindow parent, so instead of scaling all children when the parent
gets a WM_DPICHANGED message, we scale each individual child in the
child's WM_DPICHANGED_AFTERPARENT message.

Task-number: QTBUG-103383
Change-Id: Ia0845aa19a3bb97b7bc9e7d9554ac02b95ca65a5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 97665c9615ff399e9a074b94926ab06e0c9619e5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-30 00:46:58 +00:00
Liang Qi
379198828c xcb: update xkb_state mask as much as possible
Though we can get xcb_xkb_state_notify_event_t for the change, but
it looks like not enough, especially when a new usb barcode
scanner was used, it should be a slave keyboard, and Qt only uses
core_device_id for now. It should be enough to update xkb_state
mask when we get key event.

See also https://xkbcommon.org/doc/current/md_doc_quick_guide.html .

Fixes: QTBUG-95933
Change-Id: Ie1e82c19edd777630c7f9057a3b2b8b7cad59e38
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit ef94aeef649f832bb201cb752407ce3ea5e66562)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-29 22:12:16 +00:00
Thorbjørn Lund Martsum
3c348cbfa0 Fix QDockWidget move between screens with different dpr
When partly moved back and forth between screens
with different dprs (device pixel ratios)
unexpected jumps and size changes could occur.
(See the linked issue for details)

This patch maps global coordinates to native ones
and vice versa (in QDockWidgetPrivate::mouseMoveEvent()),
so that the calculated position is the right coordinate
on the right screen.

Fixes: QTBUG-104205
Change-Id: I0e59792a946e0444fed2e2b857f2f8b140afc9b7
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 54f328f0e8205480749a6d8d2ebe0e58cb1cdb67)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-29 22:12:16 +00:00
Andreas Eliasson
681397fb5b Doc: Document QML_IMPORTS_PATH and QMLPATHS
Fixes: QTBUG-101615
Change-Id: I0c83f36db4e4731095610683c4a722438f9b804e
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit e8a782fb2c4084cd88778e263cef5e323505e145)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-29 22:12:13 +00:00
Andreas Eliasson
9996f73fa1 Doc: Revise Qt Test Module landing page
Most of the module landing pages now follow a certain content structure.
In this case, the reference section should be placed before the
licenses and attributions section. Also, to make the wording consistent
across all module landing pages, use the globally available word
snippets.

Change-Id: I2b2164eb1b8a0eb91db0f1efea8390956d54b29e
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit a6df765b03d319347920b6fba209338ea27db40e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-29 22:12:13 +00:00
Volker Hilsheimer
87d4cb06b1 Don't trigger qBound assert in QExpandingLineEdit
Ignore the original width if it's larger than maximum.

Fixes: QTBUG-104383
Fixes: QTBUG-104565
Change-Id: Id86d4f5bd1d50304d95c4711f1989f4dae416b69
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 9fcd5f0790fd01307cfece96d82df21c787fa5b3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-29 17:14:37 +00:00
Alexey Edelev
28deee2248 Forward COMPILER_LAUNCHER to the ABI-specific external projects
This allows to speed-up the build of external projects.

Change-Id: I3bbdbd6ec5b0920c9e912cb59a6e16c5a8efa0ec
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit c7231177df71879b6d3ebc48288a6d3d8fdab6d0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-29 16:32:25 +00:00
Alexey Edelev
175a4dbb94 Use the main ABI's CMAKE_MAKE_PROGRAM in ABI-specific external projects
Change-Id: Ie35b6a334be419d3182fe77f9d70153cd1fd8a51
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit f2d9e76451ffb4f890a97cb218fd733fb5960111)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-29 16:32:16 +00:00
Pekka Gehör
d7b4feaa03 Android: fix wrong position of cursor handle and editpopup menu in split screen
Use activity location in the Window to handling a cursor handle and editpopup menu
in Multi-Window mode. No effect when using full screen.

Fixes: QTBUG-58503
Change-Id: I17f3119be4c3dda2fca50156bf62c1260c2ea1f6
Reviewed-by: Samuel Mira <samuel.mira@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit c27cca5c3421b08253535cfcfb9dd414986c7653)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-29 15:49:43 +00:00
Fushan Wen
f628977bd3 Drop call to setPlatformScreen in QHighDpiScaling::setScreenFactor
Drop call to setPlatformScreen since the only affected variables are
logicalDpi and geometry. Replace setPlatformScreen with updateLogicalDpi
which handles global scale factor changes in QScreen.

Call updateGeometriesWithSignals() to check if there are any changes
in geometry or availableGeometry, since the geometry or availableGeometry
can also change when setting a scale factor.

Move setPlatformScreen to QScreen ctor as the function is not used
elsewhere.

Change-Id: I7acf40bf0643e89a1d9177674d66dc503829f98f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 7b2ae3faab15913e006ece25d785e6a8453dd27a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-29 15:49:39 +00:00
Pekka Gehör
d6e414bfb1 Android: Fix the offset of the EditPopupMenu
Fix the offset of the EditPopupMenu on application window.
Issue caused by a5bb7b3ca510c301baf84e1dd46d5aeeb4986eb2

Fixes: QTBUG-71900
Change-Id: Ib95e1544fe91c273bc5317bd338a50a74fb1090a
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 526d62ee90d549177920eb567cb951c4b553c630)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-29 15:49:37 +00:00
Kai Köhne
baa568c41e Doc: Document missing methods in QDropEvent
Fixes: QTBUG-104484
Change-Id: I20068bb9e641545edad67910b4586aa38aec093b
Reviewed-by: Kevin Keating
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit c2505751de802ae3e14df57c98ba9c3e9049dd50)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-29 07:34:44 +00:00
Thiago Macieira
5a3e046864 moc: fix const-init for Windows
References to __declspec(dllimport) is not a constant expression on
Windows, so we can't have a direct reference to a staticMetaObject.
Commit 9b8493314dd77f3e96b353187816bb7ef4dedbb5 fixed the Q_OBJECT parent
link (added in 5.14, kicked in for 6.0 with the ABI break), but commit
656d6f2a9b221dbd5adfc46262cb243e696d8d62 added links for Q_GADGETs too
without taking the need for Windows DLLs into account.

This change is a no-op everywhere but Windows. On Windows, since we
store the pointer to the indirect getter function, now you may get non-
null pointers from QMetaObject::superClass().

Change-Id: I6d3880c7d99d4fc494c8fffd16fab51aa255106e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 688e8f63a2bb87469517166f90c50dec524f90c5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-29 02:40:02 +00:00
Thiago Macieira
956a14650b moc: move the qt_static_metacall below the staticMetaObject
Just so we have data structures and functions grouped together.

Change-Id: Id0fb9ab0089845ee8843fffd16fa171f6e1caf2b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 9af59838d7ba166966941199354f905b0a122cab)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-29 02:40:01 +00:00
Thiago Macieira
67d223705f qmetatype.h: remove unnecessary specialization
Commit 5db3fd29b42ec06ccb15fdd7f274bb20c326ffb6 removed the expansions
that likely needed this.

Change-Id: I6d3880c7d99d4fc494c8fffd16fbbe8dcde4a1b1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 3335b541e76903f312cf71944a857c11e221c512)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-29 02:40:01 +00:00
Laszlo Papp
a4a9a46964 QKeySequenceEdit: Finish editing when losing focus
Do not wait for the timer to time out. When losing the focus, finish
editing immediately since we cannot really edit it further without
focus.

Change-Id: If42926ef9b06fbea7592a294f48ea5e99ef57ef8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit b6a953bb939cb5fe6305f4acf62003c766887f51)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-29 02:40:00 +00:00
Thiago Macieira
a387208e9c QMetaType: extern-template the built-in Core types' QMetaTypeInterface
This *should* make no difference in behavior, it just prevents the
instantiation of the QMetaTypeInterface and all the lambdas used in it
in every compilation unit, with a copy in every library. Now, a simple
function like:

  QMetaType f() { return QMetaType::fromType<int>(); }

produces only a single function, with a reference into QtCore:

_Z1fv:
        movq    _ZN9QtPrivate25QMetaTypeInterfaceWrapperIiE8metaTypeE@GOTPCREL(%rip),%rax
        ret

The code above *does* work on Windows, producing:

_Z1fv:
        movq    __imp__ZN9QtPrivate25QMetaTypeInterfaceWrapperIiE8metaTypeE(%rip), %rax
        ret

However, it breaks the staticMetaObjects' metatype listing, because
getting the address of a __declspec(dllimport) variable is not a
constant expression (it lacks data relocations). So this is disabled on
Windows.

This change also broke the INTEGRITY build. I've simply disabled the
optimization there without attempting to understand why it fails.

Task-number: QTBUG-93471
Change-Id: Id0fb9ab0089845ee8843fffd16f97748a00b4d64
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit dbf58407cb7f87b8d75ffd4e8af1393e80f30873)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-29 02:39:59 +00:00
Lars Schmertmann
9d70596799 QHttpHeaderParser: Allow larger fields but restrict total size
Our limit of 8k for a single header field was too small for certain
services which returned Location values or WWW-Authenticate challenges
longer than 8k.

Instead, taking inspiration from Chromium, we have a limit of 250k for
the full header itself. And increasing our field limit to 100k, which
would occupy almost half of what the total header allows.

Also took the opportunity to make it adjustable from the outside so we
can set more strict limits in other components.

Fixes: QTBUG-104132
Change-Id: Ibbe139445e79baaef30829cfbc9a59f884e96293
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
(cherry picked from commit e3ea1d02e6a2cbc63e8ae6fff6ccae49258fe5a2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-28 17:14:44 +00:00
Moody Liu
ec4149a240 fix androiddeployqt with user application with in-tree QML modules
when deploying user applications with QML modules located under user's
subdirectories, (e.g. some third-party QML components used as git
submomdule). The qmldir for such QML modules will be, typically,
generated under BUILD_DIR/android-qml.

if a BUILD_DIR is under the source directory, androiddeployqt will skip
those QML modules incorrectly because they "appeared to be under the
QML root path so that seems can be imported", however without deploying
them, it's impossible to import those modules on an Android device.

this patch adds a check that also tests if a root path plus the module's
url can actually lead to the correct module path, so a QML module under
android-qml subdir would not pass the test, and thus won't be skipped.

Task-number: QTBUG-103593
Change-Id: I8af76bd38cd55700e17794cf2fff0e50a90ac87e
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 8a96c8a22ca2c81969bb5e06249c06143b7f8249)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-28 17:14:44 +00:00
Dimitrios Apostolou
2b1be235e0 qtestlib: exit with error if a test is invoked with unknown data tag
Previously trying to execute a test function with an unknown data tag
would print an error message but exit with 0.

This patch stores a test failure, and continues trying to execute the
rest of the command line arguments, if any. In the end the process exits
with the usual exit code (number of failed tests) which is now !=0.

Fixes: QTBUG-24240
Change-Id: Id4d422035f173e01e77ca88028dfd94dc0f9085c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit d23dcc05425dcd2ab0eb621f5f2ea793a78fcc9f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-28 17:14:44 +00:00
Allan Sandfeld Jensen
74989b0914 Avoid overflowing coverage in rasterizer
A single examined pixel might have sampled corners outside the logical
constraints, that needs to be ignore.

Fixes: QTBUG-92485
Change-Id: I105fd42d3388a48f3bb03c00d640832e8e99477c
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit aefb5c5a56dd6882179130b98fc44ac0fb366b03)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-28 17:14:43 +00:00
Ville Voutilainen
de5fd0faa1 Fix an incorrect invocation of llvm-readobj
It's never been entirely sound or necessarily correct to use single-dash
options for long options. Various other things invoked by androiddeployqt
seem to provide only single-dash options, but llvm tools and GNU tools
always provide a double-dash option. Therefore we can just change the
--needed-libs option to use double-dash without any particular version
checks or differences.

Task-number: QTBUG-104580
Change-Id: I5649b0f9565989157d934c802da1f3c4c43fca0f
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
(cherry picked from commit 40ddf2c7f34e429af4d18063ca947490cdc12ba9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-28 17:14:43 +00:00
Laszlo Papp
321c7ed7aa QStyledItemDelegate: Fix the event filter doc
The class actually also avoids filtering the tab and backtab keys for
the mentioned classes: QTextEdit and QPlainTextEdit.

So, the documentation needs to be extended to cover the hidden gems.

Change-Id: Id993b055a105c6cfe5ee57be3863ce8bff448396
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 82309305a7869a5a7667bdd799d763a842cdf85b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-28 17:14:43 +00:00
Eirik Aavitsland
8eedaf8a87 Ensure consistent cursor width under fractional scaling
Under fractional scaling, an N units wide rectangle can in general
cover either M or M+1 pixels, depending on placement. For a tall thin
recangle like the cursor, this difference becomes very visible as the
cursor moves from position to position. Avoid by instead painting the
cursor as a cosmetic line in such cases, since that keeps its width
independently of the current transformation.

Fixes: QTBUG-95319
Change-Id: I31a31f89fe7eac3037694946aa452a9f2bd6e5be
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 3709bc3699ef0632bd2af53b02d44d130b8c0e13)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-28 17:14:43 +00:00
Laszlo Agocs
c064b19b24 rhi: metal: Switch back to presentDrawable
This convenience should be, according to the Apple docs, equivalent to
calling present from a scheduled handler. (which on its own makes it
unclear why we switched in the first place)

In practice it seems the two approaches are not identical. It looks
like that once a frame is submitted earlier than the next display link
callback, the throttling behavior we implement in beginFrame()
(waiting on the semaphore for the completion of the appropriate
command list etc.) starts exhibiting unexpected behavior, not
correctly throttling the thread to the refresh rate. Changing back to
presentDrawable does not exhibit this at all.

The suspicion is that presentDrawable is probably doing more than what
the docs suggest, and so is not fully equivalent to calling present
manually from a scheduled handler.

Therefore, switch to presentDrawable now, which restores the expected
cross-platform behavior, but make a note of the oddity, and also
prepare the hellominimalcrossgfxtriangle manual test to provide an
easy, self-contained application to allow experimenting in the future,
if needed.

This allows Qt Quick render thread animations to advance at the
expected speed (because the render thread is correctly throttled to
the refresh rate), even if the render thread decides to generate a new
frame right away, without waiting for the next display link update.

Without this patch, attempting to get updates not via requestUpdate(),
but by other means (timer etc.) leads to incorrect throttling, and so
the triangle in the test app is rotating faster than expected - but
only with Metal. Running with OpenGL on macOS or with any API on any
other platform the behavior will be correct. Even if scheduling
updates without display link is not efficient, and should be
discouraged, not doing so cannot break the core contract of vsync
throttling, i.e. the thread cannot run faster just because it renders
a frame not in response to an UpdateRequest.

Amends 98b60450f7ce6b16464392747ab8721f30add15e (effectively reverts
but keeps the code and the notes because we might want to clear this
up some day)

Fixes: QTBUG-103415
Change-Id: Id3bd43e94785384142337564ce4b2644bf257100
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit f814cc6a7911f6cf14ce443f41c2336bc1d213c6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-28 17:14:43 +00:00
Samuel Mira
e80b0f3d87 Android 13: Fix warnings on starting an application
On Android 13, currently in beta, android triggers a warning because it
is using a deprecated getDrawable function.
The patch changes it to use the non-deprecated alternative as suggested
in the warning.

Fixes: QTBUG-103568
Change-Id: I3e629e7b75044bfb51874256895be0ec7e1088f8
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit e07fea6fb405c6e9affe6e377ad99a98a740c5be)
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-06-28 17:14:43 +00:00
Eskil Abrahamsen Blomfeldt
5199ae4c4a Enabler for fractional scaling of text in Qt Quick
As opposed to the raster engine, in Qt Quick we are using
unscaled positions for the glyphs and using the vertex shader
to scale these after the fact. However, when picking the
correct subpixel rendering for each glyph, we would use the
unscaled position's fractional part, meaning that we
essentially rendered the glyphs at the wrong subpixel position.

This was especially visible when doing fractional scaling, e.g.
125%.

Thus we need to get the fraction of the actual on-screen position
instead. This has to be done both when populating the cache for
the Qt Quick case (this enabler adds it as opt-in) and also when
actually selecting the correct rendering of the glyph (change in
Qt Declarative).

Task-number: QTBUG-101008
Change-Id: Ie67948b138f578b5f40d6a950c4aa92394a8f09a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 20ae170b351947e2cf8137504672fd5645151b9f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-28 12:08:11 +00:00
Thiago Macieira
aab4aa0e46 FatalSignalHandler: print some more information from siginfo_t
The siginfo_t parameter allows us to show what process sent a signal or
the crashing address. Additionally, it allows us to determine if the
crashing signal was indeed sent due to a crash.

The selftest tst_crashes produces now:

$ QTEST_DISABLE_STACK_DUMP=1 ./crashes
********* Start testing of tst_Crashes *********
Config: Using QtTest library 6.4.0, Qt 6.4.0 (x86_64-little_endian-lp64 shared (dynamic) debug build; by GCC 11.2.1 20220420 [revision 691af15031e00227ba6d5935c1d737026cda4129]), opensuse-tumbleweed 20220428
PASS   : tst_Crashes::initTestCase()
Received signal 11 (SIGSEGV), code 1, for address 0x0000000000000004
         Function time: 0ms, total time: 0ms
[1]    201995 segmentation fault (core dumped)  QTEST_DISABLE_STACK_DUMP=1 ./crashes

The last line comes from the shell. The code isn't decoded, but on Linux
it's a SEGV_MAPERR. macOS prints exactly the same thing.

I've updated one of the expected_crashes_*.txt output that doesn't seem
possible (the "Received a fatal error" message does not appear in Qt
anywhere).

Change-Id: I5ff8e16fcdcb4ffd9ab6fffd16ebc8391234f0e2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 5e67e7efaa2669252fd8c55392b7bc35b72c6079)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-28 00:39:52 +00:00
Thiago Macieira
df86a0effc QProcess: re-enable pdfork() on FreeBSD
The forkfd_pidfd is a Linux feature, but we ended up disabling the
equivalent functionality on FreeBSD.

Change-Id: I6d3880c7d99d4fc494c8fffd16fabfbc38865f94
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 5e60b2ab160bc5ff3bc41bb8991753785d2fc285)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-28 00:39:52 +00:00
Laszlo Papp
6e55307def QAction: Fix the obsolete menu() doc
35ddf3498859dc184456346f2b070fe94dabaf26 added QMenu::menuInAction, but
the documentation added to cover it contains a typo.

The method added to replace QAction::menu() is menuInAction, not
menuForAction. It was probably just an oversight.

Change-Id: I2a6ec846bbe7ac8dd9e0c285bc62dd7e08820459
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit dedf11a53b664c6901dd8d9656e6d7e1fb051974)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-28 00:39:50 +00:00
Mårten Nordheim
810c41093f QTest: switch some text-conversion functions to use qsizetype
To avoid potential narrowing.

Task-number: QTBUG-104125
Change-Id: I37bfc5c49e7c919f5204a76a905758a92527d864
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 44927b801ab8afac901132f9505a42b41821cb55)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-28 00:39:47 +00:00
Thiago Macieira
b6e4456f1f QFont: don't detach the families list in family()
Change-Id: Id0fb9ab0089845ee8843fffd16f93a8b9306b89b
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 68a1f9582b38b30add7c061caae1fd8acb356da9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-28 00:39:45 +00:00
Alexandru Croitor
9da1762f7e CMake: Remove Gui dependency of androidtestrunner
It doesn't use any Gui classes and thus shouldn't depend on Gui.
Also change PUBLIC_LIBRARIES to LIBRARIES, executables don't need to
propagate library dependencies.

Change-Id: I9edae7e555e1d74d63b00afbf9e3931963b502c2
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 3eaf6a4cad4c12c1777cf7d5793e518f66f07780)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-27 23:39:44 +00:00
Allan Sandfeld Jensen
b2fe6b1c05 Avoid reading outside allocated buffer
Bound the inverse lookup result on the low end as well.

Fixes: QTBUG-104583
Change-Id: Id357fe1c39c88776075d737b08fc2864a2b6e829
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit a2501fff818971a375a927038792140aed6ef4b6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-27 23:39:44 +00:00
Fabian Kosmale
257e3fee16 QString(En|De)coder: Remove noexcept from ctor taking name
It is necessary as the QStringConverter ctor is no longer noexcept, as
it can now allocate memory.
This change is ABI-wise safe, as the method was only changed to be
noexcept in 6.4.
Amends 122270d6bea164e6df4357f4d4d77aacfa430470.

Change-Id: Ifab4302d659524e27f38f0f90e5813a2c2a4a452
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ba2ae1720a11692e2fc57c8be176f2dd9e126f2f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-27 23:39:44 +00:00
Mårten Nordheim
a7044900b2 Fix QDBusInterface crashing with empty path on construction
On some machines having an empty path passed to QDBusInterface
would cause a crash.

This happened because the code created a QDBusMessage and manually
marked it as validated when it was not. The validation would not
pass for this object.

Change-Id: I496dd922fa64353399655a1e84996b99990f5879
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4d60ba61dca7d50c8eaf9f4525cb9565b363ca81)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-27 17:49:31 +00:00
Sona Kurazyan
40f8d923c7 QDom: Clean-up warnings about old-style cast uses
Change-Id: I7cf2089f34e46a901f8b03987feed24773a72c00
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit c3f76a867b7f8f04c207b80a8fbfcb927ee23de2)
2022-06-27 07:18:21 +00:00
Allan Sandfeld Jensen
2e37845cee Avoid SSE2 punning
It is technical UB, even if GCC promises to let it work, but it also
generates inefficient code.

Change-Id: I8f0cae3490d32287ecbaa16b1e9ace84223cda2a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 821aa1ff095ae66a89eb8725650dccac363f06ad)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-25 20:21:41 +00:00
Allan Sandfeld Jensen
ad646f62fb Sync qt_scale_image_argb32_on_argb32_sse2 and qt_scale_image_32bit
The rounding was different in the SSE2 version compared to the C
version.

Fixes: QTBUG-85109
Change-Id: I81f0a71ee5425b93da80b6a438e1778a02b9bcfa
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 7a146019e433e687de7a954c7791ac6fc6fa199c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-25 20:21:34 +00:00
Thiago Macieira
7a1cae5617 moc: properly indent the output for the metatype array
Commit 7ff7d73f6ac68227500fa95731ce0f04626e600b added the indentation,
but there were a few mistakes and it was off by 4 spaces anyway. So re-do
it and take the opportunity to add some comments to explain what we're
seeing.

Before:
qt_incomplete_metaTypeArray<qt_meta_stringdata_QTimer_t,
    QtPrivate::TypeAndForceComplete<bool, std::true_type>,
    QtPrivate::TypeAndForceComplete<int, std::true_type>,
    QtPrivate::TypeAndForceComplete<int, std::true_type>,
    QtPrivate::TypeAndForceComplete<Qt::TimerType, std::true_type>,
    QtPrivate::TypeAndForceComplete<bool, std::true_type>,
    QtPrivate::TypeAndForceComplete<QTimer, std::true_type>,
    QtPrivate::TypeAndForceComplete<void, std::false_type>
,
    QtPrivate::TypeAndForceComplete<void, std::false_type>,
    QtPrivate::TypeAndForceComplete<int, std::false_type>,
    QtPrivate::TypeAndForceComplete<void, std::false_type>,
    QtPrivate::TypeAndForceComplete<void, std::false_type>

>,

After:
    qt_incomplete_metaTypeArray<qt_meta_stringdata_QTimer_t,
        // property 'singleShot'
        QtPrivate::TypeAndForceComplete<bool, std::true_type>,
        // property 'interval'
        QtPrivate::TypeAndForceComplete<int, std::true_type>,
        // property 'remainingTime'
        QtPrivate::TypeAndForceComplete<int, std::true_type>,
        // property 'timerType'
        QtPrivate::TypeAndForceComplete<Qt::TimerType, std::true_type>,
        // property 'active'
        QtPrivate::TypeAndForceComplete<bool, std::true_type>,
        // Q_OBJECT / Q_GADGET
        QtPrivate::TypeAndForceComplete<QTimer, std::true_type>,
        // method 'timeout'
        QtPrivate::TypeAndForceComplete<void, std::false_type>,
        // method 'start'
        QtPrivate::TypeAndForceComplete<void, std::false_type>,
        QtPrivate::TypeAndForceComplete<int, std::false_type>,
        // method 'start'
        QtPrivate::TypeAndForceComplete<void, std::false_type>,
        // method 'stop'
        QtPrivate::TypeAndForceComplete<void, std::false_type>
    >,

Change-Id: Id0fb9ab0089845ee8843fffd16fa152d040ef922
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 3816b14ee8bc6f9722f3b76a32f968e334d0ed27)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-06-25 15:32:55 +00:00
Thiago Macieira
8c1c6afc6b qmetatype.h: add QT_FOR_EACH_STATIC_PRIMITIVE_NON_VOID_TYPE
This allows us to simplify the explicit specialization of the
QMetaTypeInterface<void> explicit specialization, dropping the warning
push/pop, and remove an unnecessary explicit instantiation.

Change-Id: Id0fb9ab0089845ee8843fffd16f9bdccf1965b95
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 5db3fd29b42ec06ccb15fdd7f274bb20c326ffb6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-25 15:32:30 +00:00
Thiago Macieira
781b0856a2 qmetatype.h: remove unnecessary EXPORT macro
It was introduced in commit d9f9bc9bada91e3ec2b6c496d3b2242506ca56bc for
Qt 6.0 to avoid extern __declspec(dllexport), which MSVC doesn't like,
but was made obsolete by commit 77b99e8111cdd06b4fe12f2e18950a1e40ee2b76
that removed the extern templates altogether for MSVC.

This change is NOT a no-op because Q_CORE_EXPORT expands to
Q_DECL_IMPORT which is __attribute__((visibility("default"))) on ELF
platforms. That's actually a good thing, because the symbol is not
defined in any library that is not called QtCore anyway. GCC and Linux
are also going towards properly requiring imported symbols to be
explicitly marked, which this is.

Task-number: QTBUG-93471
Change-Id: Id0fb9ab0089845ee8843fffd16f99616883281e3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 97fbf7d151fbadb2c4541a5e0689810584a9a210)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-25 15:32:25 +00:00
Laszlo Papp
c7448d6359 QSettings: fix a typo in the doc
Change-Id: I059f603f3cc66a40e84179ac3f2a07de3bf31761
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e35fc908fdb831e3aef9f539239662e434b1ef13)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-25 15:28:58 +00:00
Laszlo Papp
8ad0ff9ae1 QNetworkReply: Fix the test compilation
It would not compile on my Linux box due to using QVariantMap, but not
actually including QMap itself. Using gcc 9.3.1 on CentOS 7.

Change-Id: I808a270c814a906030cb34b197d3a2a85ba384e1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
(cherry picked from commit 0a78cb7fab7b2d093f53be06839b08bca08077ea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-25 15:28:50 +00:00
Alexandru Croitor
dd26c4234b CMake: Fix prl files not to contain hard-coded library paths
Make sure to convert absolute paths generated using the
$<TARGET_LINKER_FILE> generator expressions into relative paths.

Because prl files are generated for both modules and plugins, we need
to pass both a list of qt module locations and qt plugin locations
to QtFinishPrl.cmake, and then try to make the absolute path relative
to each passed directory.

A warning assertion is shown if we no relative path could be made,
which will cause an absolute path to be embedded. This should not
happen though.

Amends f4e998125981038e5e50dab8cc56039faaa0b750

Fixes: QTBUG-104396
Change-Id: Id68395c0dbb20aad5c510d77835cc931b9396556
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 754512a64dffa20165e5b08b77e34b82c072f7f8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-25 15:27:23 +00:00
Ye ShanShan
acaed119e0 Add QDom internalSubset implementation
QDom's internalSubset() always returned empty because nothing
actually set the internal data member it returns. When parsing
the DECLTYPE, extract the internal subset and save it to the
doctype()'s member when present.

Fixes: QTBUG-53661
Change-Id: I6e41ff8b914381168246073b3289d82205b1c255
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
(cherry picked from commit c3b959733a739e9b2fc00b2af469fa44f3048e29)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-25 15:27:15 +00:00
Duan Ting
0398679726 Fix typo in code
Found by codespell

Change-Id: I75f4b14f3eded035a0c904d8a7174cb6f5b7d9ef
Reviewed-by: Wang Bo <wangbo@uniontech.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit cd268e9e1d57ca2159371f3c4f93a63d3fe66c4e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-25 15:27:06 +00:00
Volker Hilsheimer
46d0d8e300 Skip tests that terminate threads under ASAN
Thread termination might prevent stack unwinding, which then
generates ASAN errors such as

ERROR: AddressSanitizer: stack-buffer-underflow on address
0x7f3c1d7858b0 at pc 0x7f3c243d8918 bp 0x7f3c1d7857f0 sp 0x7f3c1d7857e8

Skip such tests so that we can enable blocking CI runs under ASAN.

Fixes: QTBUG-104421
Change-Id: I169235a12190e3f72525cddfe1a44a4bee19eca1
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit ea4d6b987ae10f1bb910081b523c3b22b11f7b64)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-25 15:26:58 +00:00
Lars Knoll
1197280748 Add QStringDecoder::decoderForHtml()
Now that QStringConverter can handle non UTF encodings through ICU,
add a way to get a decoder for arbitrary HTML code.

Opposed to QStringConverter::encodingForHtml(), this method will
try to create a valid string decoder also for non unicode codecs.

Change-Id: I343584da1b114396c744f482d9b433c9cedcc511
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9c1f3b6d4d5a5fe59396062c6f68cc1201665c62)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-25 15:26:08 +00:00
Thiago Macieira
24e7671e20 moc: put the qt_meta_stringdata_XXXX_t type in an unnamed namespace
Not all user code is compiled with hidden visibility, so make sure one
of the types in the template parameters (the one that is supposed to be
unique anyway) is local and therefore causes the full symbol for the
inline variable not to be exported outside of the translation unit.

Change-Id: I6d3880c7d99d4fc494c8fffd16fb262a59b81283
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 8726647df40c61ed6d79da1e3845ef289bcf8b38)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-25 02:06:26 +00:00
Thiago Macieira
115cd00f0c moc: remove the attempt to create one large string literal
Commit dda9c9e2bc4fd2efe9e3fb0e451a8c3512f9a4d2 fixed some outstanding
issues with moc's calculation of the maximum string length, but it
missed one. This commit instead opts to remove the calculation entirely
and instead have multiple char array members in the qt_meta_stringdata.
We needed a single string back in Qt 4.0 when the stringdata *was* a
single char array.

Since 5.0, we've used a structure with multiple members and pointer
arithmetic going past the end of the arrays, from the top of the object.
That's UB, but since it's always been UB and can't be fixed until Qt 7
anyway, let's go full monty on it and have one char array per meta
object string.

The struct qt_meta_stringdata_Qt_t for namespace Qt now has 1217
stringdataXXX members.

Change-Id: I6d3880c7d99d4fc494c8fffd16fb0d1573e387dc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 0978646a65f517f0026fbdd0639415d265876512)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-25 02:06:20 +00:00
Thiago Macieira
720b592975 tst_moc: fix build with GCC 12
You can't mismatch the export macros. The QT_MOC_EXPORT_PLUGIN_V2 macro
defines these functions as Q_DECL_EXPORT so they can be found by
QPluginLoader. We must match the macro here, otherwise GCC 12 complains
(tst_moc.cpp is compiled with -fvisibility=hidden):

tst_moc.cpp.o: non-canonical reference to canonical protected function `qt_plugin_instance' in moc_plugin_metadata.cpp.o

Change-Id: Id0fb9ab0089845ee8843fffd16f99893d5730da5
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit f5697d2b2aca7f7c058e25f08fc6f68b26f0ad83)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-25 02:06:13 +00:00
Shawn Rutledge
d4db1ef7db Emit autolinks in QTextMarkdownWriter
When a markdown document contains a "naked" URL, or an angle-bracketed
<URL>, md4c recognizes it, and we set the AnchorHref charfmt property.
There's no need to expand it into the [text](url) form if the text is
the same as the url, there is no tooltip, and the url is valid.
QTextMarkdownWriter now writes a CommonMark "autolink" in that case:
https://spec.commonmark.org/0.30/#autolinks

[ChangeLog][QtGui][Text] QTextMarkdownWriter now writes an autolink
whenever a hyperlink has no custom text and no tooltip, including
when the document was parsed from Markdown containing a naked URL.

Fixes: QTBUG-94713
Change-Id: I432db8499c62e1e0b1e913bfd8ef2147e3c2bb2a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 846b314aaf484a3cb62d466660c08bbde00542cb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-24 23:18:46 +00:00
Shawn Rutledge
62a7360809 Support markdown in QTextEditMimeData; fix pasting trailing newlines
- Since 4edcea762d9ce334c4c1a78234c90c118b81da87 the dropsite example
  shows markdown if available; and now it shows that when we do DnD
  of a selection from the richtext example, text/markdown is available.
- If we artificially make html unavailable, copying and pasting between
  widget-based rich text editors uses markdown.

In case markdown writer output contains unnecessary backticks due to
monospace fonts getting used, the workaround from
1ad456c908467212bc30223a69eb7524b64b86e1 is applied.

Task-number: QTBUG-76105
Task-number: QTBUG-103484
Change-Id: Ie6ca4dbb450dbc36b3d09fd0df1ae5909aaebca7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 56f0ebfe860e440dcbba8997f44836debc901119)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-24 23:18:31 +00:00
Mårten Nordheim
52d3a42a32 Network: Update expired cert
Change-Id: I233ffee5b720c0554071c1d49d4fb861736b2e2a
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 6cbe8f74ce5940f749796c88db2322b1a0d3dd8b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-24 20:26:29 +00:00
Ulf Hermann
834fc24b18 QAbstractItemModel: Add revisions to new methods
These methods show up in QML-exposed types. They should be revisioned in
order to keep those types backwards-compatible.

Change-Id: I8e826dc2e7db49d8abe69f67605dfb1991855b96
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
(cherry picked from commit c52e0a9582a0a06999d480b969b3b2895fe92217)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-24 20:26:26 +00:00
Kai Köhne
4c74314b6b Use [[noreturn]] attribute
Use __has_cpp_attribute mechanism to check availability of
[[noreturn]]. For MSVC 2019 and 2022, this is always
the case, so we  can also remove the (now dead)
__declpsec(noreturn) definition.

Change-Id: Ie7b39bd93bc5e1a173e245a3a5d5ff7e9067a59f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit bc06e345fe6e284e4dc72f3e02662641dcb9ed71)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-23 06:18:37 +00:00
Kai Köhne
e2ff48441b MSVC: Remove dead Q_DECL_DEPRECATED* definitions
Later on we redefine them to
[[deprecated]], [[deprecated("")]], if the attribute
is available.

Since both MSVC 2019 and 2022 support the attribute,
the __declspec() definition was never used.

   https://docs.microsoft.com/en-us/cpp/cpp/attributes

Fixes: QTBUG-93748
Change-Id: I3e12f2ace414e316a811f2ceb44e6f312803439a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f921b42f34f254ca7066691f3cf4a1c7270f0161)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-23 06:18:21 +00:00
Kai Köhne
31c01cfe88 Doc: Skip 'qt5/' part in 3rd party documentation
Fixes: QTBUG-104463
Change-Id: I7596118e147c9b5b12b49c4cf2692626697f309e
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit 267db4eab4af4a5eb966bbcf50f48660a150982a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-23 06:18:01 +00:00
Thiago Macieira
cae0206094 moc: add Q_CONSTINIT to the static const variables we emit
The macro was added to Qt 6.4, so we define it in each moc output to
empty if it wasn't previously defined. Thus, moc retains compatibility
with older Qt versions.

Change-Id: Id0fb9ab0089845ee8843fffd16f9c1539fa0368f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
(cherry picked from commit 116d8f987bfbb0ec1744fe6c2989f8f2a5756aba)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-23 02:51:44 +00:00
Thiago Macieira
1747e82267 CMake: fix build with FreeBSD 13.1
I don't know if they've just added the libs and therefore the GSSAPI
content wasn't enabled before, but libgssapi_krb5.so does not have the
symbols we need.

ld: error: undefined symbol: gss_acquire_cred
>>> referenced by qauthenticator.cpp:1803 (/usr/home/tjmaciei/src/qt/qt6/qtbase/src/network/kernel/qauthenticator.cpp:1803)
>>>               src/network/CMakeFiles/Network.dir/kernel/qauthenticator.cpp.o:(qGssapiTestGetCredentials(QStringView))

ld: error: undefined symbol: gss_release_name
>>> referenced by qauthenticator.cpp:1808 (/usr/home/tjmaciei/src/qt/qt6/qtbase/src/network/kernel/qauthenticator.cpp:1808)
>>>               src/network/CMakeFiles/Network.dir/kernel/qauthenticator.cpp.o:(qGssapiTestGetCredentials(QStringView))
[...]

Change-Id: I6d3880c7d99d4fc494c8fffd16fabf70bbd272f5
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit c83a87eca7a435a6569e0185733982150093ee3a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-23 02:51:32 +00:00
Thiago Macieira
b6bfb178a0 moc: replace offsetof with sizeof
It's the same thing since we have exactly one field in this structure
before stringdata0. But there's a far smaller chance of producing a
warning in user code.

Change-Id: Id0fb9ab0089845ee8843fffd16f9cdceec33017d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 9959cf60d360a43c87c77f44a7d17e2fae25a303)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-23 02:51:19 +00:00
Thiago Macieira
f249e5c91c moc: fix use of escape sequence of more than one character
We had the code to calculate the length, but were improperly using it
only for the offset, not the length of the string or its containing
array. That resulted in the generated moc output containing:

 QT_MOC_LITERAL(111, 5), // "\xffz"
 QT_MOC_LITERAL(114, 5), // "\0012"
 QT_MOC_LITERAL(117, 23), // "slotWithAReallyLongName"

The two strings are described as occupying 5 bytes (length 4 + null
terminator), which is incorrect. The offset was correct: 114 - 111 = 3
and 117 - 114 = 3. The new output is:

        QT_MOC_LITERAL(111, 2),  // "\xffz"
        QT_MOC_LITERAL(114, 2),  // "\0012"
        QT_MOC_LITERAL(117, 23),  // "slotWithAReallyLongName"

The effect of the array size calculation would only be felt if moc
decided it needed a second string array (for strings over 65535 bytes),
which would cause the offsets in the second array to be all wrong. There
was no such test until now.

Drive-by fixing of the newline, indentation, and the stale comment
referring to QByteArrayData (Qt 5).

Change-Id: Id0fb9ab0089845ee8843fffd16f9cd01b3e0709a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit dda9c9e2bc4fd2efe9e3fb0e451a8c3512f9a4d2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-23 02:50:56 +00:00
Iikka Eklund
a9257e7ad0 Conan: Do not force 'qt_host_path' usage in cross-build context
If the user does not pass:

  -o qtbase:qt_host_path=/foo

then log a warning but allow to continue. For example Boot2Qt
integration resolves the 'QT_HOST_PATH' by other means thus making it
a mandatory option to be passed by the user should not be needed.

Change-Id: I4c1d8b5253e33466ccdf463f89473966e90c0e0c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Toni Saario <toni.saario@qt.io>
(cherry picked from commit 5271f5082cd5413c618fc464fbeea6529626838b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-22 17:21:43 +00:00
Sona Kurazyan
1892763c8c QDom: Stop treating non-BMP characters as invalid
According to https://www.w3.org/TR/REC-xml/#NT-Char unicode characters
within the range of [#x10000-#x10FFFF] are considered to be valid, so
fix the check for valid characters accordingly. This requires changing
the loop over the input QString to iterate over code points (instead of
code units).

Fixes: QTBUG-104362
Change-Id: I7dcf5cad05265a54882807a50522d28b647e06ee
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit da0d7f61c851431d14430684c62345bc23dbf001)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-22 17:21:42 +00:00
Joerg Bornemann
d0123f8866 qmake/msbuild: Turn off "use full paths in diagnostics" by default
The default setting for "Full Path of Source Code File in Diagnostics"
changed with VS 2017: it's now turned on by default.  It can also be
enabled with the compiler flag /FC, but there is no flag for turning it
off.

Users might want to disable /FC to obtain reproducable binaries.

Change qmake's default from "use Visual Studio's default" to "off" for
this feature.  Users can enable it manually by putting the following
into their project files:

    QMAKE_CXXFLAGS += /FC

CMake faced the same problem.  See CMake upstream issue #18261 for
comparison.

Task-number: QTBUG-104450
Change-Id: Ibe636a0ac5d18aefb44f2b7179b59fcec2ad8353
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 073214fdf943e1a0beb660a039e39dc1ea43836e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-22 17:21:42 +00:00
Joerg Bornemann
73a624356d qmake/msbuild: Support all /DEBUG:xxx linker options
/DEBUG:OFF now turns debug info generation off.
/DEBUG:FULL maps to DebugFull.
Unknown /DEBUG:xxx options are added to AdditionalOptions.

Task-number: QTBUG-104450
Change-Id: Ibd072145e51551b29370e809b880c0d7f1a00c03
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 6a6b27940d497b29672ff65ff242fe0211603f22)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-22 17:21:42 +00:00
Joerg Bornemann
ebd59a0ae0 qmake/msbuild: Support all /LTCG:xxx options
/LTCG:OFF now turns off LTCG.
/LTCG:INCREMENTAL maps to UseFastLinkTimeCodeGeneration.
Unknown /LTCG:xxx values are passed to AdditionalOptions.

Task-number: QTBUG-104450
Change-Id: If85942dbeec204dc2571a861a43201cb3d5993ae
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 566ede6ee169e87addab38ec64e527e76bc475e9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-22 17:21:42 +00:00
Sona Kurazyan
36202da4a9 Move QFutureInterfaceBase::cleanContinuation() to removed_api
This method isn't used anymore, but we can't remove it entirely for BC
reasons, because it was called from inline code.

Change-Id: I9183c666c466030787ac7c2386706b50abf23eaa
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 73e1bc09e63394490d91a223b3479b46c1595d66)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-22 13:54:18 +00:00
Volker Hilsheimer
dabd025173 Don't crash when removing the last visible tab
The code incorrectly tried to ensure that the firstVisible tab was a
valid index, even though there might not be any visible tab left after
removing the last visible tab.

The same logic didn't exist of the lastVisible tab, so we tripped the
assert in qBound, as max (being -1) ended up smaller than min (0).

Fix this by removing the wrong correcting of firstVisible to be always
valid. Make sure we emit currentChanged with -1 when no visible tab is
left after removing the current tab.

Add a test.

Fixes: QTBUG-104003
Change-Id: I27e6438a02d0a0f1ac4d0e0160cee4f33b3f3766
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit ac80cee846e270a42ce736cac80ca865321b5422)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-06-22 13:54:18 +00:00
Lorn Potter
be2e3a95c4 wasm: do not allow blocked windows to be resized
Fixes: QTBUG-102869
Change-Id: I69a4afbb67618dce7bcc499208e7e608e9adf212
Reviewed-by: David Skoland <david.skoland@qt.io>
(cherry picked from commit cf9cd8cc081397d08f48b6ae0d9380b11f4929dd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-22 13:54:18 +00:00
Thiago Macieira
f3abda4836 QJsonValue: fix incorrect to{Array,Object} when the value is empty
This is a repeat of commit de6ced66920600e659dbaa2509526a3bcb0b3360
"QCborValue: fix incorrect to{Array,Map} when the value is empty" (6.4),
which fixed the same thing for QCborValue. I've just copied the exact
same implementation onto the QJsonValue functions.

Fixes: QTBUG-104085
Change-Id: I175efddd75f24ae59057fffd16f6b257bf7ed36d
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
(cherry picked from commit e114fec62adf13b8c21ca890fb748cb27f391c25)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-22 13:54:18 +00:00
Joerg Bornemann
c604bdb47f qmake/MinGW: Install separate debug info of DLLs next to the DLL
...instead of next to the import library.

If separate_debug_info is enabled then we would create an install rule
that puts the .dll.debug file next to the .a file.  GDB however expects
the file to be next to the .dll.

Fix the installation rule in separate_debug_info.prf accordingly.  This
affects the MinGW packages of Qt 5.15 and user projects targeting MinGW.

Fixes: QTBUG-86790
Change-Id: If91c356e7e7f7f4330ebc43691e414929f9beb4b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit fc2e40e88d44d457ec5ebd1cc235696f3f478be9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-22 08:55:21 +00:00
Morten Sørvig
c320b61424 wasm: improve the specialHtmlTargets test
It can actually be undefined, so test for that before checking
the object type.

This fixes the asyncify build.

Change-Id: I5a6a0bc60c153290c35c20242400c59cd1312403
Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit 492b338f570afce3fbadb518bb0b9ab7fdf67e03)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-22 08:55:21 +00:00
Thiago Macieira
00d8c8114f moc: remove unnecessary emission of "#include <qbytearray.h>"
We don't need QByteArrayData any more (since 6.0).

[ChangeLog][Potentially Source-Incompatible Changes] moc no longer emits
an #include for QByteArray in the output file. None of the content that
moc generates needed that header, so this should not cause changes for
most people. However, codebases that #include'd the moc output
(something that is recommended) could be depending on this indirect
include.

Change-Id: Id0fb9ab0089845ee8843fffd16f9cf13dc8d61b5
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit cb0b1ee4417d67104c2c80e0c0c2d8a32e905df3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-22 08:55:21 +00:00
Thiago Macieira
00ea70b840 moc: rename the "offsetsAndSize" member to "offsetsAndSizes"
It contains more than one size.

Drive-by drop the const from the structure, so it becomes properly
trivial (though there's disagreement, see[1]).

[1] https://conformance.godbolt.org/z/rK1xW669K

Change-Id: Id0fb9ab0089845ee8843fffd16f9cc69ffd90aa4
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 3cf38290d9c459ecdbde9d6eb4dee09fc94f29a4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-22 08:55:21 +00:00
Thiago Macieira
7acb179df8 QThread:idealThreadCount: fix build with FreeBSD 13.1
They added the CPU_COUNT_S macro.

Change-Id: I6d3880c7d99d4fc494c8fffd16fabe9f8226ecda
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 45de3fedbac73bc8ff501117d64f19092e1b18b4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-22 08:55:20 +00:00
Lorn Potter
ff8e23973d wasm: Optimize use of opengles
- USE_WEBGL2 is depreciated, Emscripten now uses MAX_WEBGL_VERSION
- Optimize and remove use of emulated ES2 and ES3, which means
only use WebGL friendly subset.
Users can add USE_ES3=1 and USE_ES2=1 to the final linker arguments
for those respective versions in order to enable using
glDrawArrays and glDrawElements with unbound buffers.
See https://emscripten.org/docs/porting/multimedia_and_graphics/OpenGL-support.html

Change-Id: I11ae359966964b3e7aa6e61ccc714c2bfbf61f96
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 1e2d67152fe2c32112b721f68983eeb30825daee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-22 04:12:42 +00:00
Marc Mutz
cb52737369 tst_tostring: add benchmarks for QCOMPARE vs. QCOMPARE_EQ
There's currently no statistically-significant difference between the
two, due to a huge pessimistion in QTestLib where every QCOMPARE* and
QVERIFY writes 1KiB of data onto the stack before doing anything else,
so I'm not reporting numbers in this commit message.

Task-number: QTBUG-98873
Task-number: QTBUG-98874
Change-Id: I233878596f0a8fe6b96360adb839fecd72c398a2
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 32925d0a85b13d2a8032e580db544af5cdfecf8b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-22 04:12:42 +00:00
Marc Mutz
3cc1c41bc9 headerclean: remove dead code
The variable was misspelt, so we obviously don't need these
exceptions.

Change-Id: I691c9315bcde3aad72410ce01ae6dc6a013ee6fd
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit 06f21a387069fe02d6e97600fc445a3c71b0fb82)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-22 04:12:42 +00:00
Marc Mutz
fed05145bc Long live QT_INLINE_SINCE!
We have now had several requests for inlining previously-exported
member functions, but no standard mechanism to effect it.

As QT_REMOVED_SINCE has shown, there is great value in having such a
standard mechanism, so here is one.

With this change, to inline a previously exported (member) function,
simply

- mark the declaration with QT_<MODULE>_INLINE_SINCE

- move the definition into the header file (outside the class),

  - wrap it in QT_<MODULE>_INLINE_IMPL_SINCE

- #include the header into the module's removed_api.cpp

Just including the header into removed_api.cpp is enough, so you may
want to add a comment:

    #include "header.h" // uses QT_<MODULE>_INLINE_SINCE

The effect is as follows:

- A TU in a _different_ library will see an inline declaration,
  followed by the definition, and so it will see a normal inline
  function.

- A TU in the same library will, however, see a non-inline
  declaration, to avoid the ODR violation that at least GCC/ld are
  able to detect.

  - When QT_<MODULE>_BUILD_REMOVED_API is in effect, the TU will also
    see the definition, which is the same setup as before the change,
    except in a different TU, and therefore export the member.

  - When, OTOH, QT_<MODULE>_BUILD_REMOVED_API is _not_ in effect, the
    TU will see no declaration, assuming (correctly), that the
    definition will be supplied by a different TU.

This is, of course, an ODR violation, but not worse than what we do
elsewhere, as the definitions differ only between library and user.

The function is inline only for the users of the library, not the
library itself, which will still see the function as non-inline. If
inlining is critical within the library, too, the existing function
should call a new inline function, and calls in the same library should
be changed to call the new inline function instead.

Use the new mechanism to inline the QLocale ctor we intended to inline
for 6.3, but couldn't, because we hadn't found the magic incantation,
yet. Thiago found it a few weeks later, and this is what this patch is
based on.

Fixes: QTBUG-100452
Change-Id: Ia0030cddc64b6b92edfed860170d5204aa74b953
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 97f643faee876cadb36f110ef5a96abf1b68acff)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-22 04:12:42 +00:00
Marc Mutz
01fd23f986 QPostEventList: de-inline addEvent()
While in a private header, it did manage to place QList<QPostEvent>
operations near the top spots of all Qt template instantiations in a
QtWidgets build.

Task-number: QTBUG-97601
Change-Id: I4fa1972b8764b71ad0559633131e7e44b3d4ae6a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 1a030f6609ad6a9bbc1253e9e2d5efb198dc5998)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-22 04:12:42 +00:00
Sona Kurazyan
841f04f309 QPromise: run continuation(s) on destruction
If the QFuture is canceled because the associated QPromise has been
destroyed, we still need to run its continuations (i.e. onCanceled
handler, if it's attached), so replaced the cleanContinuation() call
inside ~QPromise() with runContinuation(), which will also take care of
cleaning the continuation.

[ChangeLog][QtCore][Important Behavior Changes] QFuture now runs its
continuations when its associated QPromise has been destroyed.
Previously, if a QFuture was canceled because the associated QPromise
has been destroyed, its continuations were skipped.

Fixes: QTBUG-103992
Change-Id: Ie05bc760c96c349aade8adb8d2fe5263aff8efac
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit bf3fc5c95cb4e6acedf242c00b7a1c3b455062bb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-22 04:12:41 +00:00
Marc Mutz
453fbbc2e8 tst_bench_shared_ptr: fix build with BOOST_NO_EXCEPTIONS
If, for whatever reason, BOOST_NO_EXCEPTIONS is defined, the user of
the Boost libraries is supposed to provide a definition of
boost::throw_exception, which we didn't.

We used to run into this only on ubsan builds, but it seems we now
have the problem on a regular Ubuntu 22.04 build, too (cf. bugreport).

Fix by adding the necessary definitions.

Fixes: QTBUG-104083
Change-Id: I9b061a158a5b77e8d286bd7b40312e5bc63ee8de
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 882fc48b9e0966c8d93ce71e0843a3c50da97be8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-22 04:12:41 +00:00
Shawn Rutledge
2b291f05a3 Replace a few more QString::fromLatin1() with _s literals
Wasn't done in 7d79b94db7debdd1896d1912e3052d5950b05df5

Task-number: QTBUG-98434
Change-Id: Id9c26f6b58e2c96a1c5f72154b735b136c57debc
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
(cherry picked from commit bd1ea2eb9294989184306729821caece1c0f7ce5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-22 04:12:41 +00:00
Mikolaj Boc
35d9de7082 Document QMouseEvent::pos() as deprecated in 6.0
The API is deprecated, but the documentation does not state that.

Fixes: PYSIDE-1750
Change-Id: I038ffeb958312d7648690743e06598a15dfb4cbc
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit bc676a7d7ae2a916f20e09ccf65a10d262817aa2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-22 04:12:41 +00:00
André de la Rocha
30daa8248e Add ExpandCollapse UI Automation pattern to combo boxes
Also add support to expandable/expanded states to QAccessibleComboBox
in widgets. QtDeclarative will still require updates so that QML combo
boxes report the expanded/collapsed state and react to UIA actions.

Task-number: QTBUG-103591
Change-Id: Iff8ba5e3143778ce17998dbe7f5f76cae658dc19
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ecd41111a3a7100f20e72b811b1010bc45e94127)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-22 04:12:41 +00:00
Topi Reinio
775b73a4eb Doc: Fix online macros for commercial template
qt-module-defaults-online.qdocconf includes online-specific overrides
for some of the documentation macros. This needs to happen also in
the commercial template to have equivalent behavior.

Change-Id: I2ca3246fbf16cef502e8eada056df6e8db573d5d
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
(cherry picked from commit 0c82d6a75a19183658eeabf6eda7f2e8ad292e37)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-22 04:12:41 +00:00
Alexey Edelev
39480e1841 Fix concurrent access to files by androiddeployqt in multi-abi builds
'androiddeployqt' supposed to copy artifacts that may not have
abi-specific identifies. One example is Qt6Android.jar file. We need
to prevent execution of multiple androiddeployqt instances in
parallel. External projects now are divided into two steps. The
first runs the build and can be executed in parallel to the build
steps from the other external projects. The second one triggers
androiddeployqt and can only be run exclusively in relation
to the similar steps from other ABI-specific external projects.

To solve the issue we build the dependency chain between the all
ABI-pecific qt_internal_${target}_copy_apk_dependencies targets to
execute androiddeployqt sequentially. This is non-optimal, but
guarantees that androiddeployqt is not running simultaneously with
another instance in external projects.

Fixes: QTBUG-104013
Change-Id: I39a25dd5f38ed988e0ca74b185024bc602ab81a1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 84e22f9e822cc71799bad01423cc407f2ea26fcd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-21 21:59:39 +00:00
Mårten Nordheim
a3cdb8632f function_ref test: Don't take reference of temporaries
When assigning the lambdas directly to a function_ref their lifetime is
limited to that of the expression. Store them on the stack first to
avoid the UB.

Fixes: QTBUG-104419
Change-Id: I3c85ac683b0bd7768b646dc9d0a1ed4dd173e6f3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 3d73aa660b5e1af5758ae7207ce1c05d7a0458e1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-21 21:59:38 +00:00
Andreas Eliasson
7666b58b6b Doc: Revise Qt Test tutorial
- Make it explicit that each chapter can be run as a stand-alone test
application
- Add a CMake section on how to build the executable

Task-number: QTBUG-103730
Change-Id: Id4c87c454521f698dcf16cfdc176318dd3e16786
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit ac171469a0021b5ddabd0197c31b814fbbaad16a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-21 21:59:38 +00:00
Ilya Fedin
5f25bbb632 xcb: Port XSync call in QXcbWindow::create to xcb
QXcbConnection::sync is a full equivalent of calling XSync with false,
they both are sending GetInputFocus request and getting its reply

Change-Id: I4f91b9447a02def41a8693a54312856b56e74811
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 56a33edf2a156727043c47023f5503f88913b466)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-21 21:59:38 +00:00
Shawn Rutledge
e58a29bdae Use CSS classes on html list items for checkbox support
If we replace the bullet character with a UC checkbox character, it
looks ok in a browser, and the HTML parser can recover the BlockMarker
attribute from the css class.

[ChangeLog][QtGui][Text] Checkbox list items can now be read and written
in both HTML and Markdown, including conversions.

Task-number: QTBUG-103714
Change-Id: Ic6b74512075cd4ac16d6f80fdf55b221447491a9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit eee9d252028c4b3b743c77a406cd6939eda3962f)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-06-21 13:56:26 +00:00
Nils Jeisecke
91cb059e3d xcb: fix missing initialization of m_cursor
Regression introduced in 9a4c98e55659b32db984612e6247ac193812a502:

m_cursor is not initialized and never set when monitorInfo is not
available in QXcbScreen::setMonitor. This seems to happen when running
in VNC, e.g. on a Raspberry Pi.

This usually results in crashing the application pretty soon.

Using a unique_ptr solves both the initialization and a possible leak
when setMonitor is called multiple times.

[ChangeLog][Linux/XCB] Fixed crash when no monitorInfo is available (e.g. VNC).

Fixes: QTBUG-104443
Change-Id: If13493c177121a1994b5d00dfbd64f1da694df2e
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 03e76ac23d3f9892c5853cab8760ca46c9117229)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-21 06:33:29 +00:00
Thiago Macieira
f298d347f5 qsimd: don't enforce shstk (CET) feature on launch
Clang with -march=tigerlake or -march=sapphirerapids pre-defines
__SHSTK__, which QtCore require the feature, even if the OS does not
have support for it. That's of no consequence because the compiler does
not generate shadow stack operations on its own.

Change-Id: Id0fb9ab0089845ee8843fffd16fa1ad910f008b8
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit d531c4b65dc47312256f9de2786a852f6ac4c1f5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-21 03:53:16 +00:00
Liang Qi
d4a0781cd6 xcb: set primary screen more correctly
For example, when having virtual monitor which includes two real
monitors, the primary information in xcb_randr_monitor_info_t
is normally false, because user can only set it for output.

Kudos to Jiang Wu for his first patch and details of the issue.

Done-with: Jiang Wu <wujiang@kylinos.cn>
Change-Id: I6af443ff69d347a6d86efc9c8ea7a5d18f4c3e24
Reviewed-by: JiDe Zhang <zhangjide@uniontech.com>
Reviewed-by: Jiang Wu <wujiang@kylinos.cn>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit a79e2aafd63071da42212f6d30e64aef878154ab)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-21 02:06:10 +00:00
Jiang Wu
dd7fcd633a xcb: clear m_singlescreen before update
Change-Id: Iafff57be82b5beb1f5702c00e0b6d7d0dd3ccdc2
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit fd9aeb1b38e1b42d497723457317ba1b0cfeef8e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-21 02:06:02 +00:00
Alexandru Croitor
2fb89b330b CMake: Warn when using qt6_add_big_resources on iOS
qt6_add_big_resources works by calling rcc to generate a resource
.cpp file, compiling it into an object file, then passing the
compiled object file to rcc again for further manipulation.

The path to the object file is passed to rcc using the
$<TARGET_OBJECTS> generator expression.

This generator expression does not work when used in
add_custom_command / file(GENERATE) when targeting iOS, because
CMake claims it does not know where the object file will be on-disk
(presumably because the location is controlled by Xcode itself and it
can vary based on the active architecture and sysroot).

The following error is shown at generation time:
 Error evaluating generator expression:

    $<TARGET_OBJECTS:rcc_object_foo>

  The evaluation of the TARGET_OBJECTS generator expression is only
  suitable for consumption by CMake (limited under Xcode with multiple
  architectures). It is not suitable for writing out elsewhere.

More details about the issue can be found at
https://gitlab.kitware.com/cmake/cmake/-/issues/20516

Trying to work around the issue by manually invoking the compiler
instead of using a genex so we know the location of the object file
hits similar issues in that we don't know the active arch and sysroot
for which to compile the object file.

Until the CMake limitation is lifted or we find a different fix, warn
that qt6_add_big_resources can't be used when targeting iOS and
fall back to using qt6_add_resources instead.

Note that qmake CONFIG+=big_resources also falls back to non-big
resources mode when targeting Xcode (mac-xcode) and doesn't even show
a warning.

Another note is that using CMake + Xcode + qt6_add_big_resources does
work when targeting macOS, although it generates some warnings

 warning same member name (qrc_assets.o) in output file used for input
 files: qrc_assets.o qrc_assets.o
 (due to use of basename, truncation, blank padding or duplicate input
 files)

So there is some hope this could be fixed for iOS in the future.

Fixes: QTBUG-103497
Change-Id: I91152247651ecd35e8110b8874399cb1b8b394bd
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 91fd8bdb116f461eec67bf8b17d41011039a63d9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-20 19:05:55 +00:00
Tor Arne Vestbø
0d60b9d0af Windows: Avoid accidentally copying QWindowsScreenManager
Change-Id: I60b219e9a3ea62a96c369ee910eacf06d61f4f71
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 7d2488280ee46fd07f31c895b765ee4072fc1a5a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-20 19:05:55 +00:00
Volker Hilsheimer
a31e0e4189 QGraphicsScene: respect that items can override selection changes
QGraphicsItems may override itemChange to prevent certain attribute
changes. Overriding ItemSelectedChange this way is explicitly documented
to be allowed.

However QGraphicsScene::clearSelection did not test whether items were
in fact deselected after the call to setSelection, and always cleared
the stored set of selected items.

Fix this by checking the actual selected state of the item as we iterate
over them, and store those items that are still selected in a set that
becomes the new selectedItems set (which will be empty if no item
overrides, which is the default).

Add a test that also checks that clearing the selection emits the
selectionChanged signal correctly (and does not if all selected items
block being deselected).

Fixes: QTBUG-85474
Change-Id: I665afc132876e02e6e1061b7be37f4f6e4be418f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 2e12479e06d6869f568f0a7ee939453cda9afdbf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-20 19:05:55 +00:00
Joerg Bornemann
066e9c6317 CMake: Find system harfbuzz even if pkg-config is disabled
FindWrapSystemHarfbuzz.cmake relied on pkg-config to find system
harfbuzz.  This patch makes it find system harfbuzz even if pkg-config
is not available or disabled.

Task-number: QTBUG-103894
Change-Id: I2a8fc64c738c7604f47de89f387002e40a9fa5e0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit f318c0e2d68ec0a3a98de43fcbaf51f84d5eb8a6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-20 19:05:55 +00:00
Heikki Halmet
7ef0abe855 BLACKLIST tst_qfont for Ubuntu 22.04
Task-number: QTBUG-84248
Change-Id: I2978cd2a6ed07bb6fc5769b174d0a897dfa3566d
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
(cherry picked from commit bb674adb25698943bc0cd45821b5036e240faabc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-20 19:05:55 +00:00
Heikki Halmet
1751795e4a BLACKLIST tst_QMenuBar::check_menuPosition for Ubuntu 22.04
Task-number: QTBUG-68865
Change-Id: I1eda9789a30737104c6e97de583a9f3022ae0bf6
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
(cherry picked from commit 5aca1fe1d07c9386435fd94c4a90d6f5dabc47b6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-20 19:05:54 +00:00
Heikki Halmet
4104816c0e BLACKLIST: tst_QGlyphRun::mixedScripts for Ubuntu 22.04
Task-number: QTBUG-68860
Change-Id: I79c085c7321e0bee78e8cb31daa8c7992d3a3ec6
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
(cherry picked from commit 903bde19a416d82fc255777955237fd410acd690)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-20 19:05:54 +00:00
Heikki Halmet
8f021d4894 BLACKLIST tst_QApplication::sendEventsOnProcessEvents for Ubuntu 22.04
Task-number: QTBUG-87137
Change-Id: Ib09382af7504f5ee078d23cc021c1b0faf051e23
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
(cherry picked from commit a3c43394bb391ef8d4439ed4c09d5644245038e7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-20 19:05:54 +00:00
Allan Sandfeld Jensen
ef7cda00dd Avoid misleading bindingStatus
Set it to nullptr on clear, and deal with possibly null bindingStatus.

Task-number: QTBUG-101177
Task-number: QTBUG-102403
Change-Id: I66cb4d505a4f7b377dc90b45ac13834fca19d399
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 0bd287627508c61a7abfd6430d8c1243ea153081)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-20 19:05:54 +00:00
Ilya Fedin
c38a40f795 Port QXlibEglIntegration::getCompatibleVisualId to xcb
In combination with EGL_EXT_platform_xcb support, this allows xcb_egl
to be used without xlib. Without EGL_EXT_platform_xcb support, this
still reduces amount of code using xlib.

Change-Id: I29e2b29f7ef8ea34320887f62697f84232b86fba
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit c3e624eb50ff56dd0d172999a49c454f37ca62cd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-20 19:05:54 +00:00
Louis du Verdier
c7958ba015 Fix tst_AndroidAssets, broken by recent changes on assets load speed
Recent changes on load speed of individual assets made
AndroidAbstractFileEngine use a cache for basic information in order
to avoid to have to open assets every time a QFileInfo is created,
which was very expensive for older phones.

However, size() method was forgotten and continued to expect that the
asset would be opened first, and therefore QFileInfo().size() would
always return -1.

This change fixes this by caching as well the information about the
size of the asset, and also reverts a part in open() to close() first
in case asset would already be opened, in order to keep previous
behavior (even if this did not cause any known issue).

Fixes: QTBUG-104412
Change-Id: I992f31b8f9e14dfec44cec78d0c1a2a3e18bdb7f
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit d7068eaad7c180c814a766c91cebee25f04513a6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-20 19:05:54 +00:00
Volker Hilsheimer
f11ae9fb37 Make the new setCurrentId the writer for the respective property
Amends 2140edaaab0bf61f354db521efca773568becc56.

Change-Id: Idc1ace4229b8706d9b44f1727105cc9aaab1a86d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit e0a729dfd202c95dc858c71e95fe0072821b2b21)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-20 14:15:41 +00:00
Laszlo Papp
2864ba0cc3 QAbstractItemDelegate: Remove a duplicate doc entry
Change-Id: I02887e6bf5892b4697af2aabcd1f1335e15b4f06
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 4679d16db8d2052a63e3ed8fd113b22f3eba0689)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-20 14:15:41 +00:00
Volker Hilsheimer
9e07f4ce18 Document QJniObject::construct
Added for 6.4. Not extremely useful as long as the macros that allow
the declaration of new class and type strings also being documented.

Change-Id: I9ee466fdd0aaccec1e627ceb313b5a5c17e3f3fa
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
(cherry picked from commit 145bfe6054f8f7fcc32d0442e8845aa59af2fc1a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-20 14:15:41 +00:00
Richard Moe Gustavsen
97a8a73ce4 QTableView: set correct clip on QPainter when using spans
As it stood, QTableView would sometimes show drawing
artifacts when sections (rows or columns) where
rearranged, in combination with spans.

The reason is that the current code would go through the
currently visible cells in the viewport to check if any of
them where affected by a span. But the stored spans (in
QSpanCollection) is kept in sync with the column layout in
the model, and doesn't know anything about the rearranged
columns in the view. But a column with spans that is moved
to the left of the viewport can affect the painting of
the viewport as well, and needs to be taken into consideration.
For that reason, the current solution that uses
QSpanCollection::spanAt(x, y), will in that case fail.

Since it seems sensible that QSpanCollection is kept in sync with
the model (it makes model changes that affect spans easier to
handle), this patch will not change QSpanCollection. Instead, it
will iterate through all the spans (which is assumed to normally be
a limited size), convert them to the column layout of the view
(visual instead of logical), and find the ones that overlap.
Overlapping spans will, like before, be added as clip rects
to the QPainter.

Fixes: QTBUG-91896
Change-Id: Iabe20df13cbd41a68f1104d3d9e24b89c4b88913
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 20a40035faab6dd32b664b5ec21b6c34cf37321b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-20 14:15:41 +00:00
Fabian Kosmale
980395c764 Long live the ICU-based QStringConverter interface!
This adds support for additional codecs to QStringConverter when ICU is
available.

We store the converter in the state (d[0]), and its canonical name in
d[1]. We need the name there, as in the clear function we close the
UConverter, and set the pointer to null. Consequently, the actual
conversion functions might need to re-open the converter again. The
advantage of this approach is that clear is used in the destructor of
State, and with this approach we properly clean up the state.
There is however a disadvantage: The clear function was so far also used
for resetting the state when QStringConverter::resetState . Discarding
the whole Uconverter for that is however rather costly. For that reason
we modify resetState to call a new function, State::reset. For existing
converters, it behaves the same as clear; for the ICU based converter,
we call the more efficient ucnv_reset. Code compiled against Qt 6.4 can
benefit from this more efficient version; code compiled against older Qt
versions will continue to work, as the conversion functions can just
recretate the converter from the name.
We can distinguish between ICU and non-ICU converters by checking if the
UsesIcu flag is set.

QStringConverter::name is changed to return the name stored in d[1]. The
interface of the ICU converter has a dummy name, so code using the old
name function from QT < 6.4 still returns something, namely a message
asking the user to recompile.
The function is moved out of line, as we need to check for the private
ICU feature, and want to avoid having that check in the public header.

As the QStringConverter ctor taking a name now can allocate memory, it
can no longer be noexcept. Removing the noexceptness is safe, as it was
only added after Qt 6.3.

Note that we cannot extend the API consuming or returning Encoding, as
we use Encoding values to index into an array of converter interfaces in
inline API.

Further API to support getting an ICU converter for HTML will be added
in a future commit.

Currently, the code depending on ICU is enabled at compile time if ICU
is found. However, in the future it could be moved into a plugin to
avoid a hard dependency on ICU in Core.

[ChangeLog][Corelib][Text] QStringConverter and API using it now
supports more text codecs if Qt is compiled with ICU support.

Fixes: QTBUG-103375
Change-Id: I7afb92fc68ef994179ebc7a3aa73beebb1386204
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 122270d6bea164e6df4357f4d4d77aacfa430470)
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-06-20 16:15:40 +02:00
Yuhang Zhao
5d82068e86 Windows QPA: Fix indention
It seems this block of code was originally copied from elsewhere
so the original indention is preserved.

Change-Id: I53ab8e58b4304dfc768bd6472255a6c2d0471d5e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 1e71071c92ee4520f392d3cec01131bb815117b1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-20 08:57:07 +00:00
Yuhang Zhao
ade1cca41b Network: make Public Suffix List constexpr
Upstream PR: https://github.com/rockdaboot/libpsl/pull/182

The repo owner denied the PR because the library only
produces C89-compatible code and constexpr is a C++ feature.

Task-number: QTBUG-100485
Change-Id: I9e01705b27022a636a98ac67b19169677d7c7652
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 797a493f5093187d2a849d9c483b79229a1316f0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-20 08:56:55 +00:00
Yuhang Zhao
cebb7bdac7 QOperatingSystemVersion: Add new Windows version
And also update some docs to provide more detailed info.

Change-Id: I7b51fcb6613399cb4f1dd5d75cf3168df195577b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7225ed749da2e60b3cdd9b509d0291a0e87ba94e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-20 08:29:37 +00:00
Thiago Macieira
49727764f7 Fix improper moc includes inside the Qt namespace
Change-Id: Id0fb9ab0089845ee8843fffd16fa1b1413fd0d41
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 23bf260f10f4b507e2e19398a16574ca77fe774d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-20 07:35:21 +00:00
Tor Arne Vestbø
d3d3549ff0 Windows: Replace lcQpaWindows logging with lcQpaScreen in screen code
Change-Id: I1d2fd586aac1163aa449f813ce3b7244c6ebaee0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit d350373133f169b44fd98faab6fe3f75abab6282)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-18 21:44:11 +00:00
Marcel Kummer
8f0fa4c948 QBoxLayout: Add assertion that catches out of bounds insertion indices
As of Qt6, QList will assert that an insertion index is in range of
existing values. QBoxLayout interprets negative indices as "append at
the end". That part is covered.
Indices larger than the number of items in the layout would trigger the
assertion in QList, but after the insert method had returned. That would
make it hard to debug. This change asserts the index range before
inserting, thus making it easier to spot the problem.

Fixes: QTBUG-103775
Change-Id: Ida099f785263fe8a5c8a1d0a48c4ff87713549b4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e457aeec3802e79d33347768cb9c50eb87deed92)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-18 21:44:06 +00:00
Tor Arne Vestbø
7a3aa146a5 Windows: Decouple screen change monitoring from top level QWindows
The WM_DISPLAYCHANGE message it sent when displays are added, removed,
or update their properties such as the scale/DPI.

We were processing this message as part of QWindowsContext::windowsProc(),
which meant that we would only react to display changes if there was a
QWindow on screen. Just creating a QGuiApplication was insufficient to
pick up changes to screens after startup.

In addition, despite being documented to post messages to child windows,
WM_DISPLAYCHANGE only ends up in top level windows. Presumably it's the
top level window's responsibility to post the message to child windows.
As a result, if a QWindow was a native child window of a foreign window,
such as in audio plugins being hosted in a DAW, we would again fail to
pick up display changes.

We solve both these cases by decoupling the WM_DISPLAYCHANGE handling
from QWindowsContext::windowsProc(), by creating a dedicated window
for listening to WM_DISPLAYCHANGE. This is similar to how we already
handle tray icons, power notifications, clipboard, etc -- the only
difference being that since purely HWND_MESSAGE windows do not
receive WM_DISPLAYCHANGE it's an actual invisible WS_TILED window.

This also lets us remove the workaround for QTBUG-79248, which was
doing screen updates in response to WM_DPICHANGED when detecting
that there were no QWindows.

Task-number: QTBUG-103383
Task-number: QTBUG-79248
Fixes: QTBUG-102343
Change-Id: I905d8253069ec339b193edf05c052d21361ca3e9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit fa0b2ef81c0d22f4038235871fbc1abda55887d1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-18 21:44:04 +00:00
Thiago Macieira
d41310a2c4 qmetatype.h: remove #undef for something that was never #define'd
Change-Id: Id0fb9ab0089845ee8843fffd16f976868e3ab448
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit f23d83c43e1c4a462014f0d27596a06f7bc8bf13)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-18 18:43:41 +00:00
Thiago Macieira
4afbbfdfde QMetaType: use explicit load/store operations on QBasicAtomicInt
QBasicAtomicInt::operator int() does loadAcquire() and operator=() does
storeRelease().

Change-Id: Id0fb9ab0089845ee8843fffd16f9a1ece6823777
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 4c1b1f2ad884455bdebc779b6dcab5dd3815a9c9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-18 18:43:34 +00:00
Lorn Potter
3cb900a18f wasm: Fix up namespacing in wasm platform plugin
Change-Id: I2fdbb6688b252743578dfcd58f9259eb5ac3cca8
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit ff0c7dfc6e3198c91cad099fd09657b8abba1d33)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-18 04:38:29 +00:00
Lorn Potter
d997d1241b wasm: fix unicode input
also remove duplicated function call to get Qt key for event

Fixes: QTBUG-78826
Change-Id: Ibaf0dd3eb428b65280ed1f840a4849b44f2868e0
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 87c2a401dabacddb94b61595e2873627c222c60a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-17 23:54:17 +00:00
Volker Hilsheimer
1f72afef89 Provide overload for Qt::AlignmentFlags in item widget items
Amends 53ee4c8b1f7ae72e7005166e1c0dbc4659f2ab32, which deprecated
QListWidgetItem::setTextAlignment(int) etc and provided a typesafe
Qt::Alignment overload instead. However, Qt::AlignLeft by itself is of
type Qt::AlignmentFlag, it only becomes a Qt::Alignment when or'ed
with another alignment flag. So the deprecated int-overload was taken
by the compiler, resulting in a deprecation warning.

Add a Qt::AlignmentFlag overload in addition, and document it as
\internal since it is just a C++ technicality that we need both.

Change-Id: Ide97eed7f6d1f89a5f955b2ed45167e771bd8c81
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit fa814fcfea4b35d14487e68c25beafbaf5579e91)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-17 18:59:37 +00:00
Ivan Solovev
1ed89b7012 QMainWindow: fix restoreState() for toolbars
Restoring the toolbar state of a QMainWindow could not update
QWidgetPrivate::widgetItem for the QToolBar, because at that point it
was still holding the pointer to the widgetItem of the previous state.
Later on, when the new state was successfully applied, the previous
state was deleted, and the corresponding widgetItem was reset to
nullptr.

This patch explicitly resets the QToolBar's widgetItem while updating
the state, so that it is later correctly updated while creating a
new QWidgetItemV2.

Fixes: QTBUG-102395
Change-Id: I17613d62423edcc0faf85ecb0a714865a50d87e8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 2ed54dedf3783471716b21509db1f8279d5b5af8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-17 18:59:36 +00:00
Alexandru Croitor
8562f3aee6 CMake: Android: Fix 'qmldir file not found at' warnings
androiddepployqt calls qmlimportscanner to find qml modules.

Due to an issue in a generator expression, CMake did not write out the
android default qml output directory to the deployment json file,
which in turn means that qmlimportscanner did not get that
information.
When the scanner scanned the sources, it found some relative imports
but couldn't find relevant qmldir files because they were in an
android-specific directory.

This caused warnings like 'qmldir file not found at /some/path'
repeatedly.

Fix the generator expression to use $<COMMA> instead of , so that the
genex condition is evaluated successfully and the extra qml import
paths are passed along to qmlimportscanner.

Amends 76665f2a72857916667ebe6b04a804ed8abb5853

Fixes: QTBUG-102595
Change-Id: Ia74c3c80f12d05b0a9cd0978df1a58bb5582198a
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 81b5395aef3bce878574fc26e4e75a4498f1c948)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-17 18:59:34 +00:00
Alexandru Croitor
c9a79666ac CMake: Fix Xcode common dependency issues for other_files IDE target
A generated file can be added to a resource target, which in turn
adds it to the other_files target. With the Xcode generator, this can
lead to errors like

 The custom command generating foo.txt is attached to multiple
 targets:
      foo_other_files
      foo_resources_1
 but none of these is a common dependency of the other(s).  This is
      not allowed by the Xcode "new build system".

Neither of the targets depend on each other because logically
they shouldn't depend on each other.
And yet XCode wants that each generated file is attached only to one
target, which will be a common dependency for the other targets.

Make sure _qt_internal_expose_source_file_to_ide extracts and uses
that common target dependency just like
qt_add_resources -> _qt_internal_process_resource already does.

One case of a common target dependency is the _lrelease target
in qttools which was added in 5b0e765ab0dddba86662925cb44aeac748a286b7

Another case is in qt_add_shaders in qtshadertools.

I expect we might encounter other cases where we need to introduce a
common driving target.

Task-number: QTBUG-103723
Change-Id: Ideff023718a6ce109a4b3eefa01bffa79d1c6a3e
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 20dd4a43f08c5417c1b7751b66e8b3fa337ad01d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-17 18:59:32 +00:00
Axel Spoerl
ba2584126b Update window state in QWindowsWindow and QXcbWindow geometry setters
When QWidget::resize() is called on a maximized or minimized QWidget,
the window state of the widget and the corresponding QWindow is not
updated (i.e. remains maximized or minimized).

This patch updates the window state to Qt:WindowNoState when
setGeometry() is called in QWindowsWindow or QXcbWindow.

A test is added in tst_QWidget.

Fixes: QTBUG-104201
Change-Id: I07491fb9293d13509573fc403750da0a50f6a785
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 99c8ffb9f259760e45618f0988bbd79237d6d291)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-17 18:59:31 +00:00
Volker Hilsheimer
5ea55bc1bc macOS: set print dialog up with page attributes when no printer is installed
When the print dialog is opened without a printer installed, then the
printer's output format is PDF rather than native. In this case, we need
to set the NSPrintInfo with some page atttributes explicitly, and not
default to the application-wide NSPrintInfo.sharedPrintInfo. Otherwise,
the print dialog will show the wrong page size and orientation, and the
printer will not have the previously set values when the dialog returns.

The dialog always shows the wrong values for the page margins (only
available through the presets dialog), but the printer's values are not
overridden. Also, the print range is taken care of correctly by the code
further down in this function, irrespective of the printer's output
format.

Note: this cannot be unit tested as we need to open the native print
dialog on a system without printer installed, and compare the values we
set on the printer before opening the dialog with the values after the
dialog was successfully finished via PDF->Save as PDF.

Fixes: QTBUG-100188
Change-Id: I8f1561e054f6a867b131111845c9b061778e4eb0
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit b2fb14b7ba1db35eebf7621ead12909b35ec4042)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-17 17:06:19 +00:00
Marcel Kummer
020e6a2244 QBoxLayout: Pull out handling for negative insertion indices
This snippet occurs in every insert function further down. Let's pull
it out in preparation for adding an assertion that the index is in
range, which would also need to be added to every insert function.

Fixes: QTBUG-103775
Change-Id: I419f57434f860df4c947853ac307826994f0198b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 29176bf2f836ba05206680ae1c00edf786202648)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-17 16:29:20 +00:00
Janne Juntunen
a6081a8163 QFont: remove support for comma split setFamily()
In the documentation it is said that from Qt 6.2 onwards setFamily()
only sets a single family but so far this hasn't been the case.

Fixes: QTBUG-102768
Change-Id: I2a5037ea1385cb8c6644d1e256b89e167c590967
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit a2cb9ae8cc6c512e9c16f3fecc79dad9d585948a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-17 16:02:34 +00:00
Alexey Edelev
f0a24e9825 Add missing argument to list(APPEND in __qt_internal_get_tool_imported_location
Amends f9e48854af4a25f13f593dd151071c8eda53b65f

Change-Id: Iea525c70cca9873c0f3d96967af6cd95d57cac9b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 4d7ba44e4da94497231ebded59b1564597857eed)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-17 16:02:33 +00:00
Edward Welbourne
18e83ffe84 Remove a misleading sentence from QDomDocument::setContent() doc
QXmlReader has been replaced by QXmlStreamReader and, either way,
there is currently no way to over-ride the purging of space-only
nodes.

Task-number: QTBUG-103753
Change-Id: I7bae72d81f1b2503f93c691081137b4f60eeadda
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
(cherry picked from commit 80f8e380db8c2e9b64409eb319c96a0c2c84c886)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-17 13:48:54 +00:00
Volker Hilsheimer
ef75047a63 Accessibility: don't emit focus change when reason is window activation
If a window becomes active, then the accessibility system gets informed
about that already. Qt puts focus on the focus child of the activated
window afterwards, and if this emits another accessibility event, then
accessibility clients like Windows Narrator will stop reading the
activated window, and instead read about the focused widget.

This makes dialogs like message boxes poorly accessible.

Accessibility clients already know that a window became active, and can
query Qt about the focused child within that window.

Amend test case.

Fixes: QTBUG-101585
Change-Id: I2d6bff7c415a6f29c4a4f7f4e4be38079fb976ca
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit 79a11470f3c4c61951906223f97001a77ce36500)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-16 22:39:26 +00:00
Volker Hilsheimer
bbde24f19a Implement a dedicated QAccessibleInterface for QMessageBox
QMessageBox has text values that an accessible client should be able to
read directly without having to navigate through the text labels.

Add test coverage.

Windows Narrator is inconsistent in reading the contents of a message
box. It might skip them completely, even though the text property is
read through the interface.

Task-number: QTBUG-101585
Change-Id: I639c2210a627733c093743790c6a6b83f4bb80d0
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit 56d6a360206c7bd93e6503a63daf1517ff40a1d4)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-06-16 22:39:26 +00:00
Morten Sørvig
02c9117836 Windows QPA: Update screen on child window DPI change
Windows does not send WM_DPICHANGED to child windows, which means
that the normal DPI change handling code does not run for QWindows
which are embedded in a foreign, non-Qt, window.

Add code which handles WM_DPICHANGED_AFTERPARENT. This event is
sent to all child windows, but not the top-level window. Call
checkForScreenChanged() here, similar to what the WM_DPICHANGED code
does.

This commit does not add code to resize the child window, since
it is uncertain if this is the responsibility of the window which
receives WM_DPICHANGED, or of each child window.

Done-with: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Task-number: QTBUG-103383
Change-Id: Icf85dd0afa806609dbbe0ffc36efbc5127962c39
Reviewed-by: <stefan.wastl@native-instruments.de>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 077eddb3e1aaba1517d67e7c83574c16e971dc67)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-16 22:39:26 +00:00
Cristian Adam
393eb4fa97 Doc: Document how to treat qt_add_big_resources args as source files
The arguments to qt_add_big_resources are not known to CMake as source
files.

They need to be added explicitly to a CMake target in order for Qt Creator
to treat them as source files and in the case of a qrc file to expand
the contents in the project view.

Fixes: QTBUG-104320
Change-Id: Iea755d998e8f9814a82983272731b0c654f80644
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 7037f4620fb59b669d32fbce0ef79aabe38a716a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-16 22:39:26 +00:00
Dimitrios Apostolou
b8ed8789db qt-testrunner: Commit forgotten README file
Change-Id: Ie307b95947a6910bd65bb22ecf938fae9de22f9d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 1ab354b2453bce60cd5cd800d87a83fc9e30a0c6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-16 22:39:26 +00:00
Ivan Solovev
a9a48466a1 QComboBox: emit currentIndexChanged() and currentTextChanged() when the model is cleared
QComboBox uses QPersistentModelIndex to store the current index of the
underlying model. When the model is cleared, that index is automatically
invalidated, so calling QComboBoxPrivate::setCurrentIndex(QModelIndex())
does not result in signals being emitted, because we do not detect the
index change.

This patch uses indexBeforeChange to detect such situation and emit all
necessary signals.

Fixes: QTBUG-103007
Change-Id: I29326830a30a17900839e8d1737a08bd940081ea
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 662184ac68803aac553921520a1b4b7b23a0633c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-16 22:39:25 +00:00
Alexandru Croitor
82fd9a259d CMake: Warn when using CMake 3.21.1
Changing a C++ source file can trigger rebuilds of a lot of other
source files that might include AUTOGEN'ed headers or sources.

See https://gitlab.kitware.com/cmake/cmake/-/issues/22531 for some
details. Fixed in CMake 3.21.2.
There are still files that are rebuilt even in 3.21.2, but it's less,
and it returns to the status quo of how it was in 3.21.0 or earlier
versions.

Task-number: QTBUG-104352
Change-Id: Ie1c991d52df48442d4134e4ed22a8137a3c993c8
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit b3e3b124892d01adeba378aac45224b2dea04fde)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-16 22:39:25 +00:00
Laszlo Agocs
81cd07baf6 Work around lavapipe bug in tst_qvulkan
Work around https://gitlab.freedesktop.org/mesa/mesa/-/issues/5875 by
treating the driver as broken when both the driver and device UUIDs
are all zeroes.

Fixes: QTBUG-104231
Change-Id: Ibf7973361d472ebb1cb433bc61b50b2828f75c6b
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit e4961afed2fc019c2a95ca582f86da2de56e351f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-16 22:39:25 +00:00
Lorn Potter
aaa806bac5 wasm: fix some coding style
- shorten a couple extra long lines
 - add space between functions

Change-Id: I14ad7448372ba50f4b0299535c4261a5bbf415b7
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 4d25429746dd1d71aac373c5ecd3d56756ce4d80)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-16 22:39:25 +00:00
Tor Arne Vestbø
a7020580e1 macOS: Avoid recursively updating screens when window moves screen
The QWSI APIs for reporting added or removed screens is not transactional,
so when several screens change at once Qt will see each screen change as
a separate state.

As a result, Qt, or the application itself, may react to the first of
many screen updates by moving a window to a different screen -- one
which is going to updated (removed) in the next iteration of QWSI
calls.

This caused trouble on macOS, where we use many different signals to
detect that the system has changed the screens, one of them being that
a window has been moved to a different screen.

In the scenario above, we would be in the process of updating screens
in response to the system going to sleep, which means all 3 connected
screens will be disconnected and replaced with one fake screen provided
by the system.

As we delivered the removal of the first QScreen, Qt or the application,
would respond by moving the window to one of the other two screens, which
in turn would recursively trigger another round of screen updates. This
round would then proceed to remove (and delete) all remaining QScreens.
When we then recursed back to the initial round of screen updates
we would continue iterating and operating on screens that had already
been removed, causing a crash.

Since we know that the screens will stabilize eventually, and that
QCocoaScreen has cached all info based on the displayId and NSScreen,
we can safely skip any recursive invocations of updateScreens().

Fixes: QTBUG-102021
Fixes: QTBUG-84741
Invaluable-help-by: Bruno Cadoret <bruno.cadoret_1@signify.com>
Change-Id: I9ff96dbcbc6f308ad2729faf2db2de7ef08513c0
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 2a76c41fdd1546b614295ccf72ae2f0bcc704e1d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-16 22:39:25 +00:00
hjk
e0aa72c32d QSettings: Fix reading of the [%General] section
The currentSection key was accidentally using the whole remaining
section contents.

Change-Id: Iec6e38636e519170eef136401ede4b626e12754a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 903a883044165b8f40f500684c437f4102031425)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-16 22:39:25 +00:00
Thiago Macieira
34a130a2da QStringConverter: fix use-after-free in the stack in the test
Detected by ASan. Introduced by aef27c5aa2f43e8e34970168dfc517062cc87db8

Fixes: QTBUG-104261
Change-Id: Id0fb9ab0089845ee8843fffd16f88bdeb4f42c7c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 2a1122f46587e27f3d93e1f2af63f439116569c4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-16 14:38:16 +00:00
Maximilian Goldstein
5039fec32a qwasmtheme: Enable hover effects by default
Previously hover effects had to be enabled manually due to not being
enabled in the platform style. This change enables them by default.

Fixes: QTBUG-88799
Change-Id: I014e1f5dfcd9b15656f11e12ab75a77d42f4815c
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 64f86ca03eeda4ea52ec15546edc5a0bc183bc8a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-16 07:03:03 +00:00
Thiago Macieira
cb2e536365 qHash: pass QByteArrayView to qHash() by value
The QBAV one should pass the parameter by value, like QStringView. And
now that we have it, the non-View one should call the View one in an
inline function, like we already do for QString.

The extra, defaulted parameter is there only so we get a different
signature in the new inline function compared to the removed one.

Change-Id: If05aeeb7176e4f13af9afffd16e7f08062b1dc86
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit bc144312c18e7436275267ad8900fce980597c45)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-16 04:19:13 +00:00
Louis du Verdier
ef6d08ac2a Android: Improve loading speed of individual assets
This change improves the loading speed of files stored in Android assets
folder by caching the information about files already opened.

Prior to the change, when creating a QFile or QFileInfo to an asset
file, the engine would first scan all the file's directory and parent
directories in order to cache all this in FolderIterator::m_assetsCache.
Due to the nature of Android assets, it might be very slow, depending on
the number of images in this tree.

In this patch, individual file accesses will stop using FolderIterator
and will simply open what is asked, caching the information about the
resource in order to avoid to have to call the expensive
AAssetManager_open if the file is accessed again (e.g. by QFileInfo).

Fixes: QTBUG-101161
Change-Id: Iaedf4cdf83d5116053b51895a6795d43bc60f942
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit edd983071e0a90ee8665d2f45916fb575fc25857)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-15 19:49:44 +00:00
Kai Köhne
f837925c57 Fix typos in docs and comments
Found by codespell

Change-Id: Ie3e301a23830c773a2e9aff487c702a223d246eb
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 9d2cc4dd766ca6538e17040b6ac845ed880ab0fe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-15 19:49:40 +00:00
Edward Welbourne
f3e7d0fb30 Don't exit(1) on unrecognised test function name, just report a failure
This way, if you name several test functions on the command-line,
you'll at least get the ones that do exist run (and you'll be told all
of the ones that don't exist, rather than only the first).

Change-Id: I14a515fcfacb6ca49e0470b236c05475b25db4f2
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
(cherry picked from commit 37bad1f43b33a460f402f16280719d3b49dd7b24)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-15 19:49:40 +00:00
Allan Sandfeld Jensen
b44efd693c Replace QT_NO_ACCESSIBILITY with QT_CONFIG(accessibility)
Change-Id: Iee4bd8970810be1b23bdba65a74de912401dca65
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit f53f7095044275767e389d16aabad5ff7144ec9f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-15 16:28:42 +00:00
Guineng Ni
7ea9a6f3ad macdeployqt: macdeployqt process some libraries(e.g. ffmpeg) incorrect
ffmpeg and nettle are different from other libraries, they use symbol
link as their inner module dependencies. Calling one more
install_name_tool can handle this case.

Fixes: QTBUG-100093
Change-Id: I12cdd53bd5aa3120910070ba283178686deb3eb0
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 6dbe45c96a6b807cfc19c34cf2833504148d019f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-15 16:28:42 +00:00
Edward Welbourne
265ca8528c Make two QDT benchmarks data-driven and add more rows
The QDateTime benchmark's toMSecsSinceEpoch() and
toMSecsSinceEpochTz() each iterated the 2010s and had 1950 and 2050
variants for two other decades. I want to also test some earlier
decades and do similar for create(), so combine the existing triplets
as three rows of a data-driven test for each triplet, add the new rows
and apply the same to create().

In the process, turn an enum used for qint64 constants into a set of
constexpr qint64 declarations.

Task-number: QTBUG-104012
Change-Id: I2657346b65d96a7ef7503cd33c870b688ea5dbff
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 12eac545b6f5a6f963fcc1d06c3ae426260adb9b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-15 06:58:00 +00:00
Samuel Mira
16414f6d35 Android: Fix QSettings when using content URL
Using QSettings with Content URL in Android failed because of 3 issues:
* the lock file assumed that it could append ".lock" to the file name
for its name
* the lock file assumed that it could write in the same directory as the
file
* the QSaveFile used by QSettings requires direct write on content URL
but setDirectWriteFallback is set to false on QSettings by default

This patch fixes those issues by, when it is an Content URL in Android,
saving the lock file in QStandardPaths::CacheLocation and setting the
setDirectWriteFallback to true.
This does not break backwards compatibility because appending ".lock"
to the Content URL will always make an invalid URL, so it did not work
before.

Fixes: QTBUG-103455
Change-Id: I92867577507b7069e4e6091d94e0931bb6dbcbed
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 140ca89a3c2b8d78889d27217f977cd4de10041b)
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-06-15 06:58:00 +00:00
Morten Sørvig
df1beb422a Add support for painting at integer DPR with downscale
Enable by setting QT_WIDGETS_HIGHDPI_DOWNSCALE=1 and QT_WIDGETS_RHI=1.

This will make the backing store and painter operate at the next
highest integer DPR in cases where QWindow::devicePixelRatio() returns
a fractional value. The backing store image will then be downscaled
to the target DPR at flush time, using the RHI flush pipeline.

[ChangeLog][QWidgets] Added experimental support for always
painting at an integer device pixel ratio (rounding the DPR up if
necessary), followed by a downscale to the target DPR.Enable by setting
QT_WIDGETS_HIGHDPI_DOWNSCALE=1 and QT_WIDGETS_RHI=1.

Task-number: QTBUG-86344
Change-Id: Id5b834a0e3499818b0b656161f5e0c38a6caa340
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 79bead6c3b507331614dcc3c789e18438bc10395)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-15 06:58:00 +00:00
Morten Sørvig
b623835dd9 Make rhiFlush() support custom source DPR
The rhiFlush() implementation currently assumes that
QWindow->devicePixelRatio() is the correct scale factor for
transforming device independent window geometry to source geometry.

However, this assumption does not hold if/when we add support
for drawing to a rounded-up DPR, with a downscale later in
the rhiFlush implementation.

Fix this by adding a sourceDevicePixelRatio argument to rhiFlush(),
which is set to either QWindow::devicePixelRatio() or
QWidget::devicePixelRatio(), depending on from where it is used.

Change deviceRect() and friends in qbackingstoredefualtcompositor.cpp
to be scale*() functions instead which take a scale factor instead
of a QWindow. Update call sites to use srouceDevicePixelRatio
where that makes sense.

Change-Id: Idb7b1e2f36816a201e00f0defe100d2dc079cb17
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit d38118c80828eecb3c0192404249c1fad5660792)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-15 06:58:00 +00:00
Volker Krause
71f57c3e7e Fix renameat2 configure check
Give this a chance to ever succeed by not using undefined variables in
the test code.

Found by a KDE unit test observing changes in inotify behavior between
Qt5 and Qt6.

Change-Id: Iceb743d88dfa093c02d76ce32ea5c8ced24bfc5b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 193039dff343139de4a83b7811c11927be63a4ed)
2022-06-14 14:52:09 +00:00
Alexandru Croitor
2b8938edeb qmake: Document Xcode behavior when bundling translation files
Xcode's legacy and new build system modes have different behavior
in how they bundle resource paths that start with lang_code.lproj.

Document how to bundle translation files for both legacy
and new build systems.

Fixes: QTBUG-98417
Change-Id: I857ec76577f8244a751d4bf38fbe305fef614734
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit 94207621ee768ddedf0021aef99566a8ce90d22b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-14 13:45:18 +00:00
Axel Spoerl
12b1ec4b30 xcb: Replace qCWarning by qCDebug in QXcbConnection::printXcbError()
Example:
Error "BadWindow" (3) is raised by the XCB backend when a mouse event
is processed on a resource that disappears between posting and
processing of the event.
That constellation is harmless and can occur in async environments.

As XCB errors point to coding issues, this patch changes their logging
behavior from qCWarning to qCDebug.

Fixes: QTBUG-56893
Change-Id: Idee5ee80efaf9cd6686448779f76c68d5e4c9b63
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 373392eeb4199654e954f70ce919850f090d59bd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-14 13:45:15 +00:00
Eskil Abrahamsen Blomfeldt
763fb35d9d CoreText: Fix fonts with synthetic stretch
If a font is synthetically condensed / expanded, we need to scale
the advances as well as the bounding boxes for the glyph cache.
The logic is adapted from DirectWrite font engine, where the same
scaling is already in place.

[ChangeLog][macOS] Fixed a bug where synthetically stretched fonts
would get the wrong advances and sometimes glyphs would be clipped.

Fixes: QTBUG-103838
Change-Id: I09fc87b245d1f2de980c10ad9253b9a83571f714
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 992a318d391db397d6fec78532ce9e60af098e58)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-14 12:58:20 +00:00
Eskil Abrahamsen Blomfeldt
97d7042c45 Fix font rendering when Qt is configured with -no-harfbuzz
When Qt was configured with -no-harfbuzz, we would get overlapping
glyphs, because we skipped the shaping step but did not set up things
correctly before that. Instead, we force the PreferNoShaping code path
when there is no shaper available.

[ChangeLog][Text] Fixed font layouts when Qt was configured without
Harfbuzz.

Fixes: QTBUG-100361
Change-Id: I1c54dbc457dbb235548b9d70324d607a0ee6d501
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 81fdfcfc4aec643d987a506c56eca440545f2fbf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-14 12:58:18 +00:00
Kai Köhne
da9069e2ea Doc: Remove \target Transformations
The section is already called Transformations. Making
it a target just causes issues in other contexts.

Change-Id: I8dc65bd3254238e51a649f926cd066dfcbe9500d
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit 3a5334e5be2f078dcf2850f51cdb0de79808023d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-14 09:32:29 +00:00
Marc Mutz
85f56b33d4 Revert "qxp::function_ref: drop use of q23::invoke_r"
This reverts commit b9cce12e76796962e5e5ad0d5408370af56af459, which
broke

    function_ref<void(int)> f = [](int i) { return i; };

ie. swallowing of return types.

We could maybe implement the same without invoke_r, with the same
manual if-constexpr that invoke_r has, but it would be a pointless
duplication across the two thunks we have, so just use invoke_r.

Add tests.

Task-number: QTBUG-103739
Change-Id: I6034f05d813c06a25e8058ded5b6b62f3ca858b4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit fa4d18b86c0cb0de495ce988fd9d3714e09b05dd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-14 01:31:08 +00:00
Marc Mutz
7c135a4e0c modulecppexports.h.in: re-indent nested preprocessor directives
Amends 0d9f4e7526fbf1e072aa3518e4e5313332ee4f18.

Task-number: QTBUG-100452
Change-Id: Iaa6626853a4241f750a6929fc9f604a149c874eb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ecbe56825acd51a049fab0026ce6f5c06ce09d4f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-14 01:31:07 +00:00
Marc Mutz
e2500fd5d6 QByteArray: more GCC 12 -Werror=array-bound whack-a-mole
This one came up on a tsan build, but not on an asan/ubsan one!?!:

    qbytearray.cpp: In member function ‘QByteArray QByteArray::toBase64(Base64Options) const’:
    qbytearray.cpp:3884:42: error: array subscript 1 is outside array bounds of ‘const char [1]’ [-Werror=array-bounds]
     3884 |             chunk |= int(uchar(data()[i++])) << 8;
          |                                ~~~~~~~~~~^
    qbytearray.cpp:37:24: note: at offset 1 into object ‘QByteArray::_empty’ of size 1
       37 | Q_CONSTINIT const char QByteArray::_empty = '\0';
          |                        ^~~~~~~~~~
    cc1plus: all warnings being treated as errors

Fix, as so often, by caching the size().

The code in 5.15 is different, but similar, so picking all the way.

Task-number: QTBUG-103923
Change-Id: Iac30e964c8d7d367620d16db65ceeaade33ee6b4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit de005e7976e4b110d6b5f32a8bab5141713acb7b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-14 01:31:05 +00:00
Marc Mutz
ff54eed292 QLibrary: fix use of deprecated QByteArrayMatcher::indexIn(p, n)
Use the QByteArrayView overload instead.

Deprecated since 6.3, so backporting:

Change-Id: I529104cad59260eed371cedb1ae84a7e9086bbf6
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
(cherry picked from commit 4e66c69bad1235d08d82de75d50617ad7d15a3ea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-14 01:31:04 +00:00
Marc Mutz
eb545512b2 tst_QAnyStringView: explicitly check the spaceship operator
We implicitly checked it, because, in C++20 builds, the non-equality
relational operators are synthesized from it by the compiler, and we
test those, but we didn't check that <=> returns strong_ordering.

We now do.

Task-number: QTBUG-104108
Change-Id: Ieb19a2d4cb2d600d884f4e2e89e98c6187e23872
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 1b8b8024554f9f36bc6642c2dfe830765e932df5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-14 01:31:01 +00:00
Thiago Macieira
478d48eb6d Q*ApplicationPrivate: remove unused "flags" arguments
They weren't flags. They were the version of Qt that was used in
compiling the application itself. The protection against rollback isn't
necessary any more, since qversiontagging.h, which applies to everything
and not just the main application binary. And using them to make
decisions on functionality or behavior is misguided (see previous
commit).

This commit does not deprecate the front-end classes' argument. In the
future, we may find some need for them.

Change-Id: Ia4a094014ddb48cc9f6dfffd16f83a7b58ff95d3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit fb1e0eee078f3f797a72b38e6981348b5ae5810c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-14 00:58:39 +00:00
Thiago Macieira
c6f9ab3c07 QCoreApplication: Remove app_compile_version
It's not used for anything, so remove the temptation of trying to use it
to make decisions at runtime about a behavior. It's the wrong tool for
the job: it might tell you the version of Qt the *application* was
compiled against, but not the version any of the Qt-using libraries
were.

Change-Id: I175efddd75f24ae59057fffd16f70b77dd87faf4
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit c4af4dcb5d41fa5d82f9e7986006202671f1681f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-14 00:58:31 +00:00
Edward Welbourne
28390ce4aa Fix doc and example of QLoggingCategory::installCategory()
Snippet [22] was unused and the example using snippet [21] neglected
to show how its oldCategoryFilter got initialized, which is what [22]
does. But it turns out the example code was crashy in any case, as it
left the oldCategoryFilter uninitialized (albeit probably null) until
the call to installFilter() had returned, and installFilter() calls
the new filter, so the new filter needs to check oldCategoryFilter
before calling it. The doc also failed to explain why it's OK to not
defer to the prior filter in these calls during installFilter(), so
revise the doc and example so that the latter behaves sensibly and
readers of the former are likely to use the function safely.

This amends commit 8f0654ceb878b6c8a08c7f5b790027c26e007c13 which
added the snippets and the use of one of them, but not the other.

Fixes: QTBUG-49704
Change-Id: Iddb8d97b0bef417d8f16e7910730cfa59ea3e715
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit 6ae2bfad411faf896fdca83a55db1e24a0b70e73)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-13 23:23:04 +00:00
Tor Arne Vestbø
2933c7effc macOS: Ignore update requests for offline displays
Accessing a display that's offline may cause crashes,
so to be on the safe side we skip update requests in
this situation.

Task-number: QTBUG-102021
Change-Id: I6b48b6722bccde628e510c538943d14f2b0271e5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 5909e33d1dea34daef271598eb1c9dd06a238801)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-13 19:18:04 +00:00
Tor Arne Vestbø
68f1d34a77 macOS: Resolve screen name via NSScreen on macOS 10.15+
Apple Silicon Macs no longer expose display information through IOKit.
Luckily we can use the 10.15 localizedName property on NSString to
resolve the name.

Change-Id: Ie75430df1a80808cb7b23d97d1e440d1f3bf75d6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit f7a56b32cc127e340e81e3e1cdb3f24f912863af)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-13 19:18:03 +00:00
Friedemann Kleint
72adcf591e Fusion style: Fix menu item text being elided when mnemonic and && appear in the text
Pass the text flags to fontMetrics.elidedText().
Amends 0c0892a3e20aa1fa79e3561de9b8e1fa8820f062.

Task-number: QTBUG-94481
Fixes: QTBUG-103836
Change-Id: I21a9b96ef69e5a5e612a0bdbdf44e5a20931eb59
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 539815569f277384e8fb8f5dd8645bc34ded1c55)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-13 16:34:38 +00:00
Kai Köhne
43691ca752 CMake: Fix typos
Found by codespell

Change-Id: I4907e423b6b345acf82f2d7e0ed62479719d694e
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 04cc705947a4f8e96f98f228a505774293c97840)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-13 16:00:21 +00:00
Topi Reinio
bdfb65dc33 Doc: Document the CorePrivate module
Classes to aid Android development are currently available in the
CorePrivate module. In order to have correct information for
the requisites table (for CMake and qmake inclusion), document
the private module, mark it \preliminary, and link the classes
to it using the \inmodule command.

Fixes: QTBUG-103865
Change-Id: Id913148751ab925eb4e8488aa28a54b0e0c2d78d
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
(cherry picked from commit e4f9a78c18039a013326307f4884eeb7e83bd976)
2022-06-13 13:04:01 +00:00
Alexandru Croitor
2d4dbcf01b androiddeployqt: use QFile::exists instead of QDir().exists
Internally QDir().exists calls QFile::exists(filePath(name))

Change-Id: I2993d924268b10135bd9df4e9f8165b869946efc
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit e2f14e5be702f89e3d54153fd7511c02729e014e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-13 13:04:01 +00:00
Alexandru Croitor
d3bbbf345a androiddeployqt: Only pass qt_install_dir/qml directory if it exists
In Conan's case, the qtbase installed package directory lacks a qml
directory. We pass that as a valid qml import path via CMake ->
deployment json file -> androiddeployqt -> qmlimportscanner
which causes the qmlimportscanner to fail with

 qmlimportscanner: No such file or directory:
 "~/package/some_sha_1/qml"
 Invalid json output from qmlimportscanner.

which in turn fails the androiddeploqt build step.

Make sure to only pass qtbase_install_dir/qml if it actually exists.

Amends 4ef3da04c3390f02bcb0507128372e6a299dc8fd
Amends c08b9a49ba70b1cbb0704668dd3f2c487d7f585e

Fixes: QTBUG-104056
Task-number: QTBUG-88519
Task-number: QTBUG-89588
Change-Id: I4310eb4e265ae8d3e3f09e1e1dbed79210e23de6
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 0c82f98ec5c0135f3789f0f9c5e30978698ddff9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-13 13:04:01 +00:00
Alexandru Croitor
77810099ce CMake: Ensure top-level builds are affected by our chosen log level
This will hide the configuration summary and cmake feature summary and
found packages output upon reconfiguration.

Task-number: QTBUG-104128
Change-Id: I42270b99e45076052ec176df4652661cae10ac0c
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit b3d0325a8dca56d3163451a417edfe6015a4ffe0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-13 13:04:01 +00:00
Alexandru Croitor
6d6989dbeb CMake: Show configuration summary on first configuration
or when feature changes are detected, even when the log-level is set
to NOTICE (which is the default for non-developer-builds).

We want to show the summary during the first configuration so we don't
force users to look into the config.summary file.

We want not to show the summary upon reconfigurations, to keep regular
reconfigurations as quiet as possibe, so it's easy to notice any new
warnings.

Amends e2a0ddbb69640c94b4ee107260a088d5c1c7e273
Amends 384dfceb532cada5f4be96430c8c7c866f40c933

Fixes: QTBUG-104127
Change-Id: I506f33b4bae9da8957e04bb69c206bf00e3f7b0e
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit dd5c860a7b5f5bf347b698b9145c45d369325e42)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-13 13:04:01 +00:00
Joerg Bornemann
9672067374 Make configure -no-pkg-config actually work
Turning off pkg-config with the configure flag -no-pkg-config did not
work.  There are different defaults for FEATURE_pkg_config on different
platforms (e.g. Linux: ON, Windows: OFF).  The existing code that
calculated the initial FEATURE_pkg_config value assumed that the default
is OFF and never turned the feature off.

Fixes: QTBUG-104123
Change-Id: I33b9687c55c60d4ec9224324951a8838741ee976
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 4cef4f1c1be713e932052968ac853ec37750ae61)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-13 09:54:52 +00:00
Joerg Bornemann
6409f2f41d CMake: Fix check for system harfbuzz if pkg-config is unavailable
We need to check whether pkg_check_modules returns success before
setting up target name etc.

Fixes: QTBUG-103894
Change-Id: I12702639683723d976e93be95443099b88885869
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 71a0b893fb4beb15df4a6bfe540518e5267fdb40)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-13 09:54:52 +00:00
Vladimir Belyavsky
2be951ab8c Windows: fix DeferredDelete events processing on QThread::terminate()
On finishing/terminating a thread, when processing posted events,
we need to consider QThread's own data instead of caller thread's data.
Otherwise we can get into unexpected situations such as double
destruction of an object, premature destruction, etc.

Fixes: QTBUG-103922
Change-Id: Idf77221ebbaa0b150ee2d0c296b51829ae8dc30e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 865212057b9f4e2809ebe42ec25c2d94d818cde7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-13 09:54:52 +00:00
Marc Mutz
b19dc4a527 QByteArray: de-inline to/fromStdString()
Removes another owning container manipulation that made the top entry
in Clang -ftime-trace's most-expensive template instantiations in a
QtWidgets build.

Task-number: QTBUG-97601
Change-Id: I8c765ea2e6c46da5188b70c9503dd87e63f6b328
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit d6575f37179aef80490f4ec03a61ab6f5033bd3d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-13 05:51:31 +00:00
Thiago Macieira
dd78bdb992 CMake: up the minimum C version to C11
We're in 2022. A 11-year-old C standard probably suffices, especially
since we require C++17 anyway.

Change-Id: Ibcde9b9795ad42ac9978fffd16f3555327097ded
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 88f5955cb750f2fe3468fe13fef4a11b887315c1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-12 20:13:57 +00:00
Thiago Macieira
8e0befe7a6 Cocoa: fix build: add missing include
qcocoansmenu.mm:21:38: error: implicit instantiation of undefined template 'QVarLengthArray<unsigned short, 10>'

Change-Id: Iba16e8ea451b444ab213fffd16f4da39dfcc343d
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit bd40c1838931fd58c4f6d2622028162c28a6f046)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-12 20:13:24 +00:00
Ilya Fedin
c5883aeb88 Fallback to another file dialog implementation when XDP is inaccessible
Fixes: QTBUG-98988
Change-Id: Idca1ab4cae0e9eabebc599f3c8efa136a7973918
Reviewed-by: Jan Grulich <jgrulich@redhat.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit fb981a0954119ed0dfa4a402fdef78e7257ffc96)
2022-06-13 00:13:15 +04:00
Thiago Macieira
96bf7b01f6 FatalSignalHandler: print the signal name on crash
It's easier to remember what "SIGSEGV" means instead of "11".

GNU libc has offered sigabbrev_np() (non-portable) since 2.32; for older
libcs, we'll be happy with a hardcoded list.

Selftest updated to match... though it didn't seem to be necessary.

Change-Id: I5ff8e16fcdcb4ffd9ab6fffd16ebc66ecf6e9465
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 17454bf9c60d9a7f836461234f48e1bb9d7d5bf9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-12 20:12:45 +00:00
Marc Mutz
c3ad3ad419 Fix data race in QCoreApplicationPrivate::sendThroughApplicationEventFilters()
The assertion has the acquire fence at the wrong place:

- QThreadData::thread isn't dereferenced, so the acquire fence on its
  load() isn't needed.

- QObjectPrivate::threadData, however, _is_ dereferenced, so an
  acquire fence is needed; the relaxed load() is insufficient.

Swapping the loadAcquire() and the loadRelaxed() fixes both issues.

Change-Id: Iee964490e93ebc323c188e616bf0d448f91fb2b5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 0da17e83ec507229e3516bbdc5986ab775dc843e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-09 15:15:20 +00:00
Marc Mutz
1f3529d8e8 QLocale: use qsnprintf instead of deprecated sprintf
Fixes warnings such as

 qtbase/src/corelib/text/qlocale_tools.cpp:321:5: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]

from AppleClang.

Change-Id: Ief10e99abfa0a56c24622ac79db719dde58a4210
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 2e9bc3494f62761660e6ae9b5cc6caa0e170ca9a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-08 18:35:48 +00:00
Ilya Fedin
e737c163b0 Add QXdgDesktopPortalFileDialog::useNativeFileDialog()
Task-number: QTBUG-98988
Change-Id: I39417f089d839a9af009791088bd20058532bd7a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6f9f6849c53e057e8b4186db64a1a6b5e1f31eca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-08 17:43:48 +00:00
Marc Mutz
ec2ce79b77 Update Catch2 to v2.13.9
Two patches applied to upstream release.

Fixes: QTBUG-103732
Change-Id: Id64b65c4567433806047a2a34fa85ab5f260e6cc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit a7dcdf063d55bfb332ca47c7330a9a2e0ad83460)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-08 17:43:43 +00:00
Vladimir Belyavsky
9e6f83307d Fallback to PerMonitorDpiAware if V2DpiAware is not supported by system
DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 might not be supported
on some legacy Windows 10 editions (prior Creator Update). In this
case SetProcessDpiAwarenessContext returns ERROR_INVALID_PARAMETER.

Fallback to DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE using old API
SetProcessDpiAwareness in such cases as the most suitable.

Fixes: QTBUG-103733
Change-Id: I39216e63ecfcae96aaa159237a52b0a76bc5d956
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 4a2c31103c7c993c87f88087811e02804adfabf3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-08 17:09:01 +00:00
Mårten Nordheim
86e8860ea0 QTest: Remove pre-Qt6 code
It's disabled now, so can be deleted

Change-Id: I0d548327e7ef42bbca9ed88556bf9f8456038cc7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 4d2ef8208955846b6fca178648840b93e8fe09e1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-08 17:08:58 +00:00
Mikolaj Boc
2531c9b4f3 Define out unused functions on WASM build
The struct iovec conversion functions that are needed on Unix are
unused on WASM build. This makes the build fail with -Werror on Mac
since the WASM build is treated as a variant of Unix. Cross-compilation
with clang:
Apple clang version 13.0.0 (clang-1300.0.27.3)
Target: arm64-apple-darwin21.3.0

Fixes: QTBUG-103974
Change-Id: I34c65a18832ceedb9064a98f5729e45667749461
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 3df23b1fe446fbbbc915b7eb5f90e851564bc419)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-08 15:35:43 +00:00
Ivan Solovev
d670c7be21 QTestLib: improve documentation
Add missing '\since' version numbers.

This commit amends cc6d984390dc937b9d8440b6ba7d4f578e22ac0d
and 0681a2dd5a8095baddb5905fb21a58ce19b958c5

Change-Id: Ia10b991c996fb58f08a17e485c4dfcbfbe8eba0a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 78c677376a59b5ac59a7dcad18bbe0542ff66db9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-08 15:35:43 +00:00
Janne Juntunen
24139989a5 tst_qfile: skip trash bin test on webOS
Skipping moveToTrash() test is needed because WebOS
does not implement a trash bin directory.

Fixes: QTBUG-104053
Change-Id: Id1d1595eb401d8ef3a403c915d95be1cd75368d2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit c58e97245df207034ab6a4b066813d02ee74234f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-08 11:30:31 +00:00
Alexandru Croitor
415e37c84a CMake: Fix Android multi-abi builds in Qt Creator
Qt Creator passes -DANDROID_NDK to the main project configuration
whereas the Qt toolchain file expects -DANDROID_NDK_ROOT.

This causes the configuration of the sub-builds to fail not finding
the android toolchain, and trying to use the CI ndk toolchain path.

Make sure to consider both variables.

Also change the conditions to evaluate the variable as a variable
explicitly, to avoid passing an empty option if the variable is
unset. If the variable is unset, CMake would treat the variable as
an actual string which would always not equal the empty string.

Amends d6919b073aaae617f1ff37d18da14e315f202005

Task-number: QTBUG-104013
Task-number: QTBUG-102041
Change-Id: Ifee48953ce50bc616c49c59d72e845c6d9418187
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 5ddb13d0d4fc6d4f45dc1f0fb49ed65a299d88dd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-07 16:49:06 +00:00
Ilya Fedin
d8f106eab2 Fix a leak of fallback dialog helper in xdgdesktopportal
Task-number: QTBUG-98988
Change-Id: Id066f0dd2cacbc273deacd4f7df66c3787ad4017
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 36c1a7ba23eab079683a344dc34094c28a9f56e2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-06-06 20:32:16 +00:00
2986 changed files with 151745 additions and 75715 deletions

View File

@ -7,7 +7,7 @@ if (NOT DEFINED QT_SUPERBUILD OR DEFINED QT_REPO_MODULE_VERSION)
set(QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_LEAN_HEADERS=1")
endif()
set(QT_REPO_MODULE_VERSION "6.4.0")
set(QT_REPO_MODULE_VERSION "6.4.3")
set(QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT "alpha1")
# Minimum requirement for building Qt

45
LICENSES/AFL-2.1.txt Normal file
View File

@ -0,0 +1,45 @@
The Academic Free License
v.2.1
This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following notice immediately following the copyright notice for the Original Work:
Licensed under the Academic Free License version 2.1
1) Grant of Copyright License. Licensor hereby grants You a world-wide, royalty-free, non-exclusive, perpetual, sublicenseable license to do the following:
a) to reproduce the Original Work in copies;
b) to prepare derivative works ("Derivative Works") based upon the Original Work;
c) to distribute copies of the Original Work and Derivative Works to the public;
d) to perform the Original Work publicly; and
e) to display the Original Work publicly.
2) Grant of Patent License. Licensor hereby grants You a world-wide, royalty-free, non-exclusive, perpetual, sublicenseable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, to make, use, sell and offer for sale the Original Work and Derivative Works.
3) Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor hereby agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work, and by publishing the address of that information repository in a notice immediately following the copyright notice that applies to the Original Work.
4) Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior written permission of the Licensor. Nothing in this License shall be deemed to grant any rights to trademarks, copyrights, patents, trade secrets or any other intellectual property of Licensor except as expressly stated herein. No patent license is granted to make, use, sell or offer to sell embodiments of any patent claims other than the licensed claims defined in Section 2. No right is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under different terms from this License any Original Work that Licensor otherwise would have a right to license.
5) This section intentionally omitted.
6) Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately proceeding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to Original Work is granted hereunder except under this disclaimer.
8) Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to any person for any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to liability for death or personal injury resulting from Licensor's negligence to the extent applicable law prohibits such limitation. Some jurisdictions do not allow the exclusion or limitation of incidental or consequential damages, so this exclusion and limitation may not apply to You.
9) Acceptance and Termination. If You distribute copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. Nothing else but this License (or another written agreement between Licensor and You) grants You permission to create Derivative Works based upon the Original Work or to exercise any of the rights granted in Section 1 herein, and any attempt to do so except under the terms of this License (or another written agreement between Licensor and You) is expressly prohibited by U.S. copyright law, the equivalent laws of other countries, and by international treaty. Therefore, by exercising any of the rights granted to You in Section 1 herein, You indicate Your acceptance of this License and all of its terms and conditions.
10) Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of the U.S. Copyright Act, 17 U.S.C. § 101 et seq., the equivalent laws of other countries, and international treaty. This section shall survive the termination of this License.
12) Attorneys Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
13) Miscellaneous. This License represents the complete agreement concerning the subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
14) Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
15) Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
This license is Copyright (C) 2003-2004 Lawrence E. Rosen. All rights reserved.
Permission is hereby granted to copy and distribute this license without modification. This license may not be modified without the express written permission of its copyright owner.

121
LICENSES/CC0-1.0.txt Normal file
View File

@ -0,0 +1,121 @@
Creative Commons Legal Code
CC0 1.0 Universal
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
HEREUNDER.
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator
and subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for
the purpose of contributing to a commons of creative, cultural and
scientific works ("Commons") that the public can reliably and without fear
of later claims of infringement build upon, modify, incorporate in other
works, reuse and redistribute as freely as possible in any form whatsoever
and for any purposes, including without limitation commercial purposes.
These owners may contribute to the Commons to promote the ideal of a free
culture and the further production of creative, cultural and scientific
works, or to gain reputation or greater distribution for their Work in
part through the use and efforts of others.
For these and/or other purposes and motivations, and without any
expectation of additional consideration or compensation, the person
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
is an owner of Copyright and Related Rights in the Work, voluntarily
elects to apply CC0 to the Work and publicly distribute the Work under its
terms, with knowledge of his or her Copyright and Related Rights in the
Work and the meaning and intended legal effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not
limited to, the following:
i. the right to reproduce, adapt, distribute, perform, display,
communicate, and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or
likeness depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data
in a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation
thereof, including any amended or successor version of such
directive); and
vii. other similar, equivalent or corresponding rights throughout the
world based on applicable law or treaty, and any national
implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention
of, applicable law, Affirmer hereby overtly, fully, permanently,
irrevocably and unconditionally waives, abandons, and surrenders all of
Affirmer's Copyright and Related Rights and associated claims and causes
of action, whether now known or unknown (including existing as well as
future claims and causes of action), in the Work (i) in all territories
worldwide, (ii) for the maximum duration provided by applicable law or
treaty (including future time extensions), (iii) in any current or future
medium and for any number of copies, and (iv) for any purpose whatsoever,
including without limitation commercial, advertising or promotional
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
member of the public at large and to the detriment of Affirmer's heirs and
successors, fully intending that such Waiver shall not be subject to
revocation, rescission, cancellation, termination, or any other legal or
equitable action to disrupt the quiet enjoyment of the Work by the public
as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason
be judged legally invalid or ineffective under applicable law, then the
Waiver shall be preserved to the maximum extent permitted taking into
account Affirmer's express Statement of Purpose. In addition, to the
extent the Waiver is so judged Affirmer hereby grants to each affected
person a royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmer's Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future
time extensions), (iii) in any current or future medium and for any number
of copies, and (iv) for any purpose whatsoever, including without
limitation commercial, advertising or promotional purposes (the
"License"). The License shall be deemed effective as of the date CC0 was
applied by Affirmer to the Work. Should any part of the License for any
reason be judged legally invalid or ineffective under applicable law, such
partial invalidity or ineffectiveness shall not invalidate the remainder
of the License, and in such case Affirmer hereby affirms that he or she
will not (i) exercise any of his or her remaining Copyright and Related
Rights in the Work or (ii) assert any associated claims and causes of
action with respect to the Work, in either case contrary to Affirmer's
express Statement of Purpose.
4. Limitations and Disclaimers.
a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or
warranties of any kind concerning the Work, express, implied,
statutory or otherwise, including without limitation warranties of
title, merchantability, fitness for a particular purpose, non
infringement, or the absence of latent or other defects, accuracy, or
the present or absence of errors, whether or not discoverable, all to
the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any person's Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the
Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to
this CC0 or use of the Work.

View File

@ -0,0 +1 @@
GPL-2.0-only.txt

View File

@ -6,5 +6,5 @@ set script_dir_path=%~dp0
set cmake_path=@CMAKE_COMMAND@
if not exist "%cmake_path%" set cmake_path=cmake
set toolchain_path=%script_dir_path%/@__GlobalConfig_relative_path_from_bin_dir_to_cmake_config_dir@/qt.toolchain.cmake
set toolchain_path=%script_dir_path%\@__GlobalConfig_relative_path_from_bin_dir_to_cmake_config_dir@\qt.toolchain.cmake
"%cmake_path%" -DCMAKE_TOOLCHAIN_FILE="%toolchain_path%" @__qt_cmake_extra@ %*

View File

@ -107,9 +107,6 @@ set_package_properties(WaylandScanner PROPERTIES
DESCRIPTION "Executable that converts XML protocol files to C code"
)
include(CMakeParseArguments)
function(ecm_add_wayland_client_protocol out_var)
# Parse arguments
set(oneValueArgs PROTOCOL BASENAME)

View File

@ -68,7 +68,7 @@
# If SKIP_DEPENDENCY_HANDLING is not set, the INTERFACE_LINK_LIBRARIES property
# of the imported target for <component> will be set to contain the imported
# targets for the components listed in <name>_<component>_component_deps.
# <component>_FOUND will also be set to false if any of the compoments in
# <component>_FOUND will also be set to false if any of the components in
# <name>_<component>_component_deps are not found. This requires the components
# in <name>_<component>_component_deps to be listed before <component> in the
# COMPONENTS argument.
@ -123,8 +123,6 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
include(CMakeParseArguments)
macro(ecm_find_package_version_check module_name)
if(CMAKE_VERSION VERSION_LESS 2.8.12)
message(FATAL_ERROR "CMake 2.8.12 is required by Find${module_name}.cmake")

View File

@ -1,98 +0,0 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindCups
--------
Find the CUPS printing system.
Set CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE to TRUE if you need a version which
features this function (i.e. at least 1.1.19)
Imported targets
^^^^^^^^^^^^^^^^
This module defines :prop_tgt:`IMPORTED` target ``Cups::Cups``, if Cups has
been found.
Result variables
^^^^^^^^^^^^^^^^
This module will set the following variables in your project:
``CUPS_FOUND``
true if CUPS headers and libraries were found
``CUPS_INCLUDE_DIRS``
the directory containing the Cups headers
``CUPS_LIBRARIES``
the libraries to link against to use CUPS.
``CUPS_VERSION_STRING``
the version of CUPS found (since CMake 2.8.8)
Cache variables
^^^^^^^^^^^^^^^
The following cache variables may also be set:
``CUPS_INCLUDE_DIR``
the directory containing the Cups headers
#]=======================================================================]
find_path(CUPS_INCLUDE_DIR cups/cups.h )
find_library(CUPS_LIBRARIES NAMES cups )
if (CUPS_INCLUDE_DIR AND CUPS_LIBRARIES AND CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE)
include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
cmake_push_check_state()
set(CMAKE_REQUIRED_QUIET ${Cups_FIND_QUIETLY})
# ippDeleteAttribute is new in cups-1.1.19 (and used by kdeprint)
CHECK_LIBRARY_EXISTS(cups ippDeleteAttribute "" CUPS_HAS_IPP_DELETE_ATTRIBUTE)
cmake_pop_check_state()
endif ()
if (CUPS_INCLUDE_DIR AND EXISTS "${CUPS_INCLUDE_DIR}/cups/cups.h")
file(STRINGS "${CUPS_INCLUDE_DIR}/cups/cups.h" cups_version_str
REGEX "^#[\t ]*define[\t ]+CUPS_VERSION_(MAJOR|MINOR|PATCH)[\t ]+[0-9]+$")
unset(CUPS_VERSION_STRING)
foreach(VPART MAJOR MINOR PATCH)
foreach(VLINE ${cups_version_str})
if(VLINE MATCHES "^#[\t ]*define[\t ]+CUPS_VERSION_${VPART}[\t ]+([0-9]+)$")
set(CUPS_VERSION_PART "${CMAKE_MATCH_1}")
if(CUPS_VERSION_STRING)
string(APPEND CUPS_VERSION_STRING ".${CUPS_VERSION_PART}")
else()
set(CUPS_VERSION_STRING "${CUPS_VERSION_PART}")
endif()
endif()
endforeach()
endforeach()
endif ()
include(FindPackageHandleStandardArgs)
if (CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Cups
REQUIRED_VARS CUPS_LIBRARIES CUPS_INCLUDE_DIR CUPS_HAS_IPP_DELETE_ATTRIBUTE
VERSION_VAR CUPS_VERSION_STRING)
else ()
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Cups
REQUIRED_VARS CUPS_LIBRARIES CUPS_INCLUDE_DIR
VERSION_VAR CUPS_VERSION_STRING)
endif ()
mark_as_advanced(CUPS_INCLUDE_DIR CUPS_LIBRARIES)
if (CUPS_FOUND)
set(CUPS_INCLUDE_DIRS "${CUPS_INCLUDE_DIR}")
if (NOT TARGET Cups::Cups)
add_library(Cups::Cups INTERFACE IMPORTED)
set_target_properties(Cups::Cups PROPERTIES
INTERFACE_LINK_LIBRARIES "${CUPS_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${CUPS_INCLUDE_DIR}")
endif ()
endif ()

View File

@ -13,6 +13,7 @@ find_library(GSSAPI_LIBRARIES
NAMES
GSS # framework
gss # solaris
gssapi # FreeBSD
gssapi_krb5
HINTS ${PC_GSSAPI_LIBDIR}
)

View File

@ -3,7 +3,25 @@
# ---------
#
# Try to locate the mysql client library.
# If found, this will define the following variables:
#
# By default, pkg-config is used, if available.
# If pkg-config is not available or if you want to disable it, set the ``MySQL_ROOT`` variable.
# The following variables can be set to control the behavior of this find module.
#
# ``MySQL_ROOT``
# The root directory of the mysql client library's installation.
# ``MySQL_INCLUDE_DIR``
# The directory containing the include files of the mysql client library.
# If not set, the directory is detected within ``MySQL_ROOT`` using find_path.
# ``MySQL_LIBRARY_DIR``
# The directory containing the binaries of the mysql client library.
# This is used to detect ``MySQL_LIBRARY`` and passed as HINT to find_library.
# ``MySQL_LIBRARY``
# The file path to the mysql client library.
# ``MySQL_LIBRARY_DEBUG``
# The file path to the mysql client library for the DEBUG configuration.
#
# If the mysql client library is found, this will define the following variables:
#
# ``MySQL_FOUND``
# True if the mysql library is available
@ -18,17 +36,39 @@
# ``MySQL::MySQL``
# The mysql client library
find_package(PkgConfig QUIET)
pkg_check_modules(PC_MySQL QUIET mysqlclient)
if(NOT DEFINED MySQL_ROOT)
find_package(PkgConfig QUIET)
endif()
if(PkgConfig_FOUND AND NOT DEFINED MySQL_ROOT)
pkg_check_modules(PC_MySQL QUIET mysqlclient)
set(MySQL_include_dir_hints ${PC_MySQL_INCLUDEDIR})
set(MySQL_library_hints ${PC_MySQL_LIBDIR})
set(MySQL_library_hints_debug "")
else()
set(MySQL_include_dir_hints "")
if(NOT DEFINED MySQL_LIBRARY_DIR)
set(MySQL_LIBRARY_DIR "${MySQL_ROOT}/lib")
endif()
set(MySQL_library_hints "${MySQL_LIBRARY_DIR}")
set(MySQL_library_hints_debug "${MySQL_LIBRARY_DIR}/debug")
endif()
find_path(MySQL_INCLUDE_DIR
NAMES mysql.h
HINTS ${PC_MySQL_INCLUDEDIR}
HINTS "${MySQL_include_dir_hints}"
PATH_SUFFIXES mysql mariadb)
find_library(MySQL_LIBRARY
NO_PACKAGE_ROOT_PATH
NAMES libmysql mysql mysqlclient libmariadb mariadb
HINTS ${PC_MySQL_LIBDIR})
HINTS ${MySQL_library_hints})
if(MySQL_library_hints_debug)
find_library(MySQL_LIBRARY_DEBUG
NO_PACKAGE_ROOT_PATH
NAMES libmysql mysql mysqlclient libmariadb mariadb
HINTS ${MySQL_library_hints_debug})
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MySQL DEFAULT_MSG MySQL_LIBRARY MySQL_INCLUDE_DIR)
@ -41,6 +81,10 @@ if(MySQL_FOUND)
set_target_properties(MySQL::MySQL PROPERTIES
IMPORTED_LOCATION "${MySQL_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${MySQL_INCLUDE_DIRS}")
if(MySQL_LIBRARY_DEBUG)
set_target_properties(MySQL::MySQL PROPERTIES
IMPORTED_LOCATION_DEBUG "${MySQL_LIBRARY_DEBUG}")
endif()
endif()
endif()

View File

@ -16,8 +16,8 @@ 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})
target_link_libraries(__PPS INTERFACE "${PPS_LIBRARY}")
target_include_directories(__PPS INTERFACE "${PPS_INCLUDE_DIR}")
add_library(PPS::PPS ALIAS __PPS)
endif()

View File

@ -1,22 +0,0 @@
# We can't create the same interface imported target multiple times, CMake will complain if we do
# that. This can happen if the find_package call is done in multiple different subdirectories.
if(TARGET WrapDoubleConversion::WrapDoubleConversion)
set(WrapDoubleConversion_FOUND ON)
return()
endif()
set(WrapDoubleConversion_FOUND OFF)
find_package(double-conversion QUIET)
if (double-conversion_FOUND)
include(FeatureSummary)
set_package_properties(double-conversion PROPERTIES TYPE REQUIRED)
add_library(WrapDoubleConversion::WrapDoubleConversion INTERFACE IMPORTED)
target_link_libraries(WrapDoubleConversion::WrapDoubleConversion
INTERFACE double-conversion::double-conversion)
set(WrapDoubleConversion_FOUND ON)
return()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(WrapDoubleConversion DEFAULT_MSG WrapDoubleConversion_FOUND)

View File

@ -0,0 +1,82 @@
# We can't create the same interface imported target multiple times, CMake will complain if we do
# that. This can happen if the find_package call is done in multiple different subdirectories.
if(TARGET WrapSystemDoubleConversion::WrapSystemDoubleConversion)
set(WrapSystemDoubleConversion_FOUND ON)
return()
endif()
set(WrapSystemDoubleConversion_REQUIRED_VARS "__double_conversion_found")
# Find either Config package or Find module.
# Upstream can be built either with CMake and then provides a Config file, or with Scons in which
# case there's no Config file.
# A Find module might be provided by a 3rd party, for example Conan might generate a Find module.
find_package(double-conversion ${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION} QUIET)
set(__double_conversion_target_name "double-conversion::double-conversion")
if(double-conversion_FOUND AND TARGET "${__double_conversion_target_name}")
set(__double_conversion_found TRUE)
# This ensures the Config file is shown in the fphsa message.
if(double-conversion_CONFIG)
list(PREPEND WrapSystemDoubleConversion_REQUIRED_VARS
double-conversion_CONFIG)
endif()
endif()
if(NOT __double_conversion_found)
list(PREPEND WrapSystemDoubleConversion_REQUIRED_VARS
DOUBLE_CONVERSION_LIBRARY DOUBLE_CONVERSION_INCLUDE_DIR)
find_path(DOUBLE_CONVERSION_INCLUDE_DIR
NAMES
double-conversion/double-conversion.h
)
find_library(DOUBLE_CONVERSION_LIBRARY_RELEASE NAMES double-conversion)
# We assume a possible debug build of this library to be named with a d suffix.
# Adjust accordingly if a different naming scheme is established.
find_library(DOUBLE_CONVERSION_LIBRARY_DEBUG NAMES double-conversiond)
include(SelectLibraryConfigurations)
select_library_configurations(DOUBLE_CONVERSION)
mark_as_advanced(DOUBLE_CONVERSION_INCLUDE_DIR DOUBLE_CONVERSION_LIBRARY)
set(DOUBLE_CONVERSION_INCLUDE_DIRS "${DOUBLE_CONVERSION_INCLUDE_DIR}")
if(DOUBLE_CONVERSION_LIBRARIES AND DOUBLE_CONVERSION_INCLUDE_DIRS)
set(__double_conversion_found TRUE)
endif()
endif()
include(FindPackageHandleStandardArgs)
set(__double_conversion_fphsa_args "")
if(double-conversion_VERSION)
set(WrapSystemDoubleConversion_VERSION "${double-conversion_VERSION}")
list(APPEND __double_conversion_fphsa_args VERSION_VAR WrapSystemDoubleConversion_VERSION)
endif()
find_package_handle_standard_args(WrapSystemDoubleConversion
REQUIRED_VARS ${WrapSystemDoubleConversion_REQUIRED_VARS}
${__double_conversion_fphsa_args})
if(WrapSystemDoubleConversion_FOUND)
add_library(WrapSystemDoubleConversion::WrapSystemDoubleConversion INTERFACE IMPORTED)
if(TARGET "${__double_conversion_target_name}")
target_link_libraries(WrapSystemDoubleConversion::WrapSystemDoubleConversion
INTERFACE "${__double_conversion_target_name}")
else()
target_link_libraries(WrapSystemDoubleConversion::WrapSystemDoubleConversion
INTERFACE ${DOUBLE_CONVERSION_LIBRARIES})
target_include_directories(WrapSystemDoubleConversion::WrapSystemDoubleConversion
INTERFACE ${DOUBLE_CONVERSION_INCLUDE_DIRS})
endif()
endif()
unset(__double_conversion_target_name)
unset(__double_conversion_found)
unset(__double_conversion_fphsa_args)
include(FeatureSummary)
set_package_properties(WrapSystemDoubleConversion PROPERTIES
URL "https://github.com/google/double-conversion"
DESCRIPTION "double-conversion library")

View File

@ -28,22 +28,38 @@ if(harfbuzz_FOUND AND TARGET "${__harfbuzz_target_name}")
endif()
if(__harfbuzz_broken_config_file OR NOT __harfbuzz_found)
list(PREPEND WrapSystemHarfbuzz_REQUIRED_VARS HARFBUZZ_LIBRARIES HARFBUZZ_INCLUDE_DIRS)
find_package(PkgConfig QUIET)
pkg_check_modules(PC_HARFBUZZ harfbuzz IMPORTED_TARGET)
if(PC_HARFBUZZ_FOUND)
set(__harfbuzz_target_name "PkgConfig::PC_HARFBUZZ")
set(__harfbuzz_find_include_dirs_hints
HINTS ${PC_HARFBUZZ_INCLUDEDIR})
set(__harfbuzz_find_library_hints
HINTS ${PC_HARFBUZZ_LIBDIR})
if(PC_HARFBUZZ_VERSION)
set(WrapSystemHarfbuzz_VERSION "${PC_HARFBUZZ_VERSION}")
endif()
else()
set(__harfbuzz_target_name "Harfbuzz::Harfbuzz")
endif()
find_path(HARFBUZZ_INCLUDE_DIRS
NAMES harfbuzz/hb.h
HINTS ${PC_HARFBUZZ_INCLUDEDIR})
NAMES harfbuzz/hb.h
${__harfbuzz_find_include_dirs_hints})
find_library(HARFBUZZ_LIBRARIES
NAMES harfbuzz
HINTS ${PC_HARFBUZZ_LIBDIR})
NAMES harfbuzz
${__harfbuzz_find_library_hints})
set(__harfbuzz_target_name "PkgConfig::PC_HARFBUZZ")
set(__harfbuzz_found TRUE)
if(PC_HARFBUZZ_VERSION)
set(WrapSystemHarfbuzz_VERSION "${PC_HARFBUZZ_VERSION}")
if(HARFBUZZ_INCLUDE_DIRS AND HARFBUZZ_LIBRARIES)
set(__harfbuzz_found TRUE)
if(NOT PC_HARFBUZZ_FOUND)
add_library(${__harfbuzz_target_name} UNKNOWN IMPORTED)
list(TRANSFORM HARFBUZZ_INCLUDE_DIRS APPEND "/harfbuzz")
set_target_properties(${__harfbuzz_target_name} PROPERTIES
IMPORTED_LOCATION "${HARFBUZZ_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${HARFBUZZ_INCLUDE_DIRS}"
)
endif()
endif()
endif()
@ -57,6 +73,8 @@ if(WrapSystemHarfbuzz_FOUND)
INTERFACE "${__harfbuzz_target_name}")
endif()
unset(__harfbuzz_target_name)
unset(__harfbuzz_find_include_dirs_hints)
unset(__harfbuzz_find_library_hints)
unset(__harfbuzz_found)
unset(__harfbuzz_include_dir)
unset(__harfbuzz_broken_config_file)

View File

@ -4,8 +4,12 @@ if(TARGET WrapSystemPCRE2::WrapSystemPCRE2)
endif()
set(WrapSystemPCRE2_REQUIRED_VARS __pcre2_found)
find_package(PCRE2 COMPONENTS 16BIT ${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION} CONFIG QUIET)
find_package(PCRE2 ${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION} COMPONENTS 16BIT QUIET)
# TODO: pcre2-16 is not the target name provided by the upstream Config file. It is PCRE2::16BIT.
# https://github.com/PCRE2Project/pcre2/blob/2410fbe3869cab403f02b94caa9ab37ee9f5854b/cmake/pcre2-config.cmake.in#L122
# We don't strictly need to handle that though, because the pkg-config code path below still
# finds the correct libraries.
set(__pcre2_target_name "PCRE2::pcre2-16")
if(PCRE2_FOUND AND TARGET "${__pcre2_target_name}")
# Hunter case.

View File

@ -56,9 +56,12 @@ else()
include(SelectLibraryConfigurations)
select_library_configurations(ZSTD)
if(PC_ZSTD_VERSION)
set(WrapZSTD_VERSION "${PC_ZSTD_VERSION}")
endif()
find_package_handle_standard_args(WrapZSTD
REQUIRED_VARS ZSTD_LIBRARIES ZSTD_INCLUDE_DIRS
VERSION_VAR PC_ZSTD_VERSION)
VERSION_VAR WrapZSTD_VERSION)
if(WrapZSTD_FOUND AND NOT TARGET WrapZSTD::WrapZSTD)
add_library(WrapZSTD::WrapZSTD UNKNOWN IMPORTED)

View File

@ -1,32 +0,0 @@
# Fallback find module for double-conversion
# if double-conversion is built with CMake it'll install a config module, which we prefer
# if it's built with Scons (their default), we search ourselves
find_package(double-conversion CONFIG)
if (double-conversion_FOUND)
if(TARGET double-conversion::double-conversion)
return()
endif()
endif()
find_path(DOUBLE_CONVERSION_INCLUDE_DIR
NAMES
double-conversion.h
PATH_SUFFIXES
double-conversion
)
find_library(DOUBLE_CONVERSION_LIBRARY NAMES double-conversion)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
double-conversion DEFAULT_MSG
DOUBLE_CONVERSION_LIBRARY DOUBLE_CONVERSION_INCLUDE_DIR)
if(double-conversion_FOUND AND NOT TARGET double-conversion::double-conversion)
add_library(double-conversion::double-conversion UNKNOWN IMPORTED)
set_target_properties(double-conversion::double-conversion PROPERTIES
IMPORTED_LOCATION "${DOUBLE_CONVERSION_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${DOUBLE_CONVERSION_INCLUDE_DIR}")
endif()
mark_as_advanced(DOUBLE_CONVERSION_INCLUDE_DIR DOUBLE_CONVERSION_LIBRARY)

View File

@ -1,6 +1,7 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
bindir=${prefix}/@INSTALL_BINDIR@
libexecdir=${prefix}/@INSTALL_LIBEXECDIR@
libdir=${prefix}/@INSTALL_LIBDIR@
includedir=${prefix}/@INSTALL_INCLUDEDIR@
$<$<BOOL:@contains_mkspecs@>:mkspecsdir=${prefix}/@INSTALL_MKSPECSDIR@>

View File

@ -164,7 +164,22 @@ function(qt_internal_add_3rdparty_library target)
set_target_properties(${target} PROPERTIES
_qt_module_interface_name "${target}"
_qt_package_version "${PROJECT_VERSION}"
_qt_package_name "${INSTALL_CMAKE_NAMESPACE}${target}"
_qt_module_is_3rdparty_library TRUE
)
set(export_properties
"_qt_module_interface_name"
"_qt_package_version"
"_qt_package_name"
"_qt_module_is_3rdparty_library"
)
set_property(TARGET ${target}
APPEND PROPERTY
EXPORT_PROPERTIES "${export_properties}")
qt_internal_add_qt_repo_known_module(${target})
qt_internal_add_target_aliases(${target})
_qt_internal_apply_strict_cpp(${target})
@ -177,7 +192,6 @@ function(qt_internal_add_3rdparty_library target)
ARCHIVE_OUTPUT_DIRECTORY "${QT_BUILD_DIR}/${INSTALL_LIBDIR}"
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
_qt_module_is_3rdparty_library TRUE
_qt_module_skip_depends_include TRUE
)
set_property(TARGET "${target}"

View File

@ -127,8 +127,9 @@ function(qt_internal_android_dependencies_content target file_content_out)
if (init_class)
set(init_class "initClass=\"${init_class}\"")
endif()
file(TO_NATIVE_PATH ${jar_file} jar_file_native)
string(APPEND file_contents "<jar file=\"${jar_file_native}\" ${init_class} />\n")
# Use unix path to allow using files on any host platform.
file(TO_CMAKE_PATH ${jar_file} jar_file_unix_path)
string(APPEND file_contents "<jar file=\"${jar_file_unix_path}\" ${init_class} />\n")
endforeach()
endif()
@ -139,8 +140,10 @@ function(qt_internal_android_dependencies_content target file_content_out)
if (init_class)
set(init_class "initClass=\"${init_class}\"")
endif()
file(TO_NATIVE_PATH ${bundle_file} jar_bundle_native)
string(APPEND file_contents "<jar bundling=\"1\" file=\"${jar_bundle_native}\" ${init_class} />\n")
# Use unix path to allow using files on any host platform.
file(TO_CMAKE_PATH ${bundle_file} jar_bundle_unix_path)
string(APPEND file_contents
"<jar bundling=\"1\" file=\"${jar_bundle_unix_path}\" ${init_class} />\n")
endforeach()
endif()
@ -152,8 +155,9 @@ function(qt_internal_android_dependencies_content target file_content_out)
if (lib_extends)
set(lib_extends "extends=\"${lib_extends}\"")
endif()
file(TO_NATIVE_PATH ${lib_file} lib_file_native)
string(APPEND file_contents "<lib file=\"${lib_file_native}\" ${lib_extends} />\n")
# Use unix path to allow using files on any host platform.
file(TO_CMAKE_PATH ${lib_file} lib_file_unix_path)
string(APPEND file_contents "<lib file=\"${lib_file_unix_path}\" ${lib_extends} />\n")
endforeach()
endif()
@ -163,19 +167,23 @@ function(qt_internal_android_dependencies_content target file_content_out)
string(REPLACE ".so" "_${CMAKE_ANDROID_ARCH_ABI}.so" lib ${lib})
section(${lib} ":" lib_file lib_replacement)
if (lib_replacement)
file(TO_NATIVE_PATH ${lib_replacement} lib_replacement_native)
set(lib_replacement "replaces=\"${lib_replacement_native}\"")
# Use unix path to allow using files on any host platform.
file(TO_CMAKE_PATH ${lib_replacement} lib_replacement_unix_path)
set(lib_replacement "replaces=\"${lib_replacement_unix_path}\"")
endif()
file(TO_NATIVE_PATH ${lib_file} lib_file_native)
string(APPEND file_contents "<lib file=\"${lib_file_native}\" ${lib_replacement} />\n")
# Use unix path to allow using files on any host platform.
file(TO_CMAKE_PATH ${lib_file} lib_file_unix_path)
string(APPEND file_contents
"<lib file=\"${lib_file_unix_path}\" ${lib_replacement} />\n")
endforeach()
endif()
# Bundled files
if(arg_BUNDLED_FILES)
foreach(bundled_file IN LISTS arg_BUNDLED_FILES)
file(TO_NATIVE_PATH ${bundled_file} file_native)
string(APPEND file_contents "<bundled file=\"${file_native}\" />\n")
# Use unix path to allow using files on any host platform.
file(TO_CMAKE_PATH ${bundled_file} file_unix_path)
string(APPEND file_contents "<bundled file=\"${file_unix_path}\" />\n")
endforeach()
endif()

View File

@ -53,7 +53,7 @@ function(qt_internal_add_app target)
# but don't enable macOS bundles.
# Bundles are enabled in a separate set_target_properties call if an Info.plist file
# is provided.
# Similary, the Windows GUI flag is disabled in a separate call
# Similarly, the Windows GUI flag is disabled in a separate call
# if CONFIG += console was encountered during conversion.
set_target_properties("${target}" PROPERTIES WIN32_EXECUTABLE TRUE)
@ -75,7 +75,7 @@ function(qt_internal_get_title_case value out_var)
endif()
string(SUBSTRING "${value}" 0 1 first_char)
string(TOUPPER "${first_char}" first_char_upper)
string(SUBSTRING "${target}" 1 -1 rest_of_value)
string(SUBSTRING "${value}" 1 -1 rest_of_value)
set(title_value "${first_char_upper}${rest_of_value}")
set(${out_var} "${title_value}" PARENT_SCOPE)
endfunction()

View File

@ -182,9 +182,7 @@ function(qt_auto_detect_vcpkg)
endfunction()
function(qt_auto_detect_ios)
if(CMAKE_SYSTEM_NAME STREQUAL iOS
OR CMAKE_SYSTEM_NAME STREQUAL watchOS
OR CMAKE_SYSTEM_NAME STREQUAL tvOS)
if(CMAKE_SYSTEM_NAME STREQUAL iOS)
message(STATUS "Using internal CMake ${CMAKE_SYSTEM_NAME} toolchain file.")
# The QT_UIKIT_SDK check simulates the input.sdk condition for simulator_and_device in
@ -201,55 +199,21 @@ function(qt_auto_detect_ios)
message(STATUS "simulator_and_device set to: \"${simulator_and_device}\".")
# Choose relevant architectures.
# Using a non xcode generator requires explicit setting of the
# Using a non Xcode generator requires explicit setting of the
# architectures, otherwise compilation fails with unknown defines.
if(CMAKE_SYSTEM_NAME STREQUAL iOS)
if(simulator_and_device)
set(osx_architectures "arm64;x86_64")
elseif(QT_UIKIT_SDK STREQUAL "iphoneos")
set(osx_architectures "arm64")
elseif(QT_UIKIT_SDK STREQUAL "iphonesimulator")
set(osx_architectures "x86_64")
if(simulator_and_device)
set(osx_architectures "arm64;x86_64")
elseif(QT_UIKIT_SDK STREQUAL "iphoneos")
set(osx_architectures "arm64")
elseif(QT_UIKIT_SDK STREQUAL "iphonesimulator")
set(osx_architectures "x86_64")
else()
if(NOT DEFINED QT_UIKIT_SDK)
message(FATAL_ERROR "Please provide a value for -DQT_UIKIT_SDK."
" Possible values: iphoneos, iphonesimulator.")
else()
if(NOT DEFINED QT_UIKIT_SDK)
message(FATAL_ERROR "Please proviude a value for -DQT_UIKIT_SDK."
" Possible values: iphoneos, iphonesimulator.")
else()
message(FATAL_ERROR
"Unknown SDK argument given to QT_UIKIT_SDK: ${QT_UIKIT_SDK}.")
endif()
endif()
elseif(CMAKE_SYSTEM_NAME STREQUAL tvOS)
if(simulator_and_device)
set(osx_architectures "arm64;x86_64")
elseif(QT_UIKIT_SDK STREQUAL "appletvos")
set(osx_architectures "arm64")
elseif(QT_UIKIT_SDK STREQUAL "appletvsimulator")
set(osx_architectures "x86_64")
else()
if(NOT DEFINED QT_UIKIT_SDK)
message(FATAL_ERROR "Please proviude a value for -DQT_UIKIT_SDK."
" Possible values: appletvos, appletvsimulator.")
else()
message(FATAL_ERROR
"Unknown SDK argument given to QT_UIKIT_SDK: ${QT_UIKIT_SDK}.")
endif()
endif()
elseif(CMAKE_SYSTEM_NAME STREQUAL watchOS)
if(simulator_and_device)
set(osx_architectures "armv7k;i386")
elseif(QT_UIKIT_SDK STREQUAL "watchos")
set(osx_architectures "armv7k")
elseif(QT_UIKIT_SDK STREQUAL "watchsimulator")
set(osx_architectures "i386")
else()
if(NOT DEFINED QT_UIKIT_SDK)
message(FATAL_ERROR "Please proviude a value for -DQT_UIKIT_SDK."
" Possible values: watchos, watchsimulator.")
else()
message(FATAL_ERROR
"Unknown SDK argument given to QT_UIKIT_SDK: ${QT_UIKIT_SDK}.")
endif()
message(FATAL_ERROR
"Unknown SDK argument given to QT_UIKIT_SDK: ${QT_UIKIT_SDK}.")
endif()
endif()
@ -305,12 +269,8 @@ endfunction()
function(qt_internal_get_darwin_sdk_version out_var)
if(APPLE)
if(IOS)
if(CMAKE_SYSTEM_NAME STREQUAL iOS)
set(sdk_name "iphoneos")
elseif(TVOS)
set(sdk_name "appletvos")
elseif(WATCHOS)
set(sdk_name "watchos")
else()
# Default to macOS
set(sdk_name "macosx")
@ -352,10 +312,6 @@ function(qt_auto_detect_darwin)
set(version "10.14")
elseif(CMAKE_SYSTEM_NAME STREQUAL iOS)
set(version "13.0")
elseif(CMAKE_SYSTEM_NAME STREQUAL watchOS)
set(version "6.0")
elseif(CMAKE_SYSTEM_NAME STREQUAL tvOS)
set(version "13.0")
endif()
if(version)
set(CMAKE_OSX_DEPLOYMENT_TARGET "${version}" CACHE STRING "${description}")
@ -368,9 +324,8 @@ function(qt_auto_detect_darwin)
qt_internal_get_xcode_version(xcode_version)
set(QT_MAC_XCODE_VERSION "${xcode_version}" CACHE STRING "Xcode version.")
set(device_names "iOS" "watchOS" "tvOS")
list(LENGTH CMAKE_OSX_ARCHITECTURES arch_count)
if(NOT CMAKE_SYSTEM_NAME IN_LIST device_names AND arch_count GREATER 0)
if(NOT CMAKE_SYSTEM_NAME STREQUAL iOS AND arch_count GREATER 0)
foreach(arch ${CMAKE_OSX_ARCHITECTURES})
if(arch STREQUAL "arm64e")
message(WARNING "Applications built against an arm64e Qt architecture will "
@ -383,8 +338,7 @@ function(qt_auto_detect_darwin)
endfunction()
function(qt_auto_detect_macos_universal)
set(device_names "iOS" "watchOS" "tvOS")
if(APPLE AND NOT CMAKE_SYSTEM_NAME IN_LIST device_names)
if(APPLE AND NOT CMAKE_SYSTEM_NAME STREQUAL iOS)
list(LENGTH CMAKE_OSX_ARCHITECTURES arch_count)
set(is_universal "OFF")

View File

@ -322,11 +322,13 @@ set(__public_cmake_helpers
cmake/QtCopyFileIfDifferent.cmake
cmake/QtFeature.cmake
cmake/QtFeatureCommon.cmake
cmake/QtPublicAppleHelpers.cmake
cmake/QtPublicCMakeHelpers.cmake
cmake/QtPublicCMakeVersionHelpers.cmake
cmake/QtPublicFinalizerHelpers.cmake
cmake/QtPublicPluginHelpers.cmake
cmake/QtPublicTargetHelpers.cmake
cmake/QtPublicTestHelpers.cmake
cmake/QtPublicToolHelpers.cmake
cmake/QtPublicWalkLibsHelpers.cmake
cmake/QtPublicFindPackageHelpers.cmake
@ -383,7 +385,7 @@ if(MACOS)
)
elseif(IOS)
qt_copy_or_install(FILES
cmake/ios/MacOSXBundleInfo.plist.in
cmake/ios/Info.plist.app.in
cmake/ios/LaunchScreen.storyboard
DESTINATION "${__GlobalConfig_install_dir}/ios"
)

View File

@ -159,7 +159,7 @@ function(qt_internal_set_up_global_paths)
#
# These values should be prepended to file paths in commands or properties,
# in order to correctly place generated Config files, generated Targets files,
# excutables / libraries, when copying / installing files, etc.
# executables / libraries, when copying / installing files, etc.
#
# The build dir variables will always be absolute paths.
# The QT_INSTALL_DIR variable will have a relative path in a prefix build,
@ -263,28 +263,11 @@ function(qt_setup_tool_path_command)
list(APPEND command COMMAND)
list(APPEND command set PATH=${bindir}$<SEMICOLON>%PATH%)
set(QT_TOOL_PATH_SETUP_COMMAND "${command}" CACHE INTERNAL "internal command prefix for tool invocations" FORCE)
# QT_TOOL_PATH_SETUP_COMMAND is deprecated. Please use _qt_internal_wrap_tool_command
# QT_TOOL_PATH_SETUP_COMMAND is deprecated. Please use _qt_internal_get_wrap_tool_script_path
# instead.
endfunction()
qt_setup_tool_path_command()
function(qt_internal_generate_tool_command_wrapper)
get_property(is_called GLOBAL PROPERTY _qt_internal_generate_tool_command_wrapper_called)
if(NOT CMAKE_HOST_WIN32 OR is_called)
return()
endif()
set(bindir "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_BINDIR}")
file(TO_NATIVE_PATH "${bindir}" bindir)
set(tool_command_wrapper_path "${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/qt_setup_tool_path.bat")
file(WRITE "${tool_command_wrapper_path}" "@echo off
set PATH=${bindir};%PATH%
%*")
set(QT_TOOL_COMMAND_WRAPPER_PATH "${tool_command_wrapper_path}"
CACHE INTERNAL "Path to the wrapper of the tool commands")
set_property(GLOBAL PROPERTY _qt_internal_generate_tool_command_wrapper_called TRUE)
endfunction()
qt_internal_generate_tool_command_wrapper()
# Platform define path, etc.
if(WIN32)
set(QT_DEFAULT_PLATFORM_DEFINITIONS WIN32 _ENABLE_EXTENDED_ALIGNED_STORAGE)
@ -543,15 +526,30 @@ if(ANDROID)
include(QtAndroidHelpers)
endif()
if(WASM)
include(QtWasmHelpers)
endif()
# Helpers that are available in public projects and while building Qt itself.
include(QtPublicAppleHelpers)
include(QtPublicCMakeHelpers)
include(QtPublicPluginHelpers)
include(QtPublicTargetHelpers)
include(QtPublicWalkLibsHelpers)
include(QtPublicFindPackageHelpers)
include(QtPublicDependencyHelpers)
include(QtPublicTestHelpers)
include(QtPublicToolHelpers)
if(CMAKE_CROSSCOMPILING)
if(NOT IS_DIRECTORY "${QT_HOST_PATH}")
message(FATAL_ERROR "You need to set QT_HOST_PATH to cross compile Qt.")
endif()
endif()
_qt_internal_determine_if_host_info_package_needed(__qt_build_requires_host_info_package)
_qt_internal_find_host_info_package("${__qt_build_requires_host_info_package}")
# TODO: This block provides support for old variables. It should be removed once
# we remove all references to these variables in other Qt module repos.
# Prefer to use the provided commands to retrieve the relevant things instead.
@ -589,6 +587,11 @@ if(COMMAND _qt_internal_get_add_plugin_keywords)
unset(__qt_internal_add_plugin_multi_args)
endif()
# Create tool script wrapper if necessary.
# TODO: Remove once all direct usages of QT_TOOL_COMMAND_WRAPPER_PATH are replaced with function
# calls.
_qt_internal_generate_tool_command_wrapper()
# This sets up the poor man's scope finalizer mechanism.
# For newer CMake versions, we use cmake_language(DEFER CALL) instead.
if(CMAKE_VERSION VERSION_LESS "3.19.0")

View File

@ -1,4 +1,13 @@
function(qt_print_feature_summary)
if(QT_SUPERBUILD)
qt_internal_set_message_log_level(message_log_level)
if(message_log_level)
# In a top-level build, ensure that the feature_summary is affected by the
# selected log-level.
set(CMAKE_MESSAGE_LOG_LEVEL "${message_log_level}")
endif()
endif()
include(FeatureSummary)
# Show which packages were found.
feature_summary(INCLUDE_QUIET_PACKAGES
@ -37,6 +46,15 @@ function(qt_print_build_instructions)
return()
endif()
if(QT_SUPERBUILD)
qt_internal_set_message_log_level(message_log_level)
if(message_log_level)
# In a top-level build, ensure that qt_print_build_instructions is affected by the
# selected log-level.
set(CMAKE_MESSAGE_LOG_LEVEL "${message_log_level}")
endif()
endif()
set(build_command "cmake --build . --parallel")
set(install_command "cmake --install .")
@ -76,36 +94,76 @@ from the build directory \n")
list(JOIN msg "\n" msg)
if(NOT QT_INTERNAL_BUILD_INSTRUCTIONS_SHOWN)
message(STATUS "${msg}")
qt_configure_print_build_instructions_helper("${msg}")
endif()
set(QT_INTERNAL_BUILD_INSTRUCTIONS_SHOWN "TRUE" CACHE STRING "" FORCE)
endfunction()
function(qt_configure_print_summary_helper summary_reports force_show)
# We force show the summary by temporarily (within the scope of the function) resetting the
# current log level.
if(force_show)
set(CMAKE_MESSAGE_LOG_LEVEL "STATUS")
endif()
message(STATUS "Configure summary:\n${__qt_configure_reports}")
endfunction()
function(qt_configure_print_build_instructions_helper msg)
# We want to ensure build instructions are always shown the first time, regardless of the
# current log level.
set(CMAKE_MESSAGE_LOG_LEVEL "STATUS")
message(STATUS "${msg}")
endfunction()
function(qt_configure_print_summary)
# Evaluate all recorded commands.
qt_configure_eval_commands()
set(summary_file "${CMAKE_BINARY_DIR}/config.summary")
file(WRITE "${summary_file}" "")
# Show Qt-specific configure summary and any notes, wranings, etc.
get_property(features_possibly_changed GLOBAL PROPERTY _qt_dirty_build)
# Show Qt-specific configuration summary.
if(__qt_configure_reports)
if(NOT QT_INTERNAL_SUMMARY_INSTRUCTIONS_SHOWN)
# We want to show the the summary file and log level messages only on first configuration
# or when we detect a feature change, to keep most reconfiguration output as quiet as
# possible. Currently feature change detection is not entirely reliable.
if(NOT QT_INTERNAL_SUMMARY_INSTRUCTIONS_SHOWN OR features_possibly_changed)
message("")
message(
"-- Configuration summary has been written to ${CMAKE_BINARY_DIR}/config.summary")
"-- Configuration summary shown below. It has also been written to"
" ${CMAKE_BINARY_DIR}/config.summary")
message(
"-- Configure with --log-level=STATUS or higher to increase the output verbosity.")
"-- Configure with --log-level=STATUS or higher to increase "
"CMake's message verbosity. "
"The log level does not persist across reconfigurations.")
endif()
# Need 2 flushes to ensure no interleaved input is printed due to a mix of message(STATUS)
# and message(NOTICE) calls.
execute_process(COMMAND ${CMAKE_COMMAND} -E echo " ")
message(STATUS "Configure summary:\n${__qt_configure_reports}")
# We want to show the configuration summary only on first configuration or when we detect
# a feature change, to keep most reconfiguration output as quiet as possible.
# Currently feature change detection is not entirely reliable.
if(NOT QT_INTERNAL_SUMMARY_INSTRUCTIONS_SHOWN OR features_possibly_changed)
set(force_show_summary TRUE)
else()
set(force_show_summary FALSE)
endif()
qt_configure_print_summary_helper(
"Configuration summary:\n${__qt_configure_reports}"
${force_show_summary})
execute_process(COMMAND ${CMAKE_COMMAND} -E echo " ")
file(APPEND "${summary_file}" "${__qt_configure_reports}")
endif()
# Show Qt specific notes, warnings, errors.
if(__qt_configure_notes)
message("${__qt_configure_notes}")
file(APPEND "${summary_file}" "${__qt_configure_notes}")

View File

@ -128,9 +128,14 @@ 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 "${FEATURE_pkg_config}" AND "${INPUT_pkg_config}"
AND NOT "${INPUT_pkg_config}" STREQUAL "undefined")
set(FEATURE_pkg_config ON)
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()
# If user explicitly specified a value for the feature, honor it, even if it might break
@ -250,7 +255,7 @@ macro(qt_build_internals_get_repo_targets subdir)
if(_targets)
foreach(_target IN LISTS _targets)
get_target_property(_type ${_target} TYPE)
if(NOT (${_type} STREQUAL "UTILITY" OR ${_type} STREQUAL "INTERFACE"))
if(NOT ${_type} STREQUAL "UTILITY")
list(APPEND qt_repo_targets "${_target}")
endif()
endforeach()
@ -276,15 +281,17 @@ function(qt_build_internals_add_toplevel_targets)
set(qt_repo_target_name "${qt_repo_targets_name}_${qt_repo_target_basename}")
message(DEBUG "${qt_repo_target_name} depends on ${qt_repo_targets}")
add_custom_target("${qt_repo_target_name}"
DEPENDS ${qt_repo_targets}
COMMENT "Building everything in ${qt_repo_targets_name}/${qt_repo_target_basename}")
COMMENT "Building everything in ${qt_repo_targets_name}/${qt_repo_target_basename}")
add_dependencies("${qt_repo_target_name}" ${qt_repo_targets})
list(APPEND qt_repo_target_all "${qt_repo_target_name}")
endif()
endforeach()
if (qt_repo_target_all)
# Note qt_repo_targets_name is different from qt_repo_target_name that is used above.
add_custom_target("${qt_repo_targets_name}"
DEPENDS ${qt_repo_target_all}
COMMENT "Building everything in ${qt_repo_targets_name}")
add_dependencies("${qt_repo_targets_name}" ${qt_repo_target_all})
message(DEBUG "${qt_repo_targets_name} depends on ${qt_repo_target_all}")
endif()
endfunction()
@ -520,7 +527,18 @@ macro(qt_build_repo_impl_find_package_tests)
# Do this before adding src, because there might be test related conditions
# in source.
if (QT_BUILD_TESTS AND NOT QT_BUILD_STANDALONE_TESTS)
find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS Test)
# When looking for the Test package, do it using the Qt6 package version, in case if
# PROJECT_VERSION is following a different versioning scheme.
if(Qt6_VERSION)
set(_qt_build_repo_impl_find_package_tests_version "${Qt6_VERSION}")
else()
set(_qt_build_repo_impl_find_package_tests_version "${PROJECT_VERSION}")
endif()
find_package(Qt6
"${_qt_build_repo_impl_find_package_tests_version}"
CONFIG REQUIRED COMPONENTS Test)
unset(_qt_build_repo_impl_find_package_tests_version)
endif()
endmacro()
@ -620,7 +638,15 @@ macro(qt_build_tests)
unset(_qt_tests_config_file_name)
# Of course we always need the test module as well.
find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS Test)
# When looking for the Test package, do it using the Qt6 package version, in case if
# PROJECT_VERSION is following a different versioning scheme.
if(Qt6_VERSION)
set(_qt_build_tests_package_version "${Qt6_VERSION}")
else()
set(_qt_build_tests_package_version "${PROJECT_VERSION}")
endif()
find_package(Qt6 "${_qt_build_tests_package_version}" CONFIG REQUIRED COMPONENTS Test)
unset(_qt_build_tests_package_version)
# Set language standards after finding Core, because that's when the relevant
# feature variables are available, and the call in QtSetup is too early when building
@ -727,7 +753,7 @@ endfunction()
# Mean to be called when configuring examples as part of the main build tree, as well as for CMake
# tests (tests that call CMake to try and build CMake applications).
macro(qt_internal_set_up_build_dir_package_paths)
list(APPEND CMAKE_PREFIX_PATH "${QT_BUILD_DIR}")
list(PREPEND CMAKE_PREFIX_PATH "${QT_BUILD_DIR}/${INSTALL_LIBDIR}/cmake")
# Make sure the CMake config files do not recreate the already-existing targets
set(QT_NO_CREATE_TARGETS TRUE)
endmacro()
@ -809,15 +835,15 @@ macro(qt_examples_build_begin)
# Examples that are built as part of the Qt build need to use the CMake config files from the
# build dir, because they are not installed yet in a prefix build.
# Appending to CMAKE_PREFIX_PATH helps find the initial Qt6Config.cmake.
# Appending to QT_EXAMPLES_CMAKE_PREFIX_PATH helps find components of Qt6, because those
# Prepending to CMAKE_PREFIX_PATH helps find the initial Qt6Config.cmake.
# Prepending to QT_EXAMPLES_CMAKE_PREFIX_PATH helps find components of Qt6, because those
# find_package calls use NO_DEFAULT_PATH, and thus CMAKE_PREFIX_PATH is ignored.
# Appending to CMAKE_FIND_ROOT_PATH ensures the components are found while cross-compiling
# Prepending to CMAKE_FIND_ROOT_PATH ensures the components are found while cross-compiling
# without setting CMAKE_FIND_ROOT_PATH_MODE_PACKAGE to BOTH.
if(NOT QT_IS_EXTERNAL_EXAMPLES_BUILD OR NOT __qt_all_examples_ported_to_external_projects)
qt_internal_set_up_build_dir_package_paths()
list(APPEND CMAKE_FIND_ROOT_PATH "${QT_BUILD_DIR}")
list(APPEND QT_EXAMPLES_CMAKE_PREFIX_PATH "${QT_BUILD_DIR}/${INSTALL_LIBDIR}/cmake")
list(PREPEND CMAKE_FIND_ROOT_PATH "${QT_BUILD_DIR}")
list(PREPEND QT_EXAMPLES_CMAKE_PREFIX_PATH "${QT_BUILD_DIR}/${INSTALL_LIBDIR}/cmake")
endif()
# Because CMAKE_INSTALL_RPATH is empty by default in the repo project, examples need to have
@ -1034,6 +1060,41 @@ function(qt_internal_add_example_external_project subdir)
endforeach()
endif()
# When cross-compiling for a qemu target in our CI, we source an environment script
# that sets environment variables like CC and CXX. These are parsed by CMake on initial
# configuration to populate the cache vars CMAKE_${lang}_COMPILER.
# If the environment variable specified not only the compiler path, but also a list of flags
# to pass to the compiler, CMake parses those out into a separate CMAKE_${lang}_COMPILER_ARG1
# cache variable. In such a case, we want to ensure that the external project also sees those
# flags.
# Unfortunately we can't do that by simply forwarding CMAKE_${lang}_COMPILER_ARG1 to the EP
# because it breaks the compiler identification try_compile call, it simply doesn't consider
# the cache var. From what I could gather, it's a limitation of try_compile and the list
# of variables it considers for forwarding.
# To fix this case, we ensure not to pass either cache variable, and let the external project
# and its compiler identification try_compile project pick up the compiler and the flags
# from the environment variables instead.
foreach(lang_as_env_var CC CXX OBJC OBJCXX)
if(lang_as_env_var STREQUAL "CC")
set(lang_as_cache_var "C")
else()
set(lang_as_cache_var "${lang_as_env_var}")
endif()
set(lang_env_value "$ENV{${lang_as_env_var}}")
if(lang_env_value
AND CMAKE_${lang_as_cache_var}_COMPILER
AND CMAKE_${lang_as_cache_var}_COMPILER_ARG1)
# The compiler environment variable is set and specifies a list of extra flags, don't
# forward the compiler cache vars and rely on the environment variable to be picked up
# instead.
else()
list(APPEND vars_to_pass_if_defined "CMAKE_${lang_as_cache_var}_COMPILER:STRING")
endif()
endforeach()
unset(lang_as_env_var)
unset(lang_as_cache_var)
unset(lang_env_value)
list(APPEND vars_to_pass_if_defined
CMAKE_BUILD_TYPE:STRING
CMAKE_CONFIGURATION_TYPES:STRING
@ -1046,13 +1107,9 @@ function(qt_internal_add_example_external_project subdir)
CMAKE_OSX_DEPLOYMENT_TARGET:STRING
CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED:BOOL
CMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH:BOOL
CMAKE_C_COMPILER:STRING
CMAKE_C_COMPILER_LAUNCHER:STRING
CMAKE_CXX_COMPILER:STRING
CMAKE_CXX_COMPILER_LAUNCHER:STRING
CMAKE_OBJC_COMPILER:STRING
CMAKE_OBJC_COMPILER_LAUNCHER:STRING
CMAKE_OBJCXX_COMPILER:STRING
CMAKE_OBJCXX_COMPILER_LAUNCHER:STRING
)

View File

@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.16)
project(qt_single_test VERSION 6.0.0 LANGUAGES C CXX ASM)
find_package(Qt6 REQUIRED COMPONENTS BuildInternals)
find_package(Qt6 REQUIRED COMPONENTS BuildInternals Core)
include(${CMAKE_CURRENT_LIST_DIR}/Main.cmake)
@ -15,5 +15,14 @@ else()
set(absolute_project_path "${QT_STANDALONE_TEST_PATH}")
endif()
if(NOT IS_DIRECTORY "${absolute_project_path}")
get_filename_component(filename "${absolute_project_path}" NAME)
get_filename_component(directory "${absolute_project_path}" DIRECTORY)
if(filename STREQUAL "CMakeLists.txt")
set(absolute_project_path "${directory}")
endif()
endif()
# Add the test project path as a subdirectory project.
add_subdirectory("${absolute_project_path}" "build_dir")

View File

@ -12,6 +12,10 @@ foreach(file ${config_files})
include("${file}")
endforeach()
# Set language standards after finding Core, because that's when the relevant
# feature variables are available.
qt_set_language_standards()
# Just before adding the test, change the local (non-cache) install prefix to something other than
# the Qt install prefix, so that tests don't try to install and pollute the Qt install prefix.
# Needs to be called after qt_get_standalone_tests_confg_files_path().

View File

@ -13,6 +13,25 @@ get_filename_component(QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX
${CMAKE_CURRENT_LIST_DIR}/../@qt_path_from_cmake_config_dir_to_prefix@
ABSOLUTE)
# Stores in out_var the new install/staging prefix for this build.
#
# new_prefix: the new prefix for this repository
# orig_prefix: the prefix that was used when qtbase was configured
#
# On Windows hosts, this function makes sure that we use exactly the original prefix if it points to
# the same directory as the new one. This is needed for the case where the original prefix is passed
# without drive letter to support installing with DESTDIR set.
function(qt_internal_new_prefix out_var new_prefix orig_prefix)
if(CMAKE_HOST_WIN32)
get_filename_component(real_new_prefix "${new_prefix}" REALPATH)
get_filename_component(real_orig_prefix "${orig_prefix}" REALPATH)
if(real_new_prefix STREQUAL real_orig_prefix)
set(new_prefix "${orig_prefix}")
endif()
endif()
set(${out_var} "${new_prefix}" PARENT_SCOPE)
endfunction()
# If no explicit CMAKE_INSTALL_PREFIX is provided, force set the original Qt installation prefix,
# so that further modules / repositories are installed into same original location.
# This means by default when configuring qtsvg / qtdeclarative, they will be installed the regular
@ -25,32 +44,26 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND
NOT QT_BUILD_INTERNALS_NO_FORCE_SET_INSTALL_PREFIX
AND NOT QT_SUPERBUILD)
set(qtbi_orig_prefix "@CMAKE_INSTALL_PREFIX@")
set(qtbi_new_prefix "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}")
set(qtbi_orig_staging_prefix "@CMAKE_STAGING_PREFIX@")
if(CMAKE_HOST_WIN32)
# Make sure we use exactly the original prefix if it points to the same directory as the new
# one. This is needed for the case where the original prefix is passed without drive letter
# to support installing with DESTDIR set.
get_filename_component(qtbi_real_orig_prefix "${qtbi_orig_prefix}" REALPATH)
get_filename_component(qtbi_real_new_prefix "${qtbi_new_prefix}" REALPATH)
if(qtbi_real_orig_prefix STREQUAL qtbi_real_new_prefix)
set(qtbi_new_prefix "${qtbi_orig_prefix}")
endif()
endif()
qt_internal_new_prefix(qtbi_new_prefix
"${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}"
"${qtbi_orig_prefix}")
if(NOT qtbi_orig_staging_prefix STREQUAL ""
AND "${CMAKE_STAGING_PREFIX}" STREQUAL ""
AND NOT QT_BUILD_INTERNALS_NO_FORCE_SET_STAGING_PREFIX)
set(CMAKE_STAGING_PREFIX "${qtbi_new_prefix}" CACHE PATH
qt_internal_new_prefix(qtbi_new_staging_prefix
"${qtbi_new_prefix}"
"${qtbi_orig_staging_prefix}")
set(CMAKE_STAGING_PREFIX "${qtbi_new_staging_prefix}" CACHE PATH
"Staging path prefix, prepended onto install directories on the host machine." FORCE)
set(qtbi_new_prefix "${qtbi_orig_prefix}")
endif()
set(CMAKE_INSTALL_PREFIX "${qtbi_new_prefix}" CACHE PATH
"Install path prefix, prepended onto install directories." FORCE)
unset(qtbi_orig_prefix)
unset(qtbi_real_orig_prefix)
unset(qtbi_new_prefix)
unset(qtbi_real_new_prefix)
unset(qtbi_orig_staging_prefix)
unset(qtbi_new_staging_prefix)
endif()
# Propagate developer builds to other modules via BuildInternals package.

View File

@ -3,8 +3,9 @@
# output-file is relative to ${CMAKE_CURRENT_BINARY_DIR}
#
# This function is similar to file(GENERATE OUTPUT) except it writes the content
# to the file at configure time, rather than at generate time. Once CMake 3.18 is released, it can use file(CONFIGURE) in its implmenetation. Until then, it
# uses configure_file() with a generic input file as source, when used with the CONTENT signature.
# to the file at configure time, rather than at generate time. Once CMake 3.18 is released, it can
# use file(CONFIGURE) in its implementation. Until then, it uses configure_file() with a generic
# input file as source, when used with the CONTENT signature.
function(qt_configure_file)
qt_parse_all_arguments(arg "qt_configure_file" "" "OUTPUT;INPUT;CONTENT" "" ${ARGN})

View File

@ -17,9 +17,17 @@ else()
endif()
if(__qt_disable_package_version_check)
# Don't show the warning needlessly if we know that we're doing an exact search, and the
# version found is not the exactly same.
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION_EXACT
AND NOT PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
set(QT_NO_PACKAGE_VERSION_INCOMPATIBLE_WARNING TRUE)
endif()
# Warn if version check is disabled regardless if it's a Qt repo build or user project build.
# Allow to opt out of warning.
if(__qt_package_version_incompatible AND NOT QT_NO_PACKAGE_VERSION_INCOMPATIBLE_WARNING)
if(__qt_package_version_incompatible AND NOT QT_NO_PACKAGE_VERSION_INCOMPATIBLE_WARNING
AND NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
message(WARNING
"Package ${PACKAGE_FIND_NAME} with version ${PACKAGE_VERSION} was accepted as "
"compatible because QT_NO_PACKAGE_VERSION_CHECK was set to TRUE. There is no guarantee "

View File

@ -189,6 +189,12 @@ function(qt_internal_warn_about_buggy_cmake_versions)
# https://gitlab.kitware.com/cmake/cmake/-/issues/16776
list(APPEND unsuitable_versions "3.21.0")
# Changing a C++ source file can trigger rebuilds of a lot of other source files that might
# include AUTOGEN'ed headers or sources.
# https://gitlab.kitware.com/cmake/cmake/-/issues/22531
# Fixed in 3.21.2.
list(APPEND unsuitable_versions "3.21.1")
# qt_ensure_perl fails to find perl in host PATH via find_program
# due to Android Platform module setting CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH to OFF
# Fixed in 3.20.6, 3.21.3. not a problem in CMake versions earlier than 3.20.0

View File

@ -23,16 +23,6 @@ else()
QT_VERSION_PATCH @PROJECT_VERSION_PATCH@)
endif()
if(NOT "${QT_HOST_PATH}" STREQUAL "")
find_package(Qt@PROJECT_VERSION_MAJOR@HostInfo
CONFIG
REQUIRED
PATHS "${QT_HOST_PATH}"
"${QT_HOST_PATH_CMAKE_DIR}"
NO_CMAKE_FIND_ROOT_PATH
NO_DEFAULT_PATH)
endif()
get_filename_component(_qt_import_prefix "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_qt_import_prefix "${_qt_import_prefix}" REALPATH)
list(APPEND CMAKE_MODULE_PATH "${_qt_import_prefix}")
@ -48,86 +38,32 @@ elseif(APPLE AND CMAKE_SYSTEM_NAME STREQUAL "iOS")
list(APPEND CMAKE_MODULE_PATH "${__qt_internal_cmake_ios_support_files_path}")
endif()
set(QT_ADDITIONAL_PACKAGES_PREFIX_PATH "" CACHE STRING
"Additional directories where find(Qt6 ...) components are searched")
set(QT_ADDITIONAL_HOST_PACKAGES_PREFIX_PATH "" CACHE STRING
"Additional directories where find(Qt6 ...) host Qt components are searched")
# Collect additional package prefix paths to look for Qt packages, both from command line and the
# env variable ${prefixes_var}. The result is stored in ${out_var} and is a list of paths ending
# with "/lib/cmake".
function(__qt_internal_collect_additional_prefix_paths out_var prefixes_var)
if(DEFINED "${out_var}")
return()
endif()
set(additional_packages_prefix_paths "")
set(additional_packages_prefixes "")
if(${prefixes_var})
list(APPEND additional_packages_prefixes ${${prefixes_var}})
endif()
if(DEFINED ENV{${prefixes_var}}
AND NOT "$ENV{${prefixes_var}}" STREQUAL "")
set(prefixes_from_env "$ENV{${prefixes_var}}")
if(NOT CMAKE_HOST_WIN32)
string(REPLACE ":" ";" prefixes_from_env "${prefixes_from_env}")
endif()
list(APPEND additional_packages_prefixes ${prefixes_from_env})
endif()
foreach(additional_path IN LISTS additional_packages_prefixes)
file(TO_CMAKE_PATH "${additional_path}" additional_path)
# The prefix paths need to end with lib/cmake to ensure the packages are found when
# cross compiling. Search for REROOT_PATH_ISSUE_MARKER in the qt.toolchain.cmake file for
# details.
# We must pass the values via the PATHS options because the main find_package call uses
# NO_DEFAULT_PATH, and thus CMAKE_PREFIX_PATH values are discarded.
# CMAKE_FIND_ROOT_PATH values are not discarded and togegher with the PATHS option, it
# ensures packages from additional prefixes are found.
if(NOT additional_path MATCHES "/lib/cmake$")
string(APPEND additional_path "/lib/cmake")
endif()
list(APPEND additional_packages_prefix_paths "${additional_path}")
endforeach()
set("${out_var}" "${additional_packages_prefix_paths}" PARENT_SCOPE)
endfunction()
__qt_internal_collect_additional_prefix_paths(_qt_additional_packages_prefix_paths
QT_ADDITIONAL_PACKAGES_PREFIX_PATH)
__qt_internal_collect_additional_prefix_paths(_qt_additional_host_packages_prefix_paths
QT_ADDITIONAL_HOST_PACKAGES_PREFIX_PATH)
# Take a list of prefix paths ending with "/lib/cmake", and return a list of absolute paths with
# "/lib/cmake" removed.
function(__qt_internal_prefix_paths_to_roots out_var prefix_paths)
set(result "")
foreach(path IN LISTS prefix_paths)
if(path MATCHES "/lib/cmake$")
string(APPEND path "/../..")
endif()
get_filename_component(path "${path}" ABSOLUTE)
list(APPEND result "${path}")
endforeach()
set("${out_var}" "${result}" PARENT_SCOPE)
endfunction()
__qt_internal_prefix_paths_to_roots(_qt_additional_host_packages_root_paths
"${_qt_additional_host_packages_prefix_paths}")
# Public helpers available to all Qt packages.
include("${CMAKE_CURRENT_LIST_DIR}/QtFeature.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicAppleHelpers.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicFinalizerHelpers.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicPluginHelpers.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicTargetHelpers.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicWalkLibsHelpers.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicFindPackageHelpers.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicDependencyHelpers.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicTestHelpers.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicToolHelpers.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicCMakeHelpers.cmake")
set(QT_ADDITIONAL_PACKAGES_PREFIX_PATH "" CACHE STRING
"Additional directories where find(Qt6 ...) components are searched")
set(QT_ADDITIONAL_HOST_PACKAGES_PREFIX_PATH "" CACHE STRING
"Additional directories where find(Qt6 ...) host Qt components are searched")
__qt_internal_collect_additional_prefix_paths(_qt_additional_packages_prefix_paths
QT_ADDITIONAL_PACKAGES_PREFIX_PATH)
__qt_internal_collect_additional_prefix_paths(_qt_additional_host_packages_prefix_paths
QT_ADDITIONAL_HOST_PACKAGES_PREFIX_PATH)
__qt_internal_prefix_paths_to_roots(_qt_additional_host_packages_root_paths
"${_qt_additional_host_packages_prefix_paths}")
if(NOT DEFINED QT_CMAKE_EXPORT_NAMESPACE)
set(QT_CMAKE_EXPORT_NAMESPACE @QT_CMAKE_EXPORT_NAMESPACE@)
endif()
@ -150,10 +86,14 @@ set(__qt_sanitizer_options_set TRUE)
include(CMakeFindDependencyMacro)
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@Dependencies.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@Dependencies.cmake")
if(NOT @INSTALL_CMAKE_NAMESPACE@_DEPENDENCIES_FOUND)
set(@INSTALL_CMAKE_NAMESPACE@_FOUND FALSE)
message(FATAL_ERROR "Failed to find Qt Platform dependency: "
"${@INSTALL_CMAKE_NAMESPACE@_DEPENDENCY_NOT_FOUND_MESSAGE}")
_qt_internal_suggest_dependency_debugging(@INSTALL_CMAKE_NAMESPACE@
__qt_@INSTALL_CMAKE_NAMESPACE@_pkg ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE)
if(NOT @INSTALL_CMAKE_NAMESPACE@_FOUND)
# Clear the components, no need to look for them if dependencies were not found, otherwise
# you get a wall of recursive error messages.
set(@INSTALL_CMAKE_NAMESPACE@_FIND_COMPONENTS "")
endif()
endif()
@ -187,17 +127,21 @@ foreach(module ${@INSTALL_CMAKE_NAMESPACE@_FIND_COMPONENTS})
${_qt_additional_host_packages_root_paths})
endif()
find_package(@INSTALL_CMAKE_NAMESPACE@${module}
${@INSTALL_CMAKE_NAMESPACE@_FIND_VERSION}
${_@INSTALL_CMAKE_NAMESPACE@_FIND_PARTS_QUIET}
PATHS
${_qt_cmake_dir}
${_qt_additional_packages_prefix_paths}
${QT_EXAMPLES_CMAKE_PREFIX_PATH}
${__qt_find_package_host_qt_path}
${_qt_additional_host_packages_prefix_paths}
${__qt_use_no_default_path_for_qt_packages}
)
_qt_internal_save_find_package_context_for_debugging(@INSTALL_CMAKE_NAMESPACE@${module})
if(NOT @INSTALL_CMAKE_NAMESPACE@${module}_FOUND)
find_package(@INSTALL_CMAKE_NAMESPACE@${module}
${@INSTALL_CMAKE_NAMESPACE@_FIND_VERSION}
${_@INSTALL_CMAKE_NAMESPACE@_FIND_PARTS_QUIET}
PATHS
${_qt_cmake_dir}
${_qt_additional_packages_prefix_paths}
${QT_EXAMPLES_CMAKE_PREFIX_PATH}
${__qt_find_package_host_qt_path}
${_qt_additional_host_packages_prefix_paths}
${__qt_use_no_default_path_for_qt_packages}
)
endif()
if(NOT "${__qt_find_package_host_qt_path}" STREQUAL "")
set(CMAKE_PREFIX_PATH "${__qt_backup_cmake_prefix_path}")
@ -234,11 +178,17 @@ foreach(module ${@INSTALL_CMAKE_NAMESPACE@_FIND_COMPONENTS})
endif()
if(@INSTALL_CMAKE_NAMESPACE@_FIND_REQUIRED_${module})
set(@INSTALL_CMAKE_NAMESPACE@_FOUND False)
set(_Qt_NOTFOUND_MESSAGE
"${_Qt_NOTFOUND_MESSAGE}Failed to find Qt component \"${module}\". ${_qt_component_not_found_msg}")
"${_Qt_NOTFOUND_MESSAGE}Failed to find required Qt component \"${module}\". ${_qt_component_not_found_msg}")
set(_qt_full_component_name "@INSTALL_CMAKE_NAMESPACE@${module}")
_qt_internal_suggest_dependency_debugging(${_qt_full_component_name}
_qt_full_component_name _Qt_NOTFOUND_MESSAGE)
unset(_qt_full_component_name)
break()
elseif(NOT @INSTALL_CMAKE_NAMESPACE@_FIND_QUIETLY)
message(WARNING
"Failed to find Qt component \"${module}\". ${_qt_component_not_found_msg}")
"Failed to find optional Qt component \"${module}\". ${_qt_component_not_found_msg}")
endif()
unset(_qt_expected_component_config_path)
@ -250,10 +200,15 @@ endforeach()
if(@INSTALL_CMAKE_NAMESPACE@_FIND_COMPONENTS AND _Qt_NOTFOUND_MESSAGE)
set(@INSTALL_CMAKE_NAMESPACE@_NOT_FOUND_MESSAGE "${_Qt_NOTFOUND_MESSAGE}")
set(@INSTALL_CMAKE_NAMESPACE@_FOUND False)
unset(_Qt_NOTFOUND_MESSAGE)
endif()
if(@INSTALL_CMAKE_NAMESPACE@_FOUND
AND COMMAND _qt_internal_override_example_install_dir_to_dot
AND NOT _qt_internal_example_dir_set_to_dot)
_qt_internal_override_example_install_dir_to_dot()
endif()
__qt_internal_defer_promote_targets_in_dir_scope_to_global()
if(CMAKE_VERSION VERSION_LESS 3.21)
__qt_internal_check_link_order_matters()

View File

@ -1,51 +1,24 @@
set(@INSTALL_CMAKE_NAMESPACE@_DEPENDENCIES_FOUND FALSE)
set(@INSTALL_CMAKE_NAMESPACE@_FOUND FALSE)
set(__qt_platform_requires_host_info_package "@platform_requires_host_info_package@")
set(__qt_platform_initial_qt_host_path "@qt_host_path_absolute@")
set(__qt_platform_initial_qt_host_path_cmake_dir "@qt_host_path_cmake_dir_absolute@")
_qt_internal_setup_qt_host_path(
"${__qt_platform_requires_host_info_package}"
"${__qt_platform_initial_qt_host_path}"
"${__qt_platform_initial_qt_host_path_cmake_dir}")
_qt_internal_find_host_info_package(${__qt_platform_requires_host_info_package})
# note: _third_party_deps example: "ICU\\;FALSE\\;1.0\\;i18n uc data;ZLIB\\;FALSE\\;\\;"
set(__qt_third_party_deps "@third_party_deps@")
@third_party_extra@
foreach(__qt_target_dep ${__qt_third_party_deps})
list(GET __qt_target_dep 0 __qt_pkg)
list(GET __qt_target_dep 1 __qt_is_optional)
list(GET __qt_target_dep 2 __qt_version)
list(GET __qt_target_dep 3 __qt_components)
list(GET __qt_target_dep 4 __qt_optional_components)
set(__qt_find_package_args "${__qt_pkg}")
if(__qt_version)
list(APPEND __qt_find_package_args "${__qt_version}")
endif()
if(__qt_components)
string(REPLACE " " ";" __qt_components "${__qt_components}")
list(APPEND __qt_find_package_args COMPONENTS ${__qt_components})
endif()
if(__qt_optional_components)
string(REPLACE " " ";" __qt_optional_components "${__qt_optional_components}")
list(APPEND __qt_find_package_args OPTIONAL_COMPONENTS ${__qt_optional_components})
endif()
# Don't propagate REQUIRED so we don't immediately FATAL_ERROR, rather let the find_dependency calls
# set _NOT_FOUND_MESSAGE which will be displayed by the includer of the Dependencies file.
set(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED FALSE)
# Already build an error message, because find_dependency calls return() on failure.
set(__qt_message "\nPackage: ${__qt_pkg}")
if(__qt_version)
string(APPEND __qt_message "\nVersion: ${__qt_version}")
endif()
if(__qt_components)
string(APPEND __qt_message "\nComponents: ${__qt_components}")
endif()
if(__qt_optional_components)
string(APPEND __qt_message "\nComponents: ${__qt_optional_components}")
endif()
set(@INSTALL_CMAKE_NAMESPACE@_DEPENDENCY_NOT_FOUND_MESSAGE "${__qt_message}")
_qt_internal_find_third_party_dependencies(@INSTALL_CMAKE_NAMESPACE@ __qt_third_party_deps)
if(__qt_is_optional)
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
list(APPEND __qt_find_package_args QUIET)
endif()
find_package(${__qt_find_package_args})
else()
find_dependency(${__qt_find_package_args})
endif()
endforeach()
set(@INSTALL_CMAKE_NAMESPACE@_DEPENDENCIES_FOUND TRUE)
unset(@INSTALL_CMAKE_NAMESPACE@_DEPENDENCY_NOT_FOUND_MESSAGE)
set(@INSTALL_CMAKE_NAMESPACE@_FOUND TRUE)

View File

@ -94,6 +94,7 @@ function(qt_internal_add_docs)
add_custom_target(qattributionsscanner_${target}
COMMAND ${qtattributionsscanner_bin}
${PROJECT_SOURCE_DIR}
--basedir "${PROJECT_SOURCE_DIR}/.."
--filter "QDocModule=${doc_target}"
-o "${target_bin_dir}/codeattributions.qdoc"
)

View File

@ -6,7 +6,7 @@
# The argument accepts 'Bootstrap' or 'None' values. If the argument value is set to
# 'Bootstrap' the Qt::Bootstrap library is linked to the executable instead of Qt::Core.
# The 'None' value points that core library is not necessary and avoids linking neither
# Qt::Core or Qt::Bootstrap libraries. Otherwise the Qt::Core library will be publically
# Qt::Core or Qt::Bootstrap libraries. Otherwise the Qt::Core library will be publicly
# linked to the executable target by default.
function(qt_internal_add_executable name)
qt_parse_all_arguments(arg "qt_internal_add_executable"
@ -37,8 +37,10 @@ function(qt_internal_add_executable name)
endif()
if(WASM)
qt_internal_wasm_add_finalizers("${name}")
_qt_internal_wasm_add_target_helpers("${name}")
endif()
if (arg_VERSION)
if(arg_VERSION MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+")
# nothing to do

View File

@ -236,7 +236,7 @@ function(qt_feature_check_and_save_user_provided_value resultVar feature conditi
if (DEFINED "FEATURE_${feature}")
# Revisit new user provided value
set(user_value "${FEATURE_${feature}}")
set(result "${user_value}")
string(TOUPPER "${user_value}" result)
# If the build is marked as dirty and the user_value doesn't meet the new condition,
# reset it to the computed one.
@ -921,6 +921,7 @@ function(qt_config_compile_test name)
# fail instead of cmake abort later via CMAKE_REQUIRED_LIBRARIES.
string(FIND "${library}" "::" cmake_target_namespace_separator)
if(NOT cmake_target_namespace_separator EQUAL -1)
message(STATUS "Performing Test ${arg_LABEL} - Failed because ${library} not found")
set(HAVE_${name} FALSE)
break()
endif()
@ -1246,7 +1247,15 @@ function(qt_make_features_available target)
endif()
foreach(feature IN ITEMS ${features})
if (DEFINED "QT_FEATURE_${feature}" AND NOT "${QT_FEATURE_${feature}}" STREQUAL "${value}")
message(FATAL_ERROR "Feature ${feature} is already defined to be \"${QT_FEATURE_${feature}}\" and should now be set to \"${value}\" when importing features from ${target}.")
message(WARNING
"This project was initially configured with the Qt feature \"${feature}\" "
"set to \"${QT_FEATURE_${feature}}\". While loading the "
"\"${target}\" package, the value of the feature "
"has changed to \"${value}\". That might cause a project rebuild due to "
"updated C++ headers. \n"
"In case of build issues, consider removing the CMakeCache.txt file and "
"reconfiguring the project."
)
endif()
set(QT_FEATURE_${feature} "${value}" CACHE INTERNAL "Qt feature: ${feature} (from target ${target})")
endforeach()

View File

@ -25,7 +25,7 @@ macro(qt_find_package)
# found as part of a find_dependency() call from a ModuleDependencies.cmake file (or similar),
# and the provided target is also found, that means this might have been an unnecessary
# qt_find_package() call, because the dependency was already found via some other transitive
# dependency. Return early, so that CMake doesn't fail wiht an error with trying to promote the
# dependency. Return early, so that CMake doesn't fail with an error with trying to promote the
# targets to be global. This behavior is not enabled by default, because there are cases
# when a regular find_package() (non qt_) can find a package (Freetype -> PNG), and a subsequent
# qt_find_package(PNG PROVIDED_TARGET PNG::PNG) still needs to succeed and register the provided
@ -284,6 +284,8 @@ endfunction()
# Needed to record a dependency on the package that provides WrapVulkanHeaders::WrapVulkanHeaders.
# The package version, components, whether the package is optional, etc, are queried from the
# ${dep_target} target properties.
# Usually these are set at the qt_find_package() call site of a configure.cmake file e.g. using
# Qt's MARK_OPTIONAL option.
function(qt_record_extra_third_party_dependency main_target_name dep_target)
if(NOT TARGET "${main_target_name}")
qt_get_tool_target_name(main_target_name "${main_target_name}")
@ -307,13 +309,112 @@ function(qt_internal_is_lib_part_of_qt6_package lib out_var)
OR lib STREQUAL "GlobalConfigPrivate"
OR lib STREQUAL "PlatformModuleInternal"
OR lib STREQUAL "PlatformPluginInternal"
OR lib STREQUAL "PlatformToolInternal")
OR lib STREQUAL "PlatformToolInternal"
OR lib STREQUAL "PlatformCommonInternal"
)
set(${out_var} "TRUE" PARENT_SCOPE)
else()
set(${out_var} "FALSE" PARENT_SCOPE)
endif()
endfunction()
# Try to get the CMake package version of a Qt target.
#
# Query the target's _qt_package_version property, or try to read it from the CMake package version
# variable set from calling find_package(Qt6${target}).
# Not all targets will have a find_package _VERSION variable, for example if the target is an
# executable.
# A heuristic is used to handle QtFooPrivate module targets.
# If no version can be found, fall back to ${PROJECT_VERSION} and issue a warning.
function(qt_internal_get_package_version_of_target target package_version_out_var)
qt_internal_is_lib_part_of_qt6_package("${target}" is_part_of_qt6)
if(is_part_of_qt6)
# When building qtbase, Qt6_VERSION is not set (unless examples are built in-tree,
# non-ExternalProject). Use the Platform target's version instead which would be the
# equivalent.
if(TARGET "${QT_CMAKE_EXPORT_NAMESPACE}::Platform")
get_target_property(package_version
"${QT_CMAKE_EXPORT_NAMESPACE}::Platform" _qt_package_version)
endif()
if(NOT package_version)
set(package_version "${${QT_CMAKE_EXPORT_NAMESPACE}_VERSION}")
endif()
else()
# Try to get the version from the target.
# Try the Private target first and if it doesn't exist, try the non-Private target later.
if(TARGET "${QT_CMAKE_EXPORT_NAMESPACE}::${target}")
get_target_property(package_version
"${QT_CMAKE_EXPORT_NAMESPACE}::${target}" _qt_package_version)
endif()
# Try to get the version from the corresponding package version variable.
if(NOT package_version)
set(package_version "${${QT_CMAKE_EXPORT_NAMESPACE}${target}_VERSION}")
endif()
# Try non-Private target.
if(NOT package_version AND target MATCHES "(.*)Private$")
set(target "${CMAKE_MATCH_1}")
endif()
if(NOT package_version AND TARGET "${QT_CMAKE_EXPORT_NAMESPACE}::${target}")
get_target_property(package_version
"${QT_CMAKE_EXPORT_NAMESPACE}::${target}" _qt_package_version)
endif()
if(NOT package_version)
set(package_version "${${QT_CMAKE_EXPORT_NAMESPACE}${target}_VERSION}")
endif()
endif()
if(NOT package_version)
set(package_version "${PROJECT_VERSION}")
if(FEATURE_developer_build)
message(WARNING
"Could not determine package version of target ${target}. "
"Defaulting to project version ${PROJECT_VERSION}.")
endif()
endif()
set(${package_version_out_var} "${package_version}" PARENT_SCOPE)
endfunction()
# Get the CMake package name that contains / exported the Qt module target.
function(qt_internal_get_package_name_of_target target package_name_out_var)
qt_internal_is_lib_part_of_qt6_package("${target}" is_part_of_qt6)
if(is_part_of_qt6)
set(package_name "${INSTALL_CMAKE_NAMESPACE}")
else()
# Get the package name from the module's target property.
# If not set, fallback to a name based on the target name.
#
# TODO: Remove fallback once sufficient time has passed, aka all developers updated
# their builds not to contain stale FooDependencies.cmakes files without the
# _qt_package_name property.
set(package_name "")
set(package_name_default "${INSTALL_CMAKE_NAMESPACE}${target}")
set(target_namespaced "${QT_CMAKE_EXPORT_NAMESPACE}::${target}")
if(TARGET "${target_namespaced}")
get_target_property(package_name_from_prop "${target_namespaced}" _qt_package_name)
if(package_name_from_prop)
set(package_name "${package_name_from_prop}")
endif()
endif()
if(NOT package_name)
message(WARNING
"Could not find target ${target_namespaced} to query its package name. "
"Defaulting to package name ${package_name_default}. Consider re-arranging the "
"project structure to ensure the target exists by this point."
)
set(package_name "${package_name_default}")
endif()
endif()
set(${package_name_out_var} "${package_name}" PARENT_SCOPE)
endfunction()
# This function stores the list of Qt targets a library depend on,
# along with their version info, for usage in ${target}Depends.cmake file
function(qt_register_target_dependencies target public_libs private_libs)
@ -345,12 +446,9 @@ function(qt_register_target_dependencies target public_libs private_libs)
foreach(lib IN LISTS lib_list)
if ("${lib}" MATCHES "^Qt::(.*)")
set(lib "${CMAKE_MATCH_1}")
qt_internal_is_lib_part_of_qt6_package("${lib}" is_part_of_qt6)
if (is_part_of_qt6)
list(APPEND target_deps "Qt6\;${PROJECT_VERSION}")
else()
list(APPEND target_deps "${INSTALL_CMAKE_NAMESPACE}${lib}\;${PROJECT_VERSION}")
endif()
qt_internal_get_package_name_of_target("${lib}" package_name)
qt_internal_get_package_version_of_target("${lib}" package_version)
list(APPEND target_deps "${package_name}\;${package_version}")
endif()
endforeach()
@ -370,7 +468,9 @@ function(qt_register_target_dependencies target public_libs private_libs)
qt_internal_is_lib_part_of_qt6_package("${lib}" is_part_of_qt6)
get_target_property(lib_type "${lib_namespaced}" TYPE)
if(NOT lib_type STREQUAL "STATIC_LIBRARY" AND NOT is_part_of_qt6)
list(APPEND target_deps "${INSTALL_CMAKE_NAMESPACE}${lib}\;${PROJECT_VERSION}")
qt_internal_get_package_name_of_target("${lib}" package_name)
qt_internal_get_package_version_of_target("${lib}" package_version)
list(APPEND target_deps "${package_name}\;${package_version}")
endif()
endif()
endforeach()

View File

@ -89,7 +89,34 @@ foreach(line ${lines})
# qmake's UnixMakefileGenerator::findLibraries then takes care of deduplication, which
# keeps the last occurrence of the library on the link line, the one after the object
# files.
list(APPEND libs_to_prepend "${target_library_path}")
qt_internal_path_is_relative_to_qt_lib_path(
"${target_library_path}" "${QT_LIB_DIRS}" lib_is_a_qt_module relative_lib)
if(NOT lib_is_a_qt_module)
qt_internal_path_is_relative_to_qt_lib_path(
"${target_library_path}" "${QT_PLUGIN_DIRS}" lib_is_a_qt_plugin relative_lib)
endif()
if(NOT lib_is_a_qt_module AND NOT lib_is_a_qt_plugin)
qt_internal_path_is_relative_to_qt_lib_path(
"${target_library_path}" "${QT_QML_DIRS}" lib_is_a_qt_qml_plugin relative_lib)
endif()
if(NOT lib_is_a_qt_module AND NOT lib_is_a_qt_plugin AND NOT lib_is_a_qt_qml_plugin)
message(AUTHOR_WARNING
"Could not determine relative path for library ${target_library_path} when "
"generating prl file contents. An absolute path will be embedded, which "
"will cause issues if the Qt installation is relocated.")
list(APPEND libs_to_prepend "${target_library_path}")
else()
set(qmake_lib_path_prefix "$$[QT_PRL_INVALID_QMAKE_VARIABLE]")
if(lib_is_a_qt_module)
set(qmake_lib_path_prefix "$$[QT_INSTALL_LIBS]")
elseif(lib_is_a_qt_plugin)
set(qmake_lib_path_prefix "$$[QT_INSTALL_PLUGINS]")
elseif(lib_is_a_qt_qml_plugin)
set(qmake_lib_path_prefix "$$[QT_INSTALL_QML]")
endif()
qt_strip_library_version_suffix(relative_lib "${relative_lib}")
list(APPEND libs_to_prepend "${qmake_lib_path_prefix}/${relative_lib}")
endif()
list(PREPEND adjusted_libs ${libs_to_prepend})
endif()

View File

@ -236,11 +236,8 @@ function(qt_set_language_standards)
set(CMAKE_CXX_STANDARD 17 PARENT_SCOPE)
endif()
if (c_std_11 IN_LIST CMAKE_C_COMPILE_FEATURES)
set(CMAKE_C_STANDARD 11 PARENT_SCOPE)
elseif (c_std_99 IN_LIST CMAKE_C_COMPILE_FEATURES)
set(CMAKE_C_STANDARD 99 PARENT_SCOPE)
endif()
set(CMAKE_C_STANDARD 11 PARENT_SCOPE)
set(CMAKE_C_STANDARD_REQUIRED ON PARENT_SCOPE)
endfunction()
function(qt_set_language_standards_interface_compile_features target)

View File

@ -124,10 +124,6 @@ function(qt_internal_add_headers_clean_target
endif()
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 4.9)
list(APPEND hcleanFLAGS -Wfloat-conversion)
# GCC 9 has a lot of false positives relating to these
list(APPEND hcleanFlags -Wno-deprecated-copy -Wno-redundant-move
-Wno-format-overflow -Wno-init-list-lifetime)
endif()
endif()

View File

@ -68,7 +68,7 @@ function(qt_internal_set_warnings_are_errors_flags target target_scope)
set(warnings_are_errors_enabled_genex
"$<NOT:$<BOOL:$<TARGET_PROPERTY:QT_SKIP_WARNINGS_ARE_ERRORS>>>")
# Apprently qmake only adds -Werror to CXX and OBJCXX files, not C files. We have to do the
# Apparently qmake only adds -Werror to CXX and OBJCXX files, not C files. We have to do the
# same otherwise MinGW builds break when building 3rdparty\md4c\md4c.c (and probably on other
# platforms too).
set(cxx_only_genex "$<OR:$<COMPILE_LANGUAGE:CXX>,$<COMPILE_LANGUAGE:OBJCXX>>")
@ -128,23 +128,23 @@ function(qt_internal_add_global_definition definition)
endfunction()
add_library(PlatformCommonInternal INTERFACE)
add_library(Qt::PlatformCommonInternal ALIAS PlatformCommonInternal)
qt_internal_add_target_aliases(PlatformCommonInternal)
target_link_libraries(PlatformCommonInternal INTERFACE Platform)
add_library(PlatformModuleInternal INTERFACE)
add_library(Qt::PlatformModuleInternal ALIAS PlatformModuleInternal)
qt_internal_add_target_aliases(PlatformModuleInternal)
target_link_libraries(PlatformModuleInternal INTERFACE PlatformCommonInternal)
add_library(PlatformPluginInternal INTERFACE)
add_library(Qt::PlatformPluginInternal ALIAS PlatformPluginInternal)
qt_internal_add_target_aliases(PlatformPluginInternal)
target_link_libraries(PlatformPluginInternal INTERFACE PlatformCommonInternal)
add_library(PlatformAppInternal INTERFACE)
add_library(Qt::PlatformAppInternal ALIAS PlatformAppInternal)
qt_internal_add_target_aliases(PlatformAppInternal)
target_link_libraries(PlatformAppInternal INTERFACE PlatformCommonInternal)
add_library(PlatformToolInternal INTERFACE)
add_library(Qt::PlatformToolInternal ALIAS PlatformToolInternal)
qt_internal_add_target_aliases(PlatformToolInternal)
target_link_libraries(PlatformToolInternal INTERFACE PlatformAppInternal)
qt_internal_add_global_definition(QT_NO_JAVA_STYLE_ITERATORS)
@ -223,7 +223,6 @@ if(UIKIT)
# TODO: Figure out if this ok or not (sounds ok to me).
target_compile_definitions(PlatformCommonInternal INTERFACE QT_COMPILER_SUPPORTS_SSE2)
endif()
qt_internal_apply_bitcode_flags(PlatformCommonInternal)
endif()
if(WASM AND QT_FEATURE_sse2)
@ -285,11 +284,8 @@ endif()
if(QT_FEATURE_intelcet)
if(MSVC)
target_compile_options(PlatformCommonInternal INTERFACE
-guard:ehcont
)
target_link_options(PlatformCommonInternal INTERFACE
-guard:ehcont -CETCOMPAT
-CETCOMPAT
)
else()
target_compile_options(PlatformCommonInternal INTERFACE

View File

@ -14,6 +14,8 @@ get_filename_component(_import_prefix "${_import_prefix}" REALPATH)
# Find required dependencies, if any.
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Dependencies.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Dependencies.cmake")
_qt_internal_suggest_dependency_debugging(@target@
__qt_@target@_pkg ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE)
endif()
# If *ConfigDependencies.cmake exists, the variable value will be defined there.
@ -119,7 +121,7 @@ else()
set(@INSTALL_CMAKE_NAMESPACE@@target@_FOUND FALSE)
if(NOT DEFINED @INSTALL_CMAKE_NAMESPACE@@target@_NOT_FOUND_MESSAGE)
set(@INSTALL_CMAKE_NAMESPACE@@target@_NOT_FOUND_MESSAGE
"Target \"@QT_CMAKE_EXPORT_NAMESPACE@::@target@\" was not found. ${@INSTALL_CMAKE_NAMESPACE@@target@_extra_not_found_message}")
"Target \"@QT_CMAKE_EXPORT_NAMESPACE@::@target@\" was not found.")
if(QT_NO_CREATE_TARGETS)
string(APPEND @INSTALL_CMAKE_NAMESPACE@@target@_NOT_FOUND_MESSAGE

View File

@ -8,92 +8,36 @@ set(__qt_use_no_default_path_for_qt_packages "NO_DEFAULT_PATH")
if(QT_DISABLE_NO_DEFAULT_PATH_IN_QT_PACKAGES)
set(__qt_use_no_default_path_for_qt_packages "")
endif()
find_dependency(@INSTALL_CMAKE_NAMESPACE@ @PROJECT_VERSION@
PATHS
"${CMAKE_CURRENT_LIST_DIR}/.."
"${_qt_cmake_dir}"
${_qt_additional_packages_prefix_paths}
${QT_EXAMPLES_CMAKE_PREFIX_PATH}
${__qt_use_no_default_path_for_qt_packages}
)
# Don't propagate REQUIRED so we don't immediately FATAL_ERROR, rather let the find_dependency calls
# set _NOT_FOUND_MESSAGE which will be displayed by the includer of the Dependencies file.
set(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED FALSE)
if(NOT @INSTALL_CMAKE_NAMESPACE@_FOUND)
find_dependency(@INSTALL_CMAKE_NAMESPACE@ @main_qt_package_version@
PATHS
"${CMAKE_CURRENT_LIST_DIR}/.."
"${_qt_cmake_dir}"
${_qt_additional_packages_prefix_paths}
${QT_EXAMPLES_CMAKE_PREFIX_PATH}
${__qt_use_no_default_path_for_qt_packages}
)
endif()
# note: _third_party_deps example: "ICU\\;FALSE\\;1.0\\;i18n uc data;ZLIB\\;FALSE\\;\\;"
set(__qt_@target@_third_party_deps "@third_party_deps@")
foreach(__qt_@target@_target_dep ${__qt_@target@_third_party_deps})
list(GET __qt_@target@_target_dep 0 __qt_@target@_pkg)
list(GET __qt_@target@_target_dep 1 __qt_@target@_is_optional)
list(GET __qt_@target@_target_dep 2 __qt_@target@_version)
list(GET __qt_@target@_target_dep 3 __qt_@target@_components)
list(GET __qt_@target@_target_dep 4 __qt_@target@_optional_components)
set(__qt_@target@_find_package_args "${__qt_@target@_pkg}")
if(__qt_@target@_version)
list(APPEND __qt_@target@_find_package_args "${__qt_@target@_version}")
endif()
if(__qt_@target@_components)
string(REPLACE " " ";" __qt_@target@_components "${__qt_@target@_components}")
list(APPEND __qt_@target@_find_package_args COMPONENTS ${__qt_@target@_components})
endif()
if(__qt_@target@_optional_components)
string(REPLACE " " ";" __qt_@target@_optional_components "${__qt_@target@_optional_components}")
list(APPEND __qt_@target@_find_package_args OPTIONAL_COMPONENTS ${__qt_@target@_optional_components})
endif()
if(__qt_@target@_is_optional)
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
list(APPEND __qt_@target@_find_package_args QUIET)
endif()
find_package(${__qt_@target@_find_package_args})
else()
find_dependency(${__qt_@target@_find_package_args})
endif()
endforeach()
_qt_internal_find_third_party_dependencies("@target@" __qt_@target@_third_party_deps)
# Find Qt tool package.
set(__qt_@target@_tool_deps "@main_module_tool_deps@")
if(__qt_@target@_tool_deps AND NOT "${QT_HOST_PATH}" STREQUAL "")
# Make sure that the tools find the host tools first
set(BACKUP_@target@_CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH})
set(BACKUP_@target@_CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH})
list(PREPEND CMAKE_PREFIX_PATH "${QT_HOST_PATH_CMAKE_DIR}"
"${_qt_additional_host_packages_prefix_paths}")
list(PREPEND CMAKE_FIND_ROOT_PATH "${QT_HOST_PATH}"
"${_qt_additional_host_packages_root_paths}")
endif()
foreach(__qt_@target@_target_dep ${__qt_@target@_tool_deps})
list(GET __qt_@target@_target_dep 0 __qt_@target@_pkg)
list(GET __qt_@target@_target_dep 1 __qt_@target@_version)
unset(__qt_@target@_find_package_args)
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
list(APPEND __qt_@target@_find_package_args QUIET)
endif()
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED)
list(APPEND __qt_@target@_find_package_args REQUIRED)
endif()
find_package(${__qt_@target@_pkg} ${__qt_@target@_version} ${__qt_@target@_find_package_args}
PATHS
${_qt_additional_packages_prefix_paths}
)
if (NOT ${__qt_@target@_pkg}_FOUND)
if(NOT "${QT_HOST_PATH}" STREQUAL "")
set(CMAKE_PREFIX_PATH ${BACKUP_@target@_CMAKE_PREFIX_PATH})
set(CMAKE_FIND_ROOT_PATH ${BACKUP_@target@_CMAKE_FIND_ROOT_PATH})
endif()
return()
endif()
endforeach()
if(__qt_@target@_tool_deps AND NOT "${QT_HOST_PATH}" STREQUAL "")
set(CMAKE_PREFIX_PATH ${BACKUP_@target@_CMAKE_PREFIX_PATH})
set(CMAKE_FIND_ROOT_PATH ${BACKUP_@target@_CMAKE_FIND_ROOT_PATH})
endif()
_qt_internal_find_tool_dependencies("@target@" __qt_@target@_tool_deps)
# note: target_deps example: "Qt6Core\;5.12.0;Qt6Gui\;5.12.0"
set(__qt_@target@_target_deps "@target_deps@")
set(__qt_@target@_find_dependency_paths "${CMAKE_CURRENT_LIST_DIR}/.." "${_qt_cmake_dir}")
_qt_internal_find_dependencies(__qt_@target@_target_deps __qt_@target@_find_dependency_paths)
_qt_internal_find_qt_dependencies("@target@" __qt_@target@_target_deps
__qt_@target@_find_dependency_paths)
set(_@QT_CMAKE_EXPORT_NAMESPACE@@target@_MODULE_DEPENDENCIES "@qt_module_dependencies@")
set(@INSTALL_CMAKE_NAMESPACE@@target@_FOUND TRUE)

View File

@ -95,7 +95,9 @@ function(qt_internal_add_module target)
${ARGN}
)
set(is_internal_module FALSE)
if(arg_INTERNAL_MODULE)
set(is_internal_module TRUE)
set(arg_INTERNAL_MODULE "INTERNAL_MODULE")
set(arg_NO_PRIVATE_MODULE TRUE)
# Assume the interface name of the internal module should be the module name without the
@ -153,8 +155,32 @@ function(qt_internal_add_module target)
set_target_properties(${target} PROPERTIES
_qt_module_interface_name "${arg_MODULE_INTERFACE_NAME}"
_qt_package_version "${PROJECT_VERSION}"
_qt_package_name "${INSTALL_CMAKE_NAMESPACE}${target}"
)
set_property(TARGET ${target} APPEND PROPERTY EXPORT_PROPERTIES _qt_module_interface_name)
set(export_properties
"_qt_module_interface_name"
"_qt_package_version"
"_qt_package_name"
)
if(NOT is_internal_module)
set_target_properties(${target} PROPERTIES
_qt_is_public_module TRUE
)
list(APPEND export_properties
"_qt_is_public_module"
)
if(NOT ${arg_NO_PRIVATE_MODULE})
set_target_properties(${target} PROPERTIES
_qt_private_module_target_name "${target}Private"
)
list(APPEND export_properties
"_qt_private_module_target_name"
)
endif()
endif()
set_property(TARGET ${target} APPEND PROPERTY EXPORT_PROPERTIES "${export_properties}")
qt_internal_module_info(module "${target}")
qt_internal_add_qt_repo_known_module("${target}")
@ -201,7 +227,7 @@ function(qt_internal_add_module target)
qt_internal_get_framework_info(fw ${target})
endif()
if(NOT QT_FEATURE_no_extern_direct_access AND QT_FEATURE_reduce_relocations AND
if(NOT QT_FEATURE_no_direct_extern_access AND QT_FEATURE_reduce_relocations AND
UNIX AND NOT is_interface_lib)
# On x86 and x86-64 systems with ELF binaries (especially Linux), due to
# a new optimization in GCC 5.x in combination with a recent version of
@ -238,9 +264,21 @@ function(qt_internal_add_module target)
add_library("${target_private}" INTERFACE)
qt_internal_add_target_aliases("${target_private}")
set_target_properties(${target_private} PROPERTIES
_qt_config_module_name ${arg_CONFIG_MODULE_NAME}_private)
_qt_config_module_name ${arg_CONFIG_MODULE_NAME}_private
_qt_package_version "${PROJECT_VERSION}"
_qt_package_name "${INSTALL_CMAKE_NAMESPACE}${target}"
_qt_is_private_module TRUE
_qt_public_module_target_name "${target}"
)
set(export_properties
"_qt_config_module_name"
"_qt_package_version"
"_qt_package_name"
"_qt_is_private_module"
"_qt_public_module_target_name"
)
set_property(TARGET "${target_private}" APPEND PROPERTY
EXPORT_PROPERTIES _qt_config_module_name)
EXPORT_PROPERTIES "${export_properties}")
endif()
if(NOT arg_HEADER_MODULE)
@ -631,6 +669,11 @@ set(QT_VISIBILITY_AVAILABLE TRUE)")
set(QT_LIBINFIX \"${QT_LIBINFIX}\")")
endif()
# Store whether find_package(Qt6Foo) should succeed if Qt6FooTools is missing.
if(QT_ALLOW_MISSING_TOOLS_PACKAGES)
string(APPEND qtcore_extra_cmake_code "
set(QT_ALLOW_MISSING_TOOLS_PACKAGES TRUE)")
endif()
endif()
configure_file("${CMAKE_CURRENT_LIST_DIR}/${INSTALL_CMAKE_NAMESPACE}${target}ConfigExtras.cmake.in"
@ -710,9 +753,8 @@ set(QT_LIBINFIX \"${QT_LIBINFIX}\")")
qt_install(DIRECTORY "${arg_EXTERNAL_HEADERS_DIR}/"
DESTINATION "${module_install_interface_include_dir}"
)
unset(public_header_destination)
else()
set(public_header_destination PUBLIC_HEADER DESTINATION "${module_install_interface_include_dir}")
get_target_property(public_header_backup ${target} PUBLIC_HEADER)
set_property(TARGET ${target} PROPERTY PUBLIC_HEADER "")
endif()
qt_install(TARGETS ${exported_targets}
@ -722,8 +764,12 @@ set(QT_LIBINFIX \"${QT_LIBINFIX}\")")
ARCHIVE DESTINATION ${INSTALL_LIBDIR}
FRAMEWORK DESTINATION ${INSTALL_LIBDIR}
PRIVATE_HEADER DESTINATION "${module_install_interface_private_include_dir}"
${public_header_destination}
)
PUBLIC_HEADER DESTINATION "${module_install_interface_include_dir}"
)
if(arg_EXTERNAL_HEADERS_DIR)
set_property(TARGET ${target} PROPERTY PUBLIC_HEADER ${public_header_backup})
unset(public_header_backup)
endif()
if(BUILD_SHARED_LIBS)
qt_apply_rpaths(TARGET "${target}" INSTALL_PATH "${INSTALL_LIBDIR}" RELATIVE_RPATH)
@ -927,7 +973,7 @@ the different base name for the module info variables.")
set("${result}_build_interface_qpa_include_dir"
"${repo_build_interface_include_dir}/${${result}_qpa_include_dir}")
# Module install interface direcotries
# Module install interface directories
set(repo_install_interface_include_dir "${INSTALL_INCLUDEDIR}")
set("${result}_install_interface_include_dir"
"${repo_install_interface_include_dir}/${${result}_include_name}")

View File

@ -26,7 +26,7 @@ function(qt_create_nolink_target target dependee_target)
add_library("${nolink_target}" INTERFACE)
set(prefixed_nolink_target "${target}_nolink")
# Whe configuring an example with qmake, if QtGui is built with Vulkan support but the
# When configuring an example with qmake, if QtGui is built with Vulkan support but the
# user's machine where Qt is installed doesn't have Vulkan, qmake doesn't fail saying
# that vulkan is not installed. Instead it silently configures and just doesn't add
# the include headers.

View File

@ -19,7 +19,8 @@ endmacro()
# Create a Qt6*.pc file intended for pkg-config consumption.
function(qt_internal_generate_pkg_config_file module)
# TODO: PkgConfig is supported under MSVC with pkgconf (github.com/pkgconf/pkgconf)
if((NOT UNIX OR QT_FEATURE_framework) AND NOT MINGW OR CMAKE_VERSION VERSION_LESS "3.20")
if((NOT UNIX OR QT_FEATURE_framework)
AND NOT MINGW OR CMAKE_VERSION VERSION_LESS "3.20" OR ANDROID)
return()
endif()
if(NOT BUILD_SHARED_LIBS)

View File

@ -19,6 +19,13 @@ function(qt_internal_setup_public_platform_target)
)
target_compile_definitions(Platform INTERFACE ${QT_PLATFORM_DEFINITIONS})
set_target_properties(Platform PROPERTIES
_qt_package_version "${PROJECT_VERSION}"
)
set_property(TARGET Platform
APPEND PROPERTY
EXPORT_PROPERTIES "_qt_package_version")
# When building on android we need to link against the logging library
# in order to satisfy linker dependencies. Both of these libraries are part of
# the NDK.
@ -34,8 +41,9 @@ function(qt_internal_setup_public_platform_target)
endif()
target_link_options(Platform INTERFACE "${libc_link_option}")
endif()
if (QT_FEATURE_no_extern_direct_access)
target_compile_options(Platform INTERFACE "-mno-direct-extern-access")
if (QT_FEATURE_no_direct_extern_access)
target_compile_options(Platform INTERFACE "$<$<CXX_COMPILER_ID:GNU>:-mno-direct-extern-access>")
target_compile_options(Platform INTERFACE "$<$<CXX_COMPILER_ID:Clang>:-fno-direct-access-external-data>")
endif()
qt_set_msvc_cplusplus_options(Platform INTERFACE)

View File

@ -2,35 +2,7 @@ set(@target@_FOUND FALSE)
# note: _third_party_deps example: "ICU\\;FALSE\\;1.0\\;i18n uc data;ZLIB\\;FALSE\\;\\;"
set(__qt_@target@_third_party_deps "@third_party_deps@")
foreach(__qt_@target@_target_dep ${__qt_@target@_third_party_deps})
list(GET __qt_@target@_target_dep 0 __qt_@target@_pkg)
list(GET __qt_@target@_target_dep 1 __qt_@target@_is_optional)
list(GET __qt_@target@_target_dep 2 __qt_@target@_version)
list(GET __qt_@target@_target_dep 3 __qt_@target@_components)
list(GET __qt_@target@_target_dep 4 __qt_@target@_optional_components)
set(__qt_@target@_find_package_args "${__qt_@target@_pkg}")
if(__qt_@target@_version)
list(APPEND __qt_@target@_find_package_args "${__qt_@target@_version}")
endif()
if(__qt_@target@_components)
string(REPLACE " " ";" __qt_@target@_components "${__qt_@target@_components}")
list(APPEND __qt_@target@_find_package_args COMPONENTS ${__qt_@target@_components})
endif()
if(__qt_@target@_optional_components)
string(REPLACE " " ";" __qt_@target@_optional_components "${__qt_@target@_optional_components}")
list(APPEND __qt_@target@_find_package_args OPTIONAL_COMPONENTS ${__qt_@target@_optional_components})
endif()
if(__qt_@target@_is_optional)
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
list(APPEND __qt_@target@_find_package_args QUIET)
endif()
find_package(${__qt_@target@_find_package_args})
else()
find_dependency(${__qt_@target@_find_package_args})
endif()
endforeach()
_qt_internal_find_third_party_dependencies("@target@" __qt_@target@_third_party_deps)
set(__qt_use_no_default_path_for_qt_packages "NO_DEFAULT_PATH")
if(QT_DISABLE_NO_DEFAULT_PATH_IN_QT_PACKAGES)
@ -40,6 +12,7 @@ endif()
# note: target_deps example: "Qt6Core\;5.12.0;Qt6Gui\;5.12.0"
set(__qt_@target@_target_deps "@target_deps@")
set(__qt_@target@_find_dependency_paths "@find_dependency_paths@")
_qt_internal_find_dependencies(__qt_@target@_target_deps __qt_@target@_find_dependency_paths)
_qt_internal_find_qt_dependencies("@target@" __qt_@target@_target_deps
__qt_@target@_find_dependency_paths)
set(@target@_FOUND TRUE)

View File

@ -117,7 +117,14 @@ function(qt_internal_add_plugin target)
endif()
endif()
qt_set_target_info_properties(${target} ${ARGN} TARGET_VERSION "${arg_VERSION}")
qt_set_target_info_properties(${target} ${ARGN})
set_target_properties(${target} PROPERTIES
_qt_package_version "${PROJECT_VERSION}"
)
set_property(TARGET ${target}
APPEND PROPERTY
EXPORT_PROPERTIES "_qt_package_version")
# Override the OUTPUT_NAME that qt6_add_plugin() set, we need to account for
# QT_LIBINFIX, which is specific to building Qt.

View File

@ -1,67 +1,6 @@
include_guard(DIRECTORY)
@QT_MODULE_PLUGIN_INCLUDES@
# Use a function to hide all the temporary variables we use so they don't leak
# out into the consuming scope
function(__qt_internal_add_static_plugins_once)
set(_module_target "@INSTALL_CMAKE_NAMESPACE@::@QT_MODULE@")
set(_qt_plugins "")
# Properties can't be set on aliased targets, so make sure to unalias the target. This is needed
# when Qt examples are built as part of the Qt build itself.
get_target_property(_aliased_target ${_module_target} ALIASED_TARGET)
if(_aliased_target)
set(_module_target ${_aliased_target})
endif()
# Include all PluginConfig.cmake files and update the _qt_plugins and QT_PLUGINS property of
# the module. The underscored version is the one we will use going forward to have compatibility
# with INTERFACE libraries. QT_PLUGINS is now deprecated and only kept so that we don't break
# existing projects using it (like CMake itself).
file(GLOB _qt_plugin_config_files "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@*PluginConfig.cmake")
foreach(_config_file ${_qt_plugin_config_files})
string(REGEX REPLACE "^.*/@INSTALL_CMAKE_NAMESPACE@(.*Plugin)Config.cmake$" "\\1" _qt_plugin "${_config_file}")
include("${_config_file}")
if(TARGET "@INSTALL_CMAKE_NAMESPACE@::${_qt_plugin}")
list(APPEND _qt_plugins ${_qt_plugin})
endif()
endforeach()
set_property(TARGET ${_module_target} PROPERTY _qt_plugins ${_qt_plugins})
# TODO: Deprecated. Remove in Qt 7.
set_property(TARGET ${_module_target} PROPERTY QT_PLUGINS ${_qt_plugins})
get_target_property(_have_added_plugins_already ${_module_target} __qt_internal_plugins_added)
if(_have_added_plugins_already)
return()
endif()
foreach(plugin_target ${_qt_plugins})
__qt_internal_plugin_get_plugin_type("${plugin_target}" __has_plugin_type __plugin_type)
if(NOT __has_plugin_type)
continue()
endif()
__qt_internal_plugin_has_class_name("${plugin_target}" __has_class_name)
if(NOT __has_class_name)
continue()
endif()
list(APPEND "QT_ALL_PLUGINS_FOUND_BY_FIND_PACKAGE_${__plugin_type}" "${plugin_target}")
__qt_internal_add_static_plugin_linkage("${plugin_target}" "${_module_target}")
__qt_internal_add_static_plugin_import_macro(
"${plugin_target}" ${_module_target} "@QT_MODULE@")
endforeach()
set("QT_ALL_PLUGINS_FOUND_BY_FIND_PACKAGE_${__plugin_type}"
"${QT_ALL_PLUGINS_FOUND_BY_FIND_PACKAGE_${__plugin_type}}"
PARENT_SCOPE
)
set_target_properties(${_module_target} PROPERTIES __qt_internal_plugins_added TRUE)
endfunction()
if(NOT @BUILD_SHARED_LIBS@ AND NOT QT_NO_CREATE_TARGETS)
__qt_internal_add_static_plugins_once()
if(NOT QT_NO_CREATE_TARGETS AND NOT QT_SKIP_AUTO_PLUGIN_INCLUSION)
__qt_internal_include_plugin_packages(@QT_MODULE@)
endif()

View File

@ -2,7 +2,7 @@ include(QtPostProcessHelpers)
qt_internal_create_depends_files()
qt_generate_build_internals_extra_cmake_code()
qt_internal_create_plugins_files()
qt_internal_create_plugins_auto_inclusion_files()
qt_internal_create_config_file_for_standalone_tests()
# Needs to run after qt_internal_create_depends_files.

View File

@ -80,11 +80,6 @@ function(qt_internal_remove_qt_dependency_duplicates out_deps deps)
if(dep)
list(FIND ${out_deps} "${dep}" dep_seen)
# If the library depends on the Private and non-Private targets,
# we only need to 'find_dependency' for one of them.
if(dep_seen EQUAL -1 AND "${dep}" MATCHES "(.+)Private\;(.+)")
list(FIND ${out_deps} "${CMAKE_MATCH_1};${CMAKE_MATCH_2}" dep_seen)
endif()
if(dep_seen EQUAL -1)
list(LENGTH dep len)
if(NOT (len EQUAL 2))
@ -209,9 +204,10 @@ function(qt_internal_create_module_depends_file target)
# Make the ModuleTool package depend on dep's ModuleTool package.
list(FIND tool_deps_seen ${dep} dep_seen)
if(dep_seen EQUAL -1 AND ${dep} IN_LIST QT_KNOWN_MODULES_WITH_TOOLS)
qt_internal_get_package_version_of_target("${dep}" dep_package_version)
list(APPEND tool_deps_seen ${dep})
list(APPEND tool_deps
"${INSTALL_CMAKE_NAMESPACE}${dep}Tools\;${PROJECT_VERSION}")
"${INSTALL_CMAKE_NAMESPACE}${dep}Tools\;${dep_package_version}")
endif()
endif()
endforeach()
@ -220,14 +216,15 @@ function(qt_internal_create_module_depends_file target)
# Add dependency to the main ModuleTool package to ModuleDependencies file.
if(${target} IN_LIST QT_KNOWN_MODULES_WITH_TOOLS)
qt_internal_get_package_version_of_target("${target}" main_module_tool_package_version)
list(APPEND main_module_tool_deps
"${INSTALL_CMAKE_NAMESPACE}${target}Tools\;${PROJECT_VERSION}")
"${INSTALL_CMAKE_NAMESPACE}${target}Tools\;${main_module_tool_package_version}")
endif()
foreach(dep ${target_deps})
if(NOT dep MATCHES ".+Private$" AND
dep MATCHES "${INSTALL_CMAKE_NAMESPACE}(.+)")
# target_deps cointains elements that are a pair of target name and version,
# target_deps contains elements that are a pair of target name and version,
# e.g. 'Core\;6.2'
# After the extracting from the target_deps list, the element becomes a list itself,
# because it loses escape symbol before the semicolon, so ${CMAKE_MATCH_1} is the list:
@ -259,6 +256,10 @@ function(qt_internal_create_module_depends_file target)
qt_path_join(config_build_dir ${QT_CONFIG_BUILD_DIR} ${path_suffix})
qt_path_join(config_install_dir ${QT_CONFIG_INSTALL_DIR} ${path_suffix})
# All module packages should look for the Qt6 package version that qtbase was originally
# built as.
qt_internal_get_package_version_of_target(Platform main_qt_package_version)
# Configure and install ModuleDependencies file.
configure_file(
"${QT_CMAKE_DIR}/QtModuleDependencies.cmake.in"
@ -272,6 +273,9 @@ function(qt_internal_create_module_depends_file target)
COMPONENT Devel
)
message(TRACE "Recorded dependencies for module: ${target}\n"
" Qt dependencies: ${target_deps}\n"
" 3rd-party dependencies: ${third_party_deps}")
endif()
if(tool_deps)
# The value of the property will be used by qt_export_tools.
@ -287,6 +291,13 @@ function(qt_internal_create_plugin_depends_file target)
unset(optional_public_depends)
set(target_deps_seen "")
# Extra 3rd party targets who's packages should be considered dependencies.
get_target_property(extra_third_party_deps "${target}" _qt_extra_third_party_dep_targets)
if(NOT extra_third_party_deps)
set(extra_third_party_deps "")
endif()
qt_collect_third_party_deps(${target})
qt_internal_remove_qt_dependency_duplicates(target_deps "${target_deps}")
@ -323,6 +334,10 @@ function(qt_internal_create_plugin_depends_file target)
DESTINATION "${config_install_dir}"
COMPONENT Devel
)
message(TRACE "Recorded dependencies for plugin: ${target}\n"
" Qt dependencies: ${target_deps}\n"
" 3rd-party dependencies: ${third_party_deps}")
endif()
endfunction()
@ -349,7 +364,17 @@ function(qt_internal_create_qt6_dependencies_file)
endif()")
endif()
if(third_party_deps)
_qt_internal_determine_if_host_info_package_needed(platform_requires_host_info_package)
if(platform_requires_host_info_package)
# TODO: Figure out how to make the initial QT_HOST_PATH var relocatable in relation
# to the target CMAKE_INSTALL_DIR, if at all possible to do so in a reliable way.
get_filename_component(qt_host_path_absolute "${QT_HOST_PATH}" ABSOLUTE)
get_filename_component(qt_host_path_cmake_dir_absolute
"${Qt${PROJECT_VERSION_MAJOR}HostInfo_DIR}/.." ABSOLUTE)
endif()
if(third_party_deps OR platform_requires_host_info_package)
# Setup build and install paths.
set(path_suffix "${INSTALL_CMAKE_NAMESPACE}")
@ -388,17 +413,14 @@ function(qt_internal_create_depends_files)
endforeach()
endfunction()
# This function creates the Qt<Module>Plugins.cmake used to list all
# the plug-in target files.
function(qt_internal_create_plugins_files)
# The plugins cmake configuration is only needed for static builds. Dynamic builds don't need
# the application to link against plugins at build time.
if(QT_BUILD_SHARED_LIBS)
return()
endif()
# This function creates Qt<Module>Plugins.cmake files used to include all
# the plugin Config files that belong to that module.
function(qt_internal_create_plugins_auto_inclusion_files)
# For static library builds, the plugin targets need to be available for linking.
# For shared library builds, the plugin targets are useful for deployment purposes.
qt_internal_get_qt_repo_known_modules(repo_known_modules)
message("Generating Plugins files for ${repo_known_modules}...")
set(modules_with_plugins "")
foreach (QT_MODULE ${repo_known_modules})
get_target_property(target_type "${QT_MODULE}" TYPE)
if(target_type STREQUAL "INTERFACE_LIBRARY")
@ -428,9 +450,9 @@ if (__qt_qml_plugins_config_file_list AND NOT QT_SKIP_AUTO_QML_PLUGIN_INCLUSION)
foreach(__qt_qml_plugin_config_file \${__qt_qml_plugins_config_file_list})
include(\${__qt_qml_plugin_config_file})
# Temporarily unset any failure markers.
# Temporarily unset any failure markers and mark the Qml package as found.
unset(\${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE)
unset(\${CMAKE_FIND_PACKAGE_NAME}_FOUND)
set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND TRUE)
endforeach()
# For the second round of inclusions, check and bail out early if there are errors.
@ -450,6 +472,7 @@ endif()")
get_target_property(qt_plugins "${QT_MODULE}" QT_PLUGINS)
if(qt_plugins OR QT_MODULE_PLUGIN_INCLUDES)
list(APPEND modules_with_plugins "${QT_MODULE}")
configure_file(
"${QT_CMAKE_DIR}/QtPlugins.cmake.in"
"${config_build_dir}/${INSTALL_CMAKE_NAMESPACE}${QT_MODULE}Plugins.cmake"
@ -462,6 +485,10 @@ endif()")
)
endif()
endforeach()
if(modules_with_plugins)
message(STATUS "Generated QtModulePlugins.cmake files for the following modules:"
" ${modules_with_plugins}")
endif()
endfunction()
function(qt_generate_install_prefixes out_var)
@ -679,18 +706,16 @@ endif()\n")
string(APPEND QT_EXTRA_BUILD_INTERNALS_VARS "${install_prefix_content}")
if(NOT BUILD_SHARED_LIBS)
# The top-level check needs to happen inside QtBuildInternals, because it's possible
# to configure a top-level build with a few repos and then configure another repo
# using qt-configure-module in a separate build dir, where QT_SUPERBUILD will not
# be set anymore.
string(APPEND QT_EXTRA_BUILD_INTERNALS_VARS
"
# The top-level check needs to happen inside QtBuildInternals, because it's possible
# to configure a top-level build with a few repos and then configure another repo
# using qt-configure-module in a separate build dir, where QT_SUPERBUILD will not
# be set anymore.
string(APPEND QT_EXTRA_BUILD_INTERNALS_VARS
"
if(DEFINED QT_REPO_MODULE_VERSION AND NOT DEFINED QT_REPO_DEPENDENCIES AND NOT QT_SUPERBUILD)
qt_internal_read_repo_dependencies(QT_REPO_DEPENDENCIES \"$\{PROJECT_SOURCE_DIR}\")
endif()
")
endif()
if(DEFINED OpenGL_GL_PREFERENCE)
string(APPEND QT_EXTRA_BUILD_INTERNALS_VARS
@ -764,9 +789,13 @@ function(qt_internal_create_config_file_for_standalone_tests)
return()
endif()
# Ceate a Config file that calls find_package on the modules that were built as part
# Create a Config file that calls find_package on the modules that were built as part
# of the current repo. This is used for standalone tests.
qt_internal_get_standalone_tests_config_file_name(tests_config_file_name)
# Standalone tests Config files should follow the main versioning scheme.
qt_internal_get_package_version_of_target(Platform main_qt_package_version)
configure_file(
"${QT_CMAKE_DIR}/QtStandaloneTestsConfig.cmake.in"
"${config_build_dir}/${tests_config_file_name}"

View File

@ -532,12 +532,15 @@ QT.${config_module_name}_private.disabled_features = ${disabled_private_features
"-DIMPLICIT_LINK_DIRECTORIES=${implicit_link_directories}"
-P "${QT_CMAKE_DIR}/QtGenerateLibPri.cmake"
VERBATIM)
add_custom_target(${target}_lib_pri DEPENDS "${private_pri_file_path}")
# add_dependencies has no effect when adding interface libraries. So need to add the
# '_lib_pri' targets to ALL to make sure that the related rules executed.
unset(add_pri_target_to_all)
if(arg_HEADER_MODULE)
add_dependencies(${target}_timestamp ${target}_lib_pri)
else()
add_dependencies(${target} ${target}_lib_pri)
set(add_pri_target_to_all ALL)
endif()
add_custom_target(${target}_lib_pri ${add_pri_target_to_all}
DEPENDS "${private_pri_file_path}")
add_dependencies(${target} ${target}_lib_pri)
endif()
qt_install(FILES "${pri_files}" DESTINATION ${INSTALL_MKSPECSDIR}/modules)

View File

@ -139,6 +139,18 @@ ${prl_step1_content_libs}
"${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_LIBDIR}")
endif()
set(qt_plugin_dirs "${QT_BUILD_DIR}/${INSTALL_PLUGINSDIR}")
if(QT_WILL_INSTALL)
list(APPEND qt_plugin_dirs
"${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_PLUGINSDIR}")
endif()
set(qt_qml_dirs "${QT_BUILD_DIR}/${INSTALL_QMLDIR}")
if(QT_WILL_INSTALL)
list(APPEND qt_qml_dirs
"${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_QMLDIR}")
endif()
foreach(config ${configs})
# Output file for dependency tracking, and which will contain the final content.
qt_path_join(prl_step2_path
@ -173,6 +185,8 @@ ${prl_step1_content_libs}
"-DLIBRARY_SUFFIXES=${library_suffixes}"
"-DLINK_LIBRARY_FLAG=${link_library_flag}"
"-DQT_LIB_DIRS=${qt_lib_dirs}"
"-DQT_PLUGIN_DIRS=${qt_plugin_dirs}"
"-DQT_QML_DIRS=${qt_qml_dirs}"
"-DIMPLICIT_LINK_DIRECTORIES=${implicit_link_directories}"
-P "${QT_CMAKE_DIR}/QtFinishPrlFile.cmake"
VERBATIM

View File

@ -0,0 +1,641 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
function(_qt_internal_handle_ios_launch_screen target)
# Check if user provided a launch screen path via a variable.
set(launch_screen "")
# Check if the project provided a launch screen path via a variable.
# This variable is currently in Technical Preview.
if(QT_IOS_LAUNCH_SCREEN)
set(launch_screen "${QT_IOS_LAUNCH_SCREEN}")
endif()
# Check if the project provided a launch screen path via a target property, it takes precedence
# over the variable.
# This property is currently in Technical Preview.
get_target_property(launch_screen_from_prop "${target}" QT_IOS_LAUNCH_SCREEN)
if(launch_screen_from_prop)
set(launch_screen "${launch_screen_from_prop}")
endif()
# If the project hasn't provided a launch screen file path, use a copy of the template
# that qmake uses.
# It needs to be a copy because configure_file can't handle all the escaped double quotes
# present in the qmake template file.
set(is_default_launch_screen FALSE)
if(NOT launch_screen AND NOT QT_NO_SET_DEFAULT_IOS_LAUNCH_SCREEN)
set(is_default_launch_screen TRUE)
set(launch_screen
"${__qt_internal_cmake_ios_support_files_path}/LaunchScreen.storyboard")
endif()
# Check that the launch screen exists.
if(launch_screen)
if(NOT IS_ABSOLUTE "${launch_screen}")
message(FATAL_ERROR
"Provided launch screen value should be an absolute path: '${launch_screen}'")
endif()
if(NOT EXISTS "${launch_screen}")
message(FATAL_ERROR
"Provided launch screen file does not exist: '${launch_screen}'")
endif()
endif()
if(launch_screen AND NOT QT_NO_ADD_IOS_LAUNCH_SCREEN_TO_BUNDLE)
get_filename_component(launch_screen_name "${launch_screen}" NAME)
# Make a copy of the default launch screen template for this target and replace the
# label inside the template with the target name.
if(is_default_launch_screen)
# Configure our default template and place it in the build dir.
set(launch_screen_in_path "${launch_screen}")
string(MAKE_C_IDENTIFIER "${target}" target_identifier)
set(launch_screen_out_dir
"${CMAKE_CURRENT_BINARY_DIR}/.qt/launch_screen_storyboards/${target_identifier}")
set(launch_screen_out_path
"${launch_screen_out_dir}/${launch_screen_name}")
file(MAKE_DIRECTORY "${launch_screen_out_dir}")
# Replaces the value in the default template.
set(QT_IOS_LAUNCH_SCREEN_TEXT "${target}")
configure_file(
"${launch_screen_in_path}"
"${launch_screen_out_path}"
@ONLY
)
set(final_launch_screen_path "${launch_screen_out_path}")
else()
set(final_launch_screen_path "${launch_screen}")
endif()
# Add the launch screen storyboard file as a source file, otherwise CMake doesn't consider
# it as a resource file and MACOSX_PACKAGE_LOCATION processing will be skipped.
target_sources("${target}" PRIVATE "${final_launch_screen_path}")
# Ensure Xcode compiles the storyboard file and installs the compiled storyboard .nib files
# into the app bundle.
# We use target_sources and the MACOSX_PACKAGE_LOCATION source file property for that
# instead of the RESOURCE target property, becaues the latter could potentially end up
# needlessly installing the source storyboard file.
#
# We can't rely on policy CMP0118 since user project controls it.
set(scope_args)
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.18")
set(scope_args TARGET_DIRECTORY ${target})
endif()
set_source_files_properties("${final_launch_screen_path}" ${scope_args}
PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
# Save the launch screen name, so its value is added as an UILaunchStoryboardName entry
# in the Qt generated Info.plist file.
# Xcode expects an Info.plist storyboard entry without an extension.
get_filename_component(launch_screen_base_name "${launch_screen}" NAME_WE)
set_target_properties("${target}" PROPERTIES
_qt_ios_launch_screen_name "${launch_screen_name}"
_qt_ios_launch_screen_base_name "${launch_screen_base_name}"
_qt_ios_launch_screen_path "${final_launch_screen_path}")
endif()
endfunction()
function(_qt_internal_find_ios_development_team_id out_var)
get_property(team_id GLOBAL PROPERTY _qt_internal_ios_development_team_id)
get_property(team_id_computed GLOBAL PROPERTY _qt_internal_ios_development_team_id_computed)
if(team_id_computed)
# Just in case if the value is non-empty but still booly FALSE.
if(NOT team_id)
set(team_id "")
endif()
set("${out_var}" "${team_id}" PARENT_SCOPE)
return()
endif()
set_property(GLOBAL PROPERTY _qt_internal_ios_development_team_id_computed "TRUE")
set(home_dir "$ENV{HOME}")
set(xcode_preferences_path "${home_dir}/Library/Preferences/com.apple.dt.Xcode.plist")
# Extract the first account name (email) from the user's Xcode preferences
message(DEBUG "Trying to extract an Xcode development team id from '${xcode_preferences_path}'")
execute_process(COMMAND "/usr/libexec/PlistBuddy"
-x -c "print IDEProvisioningTeams" "${xcode_preferences_path}"
OUTPUT_VARIABLE teams_xml
ERROR_VARIABLE plist_error)
# Parsing state.
set(is_free "")
set(current_team_id "")
set(parsing_is_free FALSE)
set(parsing_team_id FALSE)
set(first_team_id "")
# Parse the xml output and return the first encountered non-free team id. If no non-free team id
# is found, return the first encountered free team id.
# If no team is found, return an empty string.
#
# Example input:
#<plist version="1.0">
#<dict>
# <key>marty@planet.local</key>
# <array>
# <dict>
# <key>isFreeProvisioningTeam</key>
# <false/>
# <key>teamID</key>
# <string>AAA</string>
# ...
# </dict>
# <dict>
# <key>isFreeProvisioningTeam</key>
# <true/>
# <key>teamID</key>
# <string>BBB</string>
# ...
# </dict>
# </array>
#</dict>
#</plist>
if(teams_xml AND NOT plist_error)
string(REPLACE "\n" ";" teams_xml_lines "${teams_xml}")
foreach(xml_line ${teams_xml_lines})
string(STRIP "${xml_line}" xml_line)
if(xml_line STREQUAL "<dict>")
# Clean any previously found values when a new team dict is matched.
set(is_free "")
set(current_team_id "")
elseif(xml_line STREQUAL "<key>isFreeProvisioningTeam</key>")
set(parsing_is_free TRUE)
elseif(parsing_is_free)
set(parsing_is_free FALSE)
if(xml_line MATCHES "true")
set(is_free TRUE)
else()
set(is_free FALSE)
endif()
elseif(xml_line STREQUAL "<key>teamID</key>")
set(parsing_team_id TRUE)
elseif(parsing_team_id)
set(parsing_team_id FALSE)
if(xml_line MATCHES "<string>([^<]+)</string>")
set(current_team_id "${CMAKE_MATCH_1}")
else()
continue()
endif()
string(STRIP "${current_team_id}" current_team_id)
# If this is the first team id we found so far, remember that, regardless if's free
# or not.
if(NOT first_team_id AND current_team_id)
set(first_team_id "${current_team_id}")
endif()
# Break early if we found a non-free team id and use it, because we prefer
# a non-free team for signing, just like qmake.
if(NOT is_free AND current_team_id)
set(first_team_id "${current_team_id}")
break()
endif()
endif()
endforeach()
endif()
if(NOT first_team_id)
message(DEBUG "Failed to extract an Xcode development team id.")
set("${out_var}" "" PARENT_SCOPE)
else()
message(DEBUG "Successfully extracted the first encountered Xcode development team id.")
set_property(GLOBAL PROPERTY _qt_internal_ios_development_team_id "${first_team_id}")
set("${out_var}" "${first_team_id}" PARENT_SCOPE)
endif()
endfunction()
function(_qt_internal_get_ios_bundle_identifier_prefix out_var)
get_property(prefix GLOBAL PROPERTY _qt_internal_ios_bundle_identifier_prefix)
get_property(prefix_computed GLOBAL PROPERTY
_qt_internal_ios_bundle_identifier_prefix_computed)
if(prefix_computed)
# Just in case if the value is non-empty but still booly FALSE.
if(NOT prefix)
set(prefix "")
endif()
set("${out_var}" "${prefix}" PARENT_SCOPE)
return()
endif()
set_property(GLOBAL PROPERTY _qt_internal_ios_bundle_identifier_prefix_computed "TRUE")
set(home_dir "$ENV{HOME}")
set(xcode_preferences_path "${home_dir}/Library/Preferences/com.apple.dt.Xcode.plist")
message(DEBUG "Trying to extract the default bundle identifier prefix from Xcode preferences.")
execute_process(COMMAND "/usr/libexec/PlistBuddy"
-c "print IDETemplateOptions:bundleIdentifierPrefix"
"${xcode_preferences_path}"
OUTPUT_VARIABLE prefix
ERROR_VARIABLE prefix_error)
if(prefix AND NOT prefix_error)
message(DEBUG "Successfully extracted the default bundle identifier prefix.")
string(STRIP "${prefix}" prefix)
else()
message(DEBUG "Failed to extract the default bundle identifier prefix.")
endif()
if(prefix AND NOT prefix_error)
set_property(GLOBAL PROPERTY _qt_internal_ios_bundle_identifier_prefix "${prefix}")
set("${out_var}" "${prefix}" PARENT_SCOPE)
else()
set("${out_var}" "" PARENT_SCOPE)
endif()
endfunction()
function(_qt_internal_escape_rfc_1034_identifier value out_var)
# According to https://datatracker.ietf.org/doc/html/rfc1034#section-3.5
# we can only use letters, digits, dot (.) and hyphens (-).
# Underscores are not allowed.
string(REGEX REPLACE "[^A-Za-z0-9.]" "-" value "${value}")
set("${out_var}" "${value}" PARENT_SCOPE)
endfunction()
function(_qt_internal_get_default_ios_bundle_identifier out_var)
_qt_internal_get_ios_bundle_identifier_prefix(prefix)
if(NOT prefix)
set(prefix "com.yourcompany")
# For a better out-of-the-box experience, try to create a unique prefix by appending
# the sha1 of the team id, if one is found.
_qt_internal_find_ios_development_team_id(team_id)
if(team_id)
string(SHA1 hash "${team_id}")
string(SUBSTRING "${hash}" 0 8 infix)
string(APPEND prefix ".${infix}")
else()
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 "
"XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER property."
)
endif()
endif()
# Escape the prefix according to rfc 1034, it's important for code-signing. If an invalid
# identifier is used, calling xcodebuild on the command line says that no provisioning profile
# could be found, with no additional error message. If one opens the generated project with
# Xcode and clicks on 'Try again' to get a new profile, it shows a semi-useful error message
# that the identifier is invalid.
_qt_internal_escape_rfc_1034_identifier("${prefix}" prefix)
set(identifier "${prefix}.\${PRODUCT_NAME:rfc1034identifier}")
set("${out_var}" "${identifier}" PARENT_SCOPE)
endfunction()
function(_qt_internal_set_placeholder_apple_bundle_version target)
# If user hasn't provided neither a bundle version nor a bundle short version string for the
# app, set a placeholder value for both which will add them to the generated Info.plist file.
# This is required so that the app launches in the simulator (but apparently not for running
# on-device).
get_target_property(bundle_version "${target}" MACOSX_BUNDLE_BUNDLE_VERSION)
get_target_property(bundle_short_version "${target}" MACOSX_BUNDLE_SHORT_VERSION_STRING)
if(NOT MACOSX_BUNDLE_BUNDLE_VERSION AND
NOT MACOSX_BUNDLE_SHORT_VERSION_STRING AND
NOT bundle_version AND
NOT bundle_short_version AND
NOT QT_NO_SET_XCODE_BUNDLE_VERSION
)
get_target_property(version "${target}" VERSION)
if(NOT version)
set(version "${PROJECT_VERSION}")
if(NOT version)
set(version "1.0.0")
endif()
endif()
# Use x.y for short version and x.y.z for full version
# Any versions longer than this will fail App Store
# submission.
string(REPLACE "." ";" version_list ${version})
list(LENGTH version_list version_list_length)
list(GET version_list 0 version_major)
set(bundle_short_version "${version_major}")
if(version_list_length GREATER 1)
list(GET version_list 1 version_minor)
string(APPEND bundle_short_version ".${version_minor}")
endif()
set(bundle_version "${bundle_short_version}")
if(version_list_length GREATER 2)
list(GET version_list 2 version_patch)
string(APPEND bundle_version ".${version_patch}")
endif()
if(NOT CMAKE_XCODE_ATTRIBUTE_MARKETING_VERSION
AND NOT QT_NO_SET_XCODE_ATTRIBUTE_MARKETING_VERSION
AND NOT CMAKE_XCODE_ATTRIBUTE_CURRENT_PROJECT_VERSION
AND NOT QT_NO_SET_XCODE_ATTRIBUTE_CURRENT_PROJECT_VERSION
AND CMAKE_GENERATOR STREQUAL "Xcode")
get_target_property(marketing_version "${target}"
XCODE_ATTRIBUTE_MARKETING_VERSION)
get_target_property(current_project_version "${target}"
XCODE_ATTRIBUTE_CURRENT_PROJECT_VERSION)
if(NOT marketing_version AND NOT current_project_version)
set_target_properties("${target}"
PROPERTIES
XCODE_ATTRIBUTE_CURRENT_PROJECT_VERSION "${bundle_version}"
XCODE_ATTRIBUTE_MARKETING_VERSION "${bundle_short_version}"
)
set(bundle_version "$(CURRENT_PROJECT_VERSION)")
set(bundle_short_version "$(MARKETING_VERSION)")
endif()
endif()
set_target_properties("${target}"
PROPERTIES
MACOSX_BUNDLE_BUNDLE_VERSION "${bundle_version}"
MACOSX_BUNDLE_SHORT_VERSION_STRING "${bundle_short_version}"
)
endif()
endfunction()
function(_qt_internal_set_xcode_development_team_id target)
# If user hasn't provided a development team id, try to find the first one specified
# in the Xcode preferences.
if(NOT CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM AND NOT QT_NO_SET_XCODE_DEVELOPMENT_TEAM_ID)
get_target_property(existing_team_id "${target}" XCODE_ATTRIBUTE_DEVELOPMENT_TEAM)
if(NOT existing_team_id)
_qt_internal_find_ios_development_team_id(team_id)
set_target_properties("${target}"
PROPERTIES XCODE_ATTRIBUTE_DEVELOPMENT_TEAM "${team_id}")
endif()
endif()
endfunction()
function(_qt_internal_set_xcode_bundle_identifier target)
# Skip all logic if requested.
if(QT_NO_SET_XCODE_BUNDLE_IDENTIFIER)
return()
endif()
# There are two fields to consider: the CFBundleIdentifier key (CFBI) to be written to
# Info.plist
# and the PRODUCT_BUNDLE_IDENTIFIER (PBI) property to set in the Xcode project.
# The following logic enables the best out-of-the-box experience combined with maximum
# customization.
# 1) If values for both fields are not provided, assign ${PRODUCT_BUNDLE_IDENTIFIER} to CFBI
# (which is expanded by xcodebuild at build time and will use the value of PBI) and
# auto-compute a default PBI from Xcode's ${PRODUCT_NAME}.
# 2) If CFBI is set and PBI isn't, use given CFBI and keep PBI empty.
# 3) If PBI is set and CFBI isn't, assign ${PRODUCT_BUNDLE_IDENTIFIER} to CFBI and use
# the given PBI.
# 4) If both are set, use both given values.
# TLDR:
# cfbi pbi -> result_cfbi result_pbi
# unset unset computed computed
# set unset given_val unset
# unset set computed given_val
# set set given_val given_val
get_target_property(existing_cfbi "${target}" MACOSX_BUNDLE_GUI_IDENTIFIER)
if(NOT MACOSX_BUNDLE_GUI_IDENTIFIER AND NOT existing_cfbi)
set(is_cfbi_given FALSE)
else()
set(is_cfbi_given TRUE)
endif()
if(NOT is_cfbi_given)
set_target_properties("${target}"
PROPERTIES
MACOSX_BUNDLE_GUI_IDENTIFIER "\${PRODUCT_BUNDLE_IDENTIFIER}")
endif()
get_target_property(existing_pbi "${target}" XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER)
if(NOT CMAKE_XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER AND NOT existing_pbi)
set(is_pbi_given FALSE)
else()
set(is_pbi_given TRUE)
endif()
if(NOT is_pbi_given AND NOT is_cfbi_given)
_qt_internal_get_default_ios_bundle_identifier(bundle_id)
set_target_properties("${target}"
PROPERTIES
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "${bundle_id}")
endif()
endfunction()
function(_qt_internal_set_xcode_targeted_device_family target)
if(NOT CMAKE_XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY
AND NOT QT_NO_SET_XCODE_TARGETED_DEVICE_FAMILY)
get_target_property(existing_device_family
"${target}" XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY)
if(NOT existing_device_family)
set(device_family_iphone_and_ipad "1,2")
set_target_properties("${target}"
PROPERTIES
XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY
"${device_family_iphone_and_ipad}")
endif()
endif()
endfunction()
function(_qt_internal_set_xcode_code_sign_style target)
if(NOT CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_STYLE
AND NOT QT_NO_SET_XCODE_CODE_SIGN_STYLE)
get_target_property(existing_code_style
"${target}" XCODE_ATTRIBUTE_CODE_SIGN_STYLE)
if(NOT existing_code_style)
set(existing_code_style "Automatic")
set_target_properties("${target}"
PROPERTIES
XCODE_ATTRIBUTE_CODE_SIGN_STYLE
"${existing_code_style}")
endif()
endif()
endfunction()
# Workaround for https://gitlab.kitware.com/cmake/cmake/-/issues/15183
function(_qt_internal_set_xcode_install_path target)
if(NOT CMAKE_XCODE_ATTRIBUTE_INSTALL_PATH
AND NOT QT_NO_SET_XCODE_INSTALL_PATH)
get_target_property(existing_install_path
"${target}" XCODE_ATTRIBUTE_INSTALL_PATH)
if(NOT existing_install_path)
set_target_properties("${target}"
PROPERTIES
XCODE_ATTRIBUTE_INSTALL_PATH
"$(inherited)")
endif()
endif()
endfunction()
function(_qt_internal_set_xcode_bundle_display_name target)
# We want the value of CFBundleDisplayName to be ${PRODUCT_NAME}, but we can't put that
# into the Info.plist.in template file directly, because the implicit configure_file(Info.plist)
# done by CMake is not using the @ONLY option, so CMake would treat the assignment as
# variable expansion. Escaping using backslashes does not help.
# Work around it by assigning the dollar char to a separate cache var, and expand it, so that
# the final value in the file will be ${PRODUCT_NAME}, to be evaluated at build time by Xcode.
set(QT_INTERNAL_DOLLAR_VAR "$" CACHE STRING "")
endfunction()
# Adds ${PRODUCT_NAME} to the Info.plist file, which is then evaluated by Xcode itself.
function(_qt_internal_set_xcode_bundle_name target)
if(QT_NO_SET_XCODE_BUNDLE_NAME)
return()
endif()
get_target_property(existing_bundle_name "${target}" MACOSX_BUNDLE_BUNDLE_NAME)
if(NOT MACOSX_BUNDLE_BUNDLE_NAME AND NOT existing_bundle_name)
if(CMAKE_GENERATOR STREQUAL Xcode)
set_target_properties("${target}"
PROPERTIES
MACOSX_BUNDLE_BUNDLE_NAME "\${PRODUCT_NAME}")
else()
set_target_properties("${target}"
PROPERTIES
MACOSX_BUNDLE_BUNDLE_NAME "${target}")
endif()
endif()
endfunction()
function(_qt_internal_set_xcode_bitcode_enablement target)
if(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE
OR QT_NO_SET_XCODE_ENABLE_BITCODE)
return()
endif()
get_target_property(existing_bitcode_enablement
"${target}" XCODE_ATTRIBUTE_ENABLE_BITCODE)
if(NOT existing_bitcode_enablement MATCHES "-NOTFOUND")
return()
endif()
# Disable bitcode to match Xcode 14's new default
set_target_properties("${target}"
PROPERTIES
XCODE_ATTRIBUTE_ENABLE_BITCODE
"NO")
endfunction()
function(_qt_internal_generate_ios_info_plist target)
# If the project already specifies a custom file, we don't override it.
get_target_property(existing_plist "${target}" MACOSX_BUNDLE_INFO_PLIST)
if(existing_plist)
return()
endif()
set(info_plist_in "${__qt_internal_cmake_ios_support_files_path}/Info.plist.app.in")
string(MAKE_C_IDENTIFIER "${target}" target_identifier)
set(info_plist_out_dir
"${CMAKE_CURRENT_BINARY_DIR}/.qt/info_plist/${target_identifier}")
set(info_plist_out "${info_plist_out_dir}/Info.plist")
# Check if we need to specify a custom launch screen storyboard entry.
get_target_property(launch_screen_base_name "${target}" _qt_ios_launch_screen_base_name)
if(launch_screen_base_name)
set(qt_ios_launch_screen_plist_entry "${launch_screen_base_name}")
endif()
# Call configure_file to substitute Qt-specific @FOO@ values, not ${FOO} values.
#
# The output file will be another template file to be fed to CMake via the
# MACOSX_BUNDLE_INFO_PLIST property. CMake will then call configure_file on it to provide
# content for regular entries like CFBundleName, etc.
#
# We require this extra configure_file call so we can create unique Info.plist files for each
# target in a project, while also providing a way to add Qt specific entries that CMake
# does not support out of the box (e.g. a launch screen name).
configure_file(
"${info_plist_in}"
"${info_plist_out}"
@ONLY
)
set_target_properties("${target}" PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${info_plist_out}")
endfunction()
function(_qt_internal_set_ios_simulator_arch target)
if(CMAKE_XCODE_ATTRIBUTE_ARCHS
OR QT_NO_SET_XCODE_ARCHS)
return()
endif()
get_target_property(existing_archs
"${target}" XCODE_ATTRIBUTE_ARCHS)
if(NOT existing_archs MATCHES "-NOTFOUND")
return()
endif()
if(NOT x86_64 IN_LIST QT_OSX_ARCHITECTURES)
return()
endif()
if(CMAKE_OSX_ARCHITECTURES AND NOT x86_64 IN_LIST CMAKE_OSX_ARCHITECTURES)
return()
endif()
set_target_properties("${target}"
PROPERTIES
"XCODE_ATTRIBUTE_ARCHS[sdk=iphonesimulator*]"
"x86_64")
endfunction()
function(_qt_internal_finalize_apple_app target)
# Shared between macOS and iOS apps
# Only set the various properties if targeting the Xcode generator, otherwise the various
# Xcode tokens are embedded as-is instead of being dynamically evaluated.
# This affects things like the version number or application name as reported by Qt API.
if(CMAKE_GENERATOR STREQUAL "Xcode")
_qt_internal_set_xcode_development_team_id("${target}")
_qt_internal_set_xcode_bundle_identifier("${target}")
_qt_internal_set_xcode_code_sign_style("${target}")
_qt_internal_set_xcode_bundle_display_name("${target}")
_qt_internal_set_xcode_install_path("${target}")
endif()
_qt_internal_set_xcode_bundle_name("${target}")
_qt_internal_set_placeholder_apple_bundle_version("${target}")
endfunction()
function(_qt_internal_finalize_ios_app target)
_qt_internal_finalize_apple_app("${target}")
_qt_internal_set_xcode_targeted_device_family("${target}")
_qt_internal_set_xcode_bitcode_enablement("${target}")
_qt_internal_handle_ios_launch_screen("${target}")
_qt_internal_generate_ios_info_plist("${target}")
_qt_internal_set_ios_simulator_arch("${target}")
endfunction()
function(_qt_internal_finalize_macos_app target)
get_target_property(is_bundle ${target} MACOSX_BUNDLE)
if(NOT is_bundle)
return()
endif()
_qt_internal_finalize_apple_app("${target}")
# Make sure the install rpath has at least the minimum needed if the app
# has any non-static frameworks. We can't rigorously know if the app will
# have any, even with a static Qt, so always add this. If there are no
# frameworks, it won't do any harm.
get_property(install_rpath TARGET ${target} PROPERTY INSTALL_RPATH)
list(APPEND install_rpath "@executable_path/../Frameworks")
list(REMOVE_DUPLICATES install_rpath)
set_property(TARGET ${target} PROPERTY INSTALL_RPATH "${install_rpath}")
endfunction()

View File

@ -32,3 +32,59 @@ function(_qt_internal_check_depfile_support out_var)
endif()
set(${out_var} "${${out_var}}" PARENT_SCOPE)
endfunction()
# Collect additional package prefix paths to look for Qt packages, both from command line and the
# env variable ${prefixes_var}. The result is stored in ${out_var} and is a list of paths ending
# with "/lib/cmake".
function(__qt_internal_collect_additional_prefix_paths out_var prefixes_var)
if(DEFINED "${out_var}")
return()
endif()
set(additional_packages_prefix_paths "")
set(additional_packages_prefixes "")
if(${prefixes_var})
list(APPEND additional_packages_prefixes ${${prefixes_var}})
endif()
if(DEFINED ENV{${prefixes_var}}
AND NOT "$ENV{${prefixes_var}}" STREQUAL "")
set(prefixes_from_env "$ENV{${prefixes_var}}")
if(NOT CMAKE_HOST_WIN32)
string(REPLACE ":" ";" prefixes_from_env "${prefixes_from_env}")
endif()
list(APPEND additional_packages_prefixes ${prefixes_from_env})
endif()
foreach(additional_path IN LISTS additional_packages_prefixes)
file(TO_CMAKE_PATH "${additional_path}" additional_path)
# The prefix paths need to end with lib/cmake to ensure the packages are found when
# cross compiling. Search for REROOT_PATH_ISSUE_MARKER in the qt.toolchain.cmake file for
# details.
# We must pass the values via the PATHS options because the main find_package call uses
# NO_DEFAULT_PATH, and thus CMAKE_PREFIX_PATH values are discarded.
# CMAKE_FIND_ROOT_PATH values are not discarded and togegher with the PATHS option, it
# ensures packages from additional prefixes are found.
if(NOT additional_path MATCHES "/lib/cmake$")
string(APPEND additional_path "/lib/cmake")
endif()
list(APPEND additional_packages_prefix_paths "${additional_path}")
endforeach()
set("${out_var}" "${additional_packages_prefix_paths}" PARENT_SCOPE)
endfunction()
# Take a list of prefix paths ending with "/lib/cmake", and return a list of absolute paths with
# "/lib/cmake" removed.
function(__qt_internal_prefix_paths_to_roots out_var prefix_paths)
set(result "")
foreach(path IN LISTS prefix_paths)
if(path MATCHES "/lib/cmake$")
string(APPEND path "/../..")
endif()
get_filename_component(path "${path}" ABSOLUTE)
list(APPEND result "${path}")
endforeach()
set("${out_var}" "${result}" PARENT_SCOPE)
endfunction()

View File

@ -1,19 +1,113 @@
# Note that target_dep_list does not accept a list of values, but a var name that contains the
# list of dependencies. See foreach block for reference.
macro(_qt_internal_find_third_party_dependencies target target_dep_list)
foreach(__qt_${target}_target_dep IN LISTS ${target_dep_list})
list(GET __qt_${target}_target_dep 0 __qt_${target}_pkg)
list(GET __qt_${target}_target_dep 1 __qt_${target}_is_optional)
list(GET __qt_${target}_target_dep 2 __qt_${target}_version)
list(GET __qt_${target}_target_dep 3 __qt_${target}_components)
list(GET __qt_${target}_target_dep 4 __qt_${target}_optional_components)
set(__qt_${target}_find_package_args "${__qt_${target}_pkg}")
if(__qt_${target}_version)
list(APPEND __qt_${target}_find_package_args "${__qt_${target}_version}")
endif()
if(__qt_${target}_components)
string(REPLACE " " ";" __qt_${target}_components "${__qt_${target}_components}")
list(APPEND __qt_${target}_find_package_args COMPONENTS ${__qt_${target}_components})
endif()
if(__qt_${target}_optional_components)
string(REPLACE " " ";"
__qt_${target}_optional_components "${__qt_${target}_optional_components}")
list(APPEND __qt_${target}_find_package_args
OPTIONAL_COMPONENTS ${__qt_${target}_optional_components})
endif()
_qt_internal_save_find_package_context_for_debugging(${target})
if(__qt_${target}_is_optional)
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
list(APPEND __qt_${target}_find_package_args QUIET)
endif()
find_package(${__qt_${target}_find_package_args})
else()
find_dependency(${__qt_${target}_find_package_args})
endif()
endforeach()
endmacro()
# Note that target_dep_list does not accept a list of values, but a var name that contains the
# list of dependencies. See foreach block for reference.
macro(_qt_internal_find_tool_dependencies target target_dep_list)
if(NOT "${${target_dep_list}}" STREQUAL "" AND NOT "${QT_HOST_PATH}" STREQUAL "")
# Make sure that the tools find the host tools first
set(BACKUP_${target}_CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH})
set(BACKUP_${target}_CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH})
list(PREPEND CMAKE_PREFIX_PATH "${QT_HOST_PATH_CMAKE_DIR}"
"${_qt_additional_host_packages_prefix_paths}")
list(PREPEND CMAKE_FIND_ROOT_PATH "${QT_HOST_PATH}"
"${_qt_additional_host_packages_root_paths}")
endif()
foreach(__qt_${target}_target_dep IN LISTS ${target_dep_list})
list(GET __qt_${target}_target_dep 0 __qt_${target}_pkg)
list(GET __qt_${target}_target_dep 1 __qt_${target}_version)
unset(__qt_${target}_find_package_args)
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
list(APPEND __qt_${target}_find_package_args QUIET)
endif()
_qt_internal_save_find_package_context_for_debugging(${target})
find_package(${__qt_${target}_pkg}
${__qt_${target}_version}
${__qt_${target}_find_package_args}
PATHS
"${CMAKE_CURRENT_LIST_DIR}/.."
"${_qt_cmake_dir}"
${_qt_additional_packages_prefix_paths}
)
if (NOT ${__qt_${target}_pkg}_FOUND AND NOT QT_ALLOW_MISSING_TOOLS_PACKAGES)
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
"${CMAKE_FIND_PACKAGE_NAME} could not be found because dependency \
${__qt_${target}_pkg} could not be found.")
if(NOT "${QT_HOST_PATH}" STREQUAL "")
set(CMAKE_PREFIX_PATH ${BACKUP_${target}_CMAKE_PREFIX_PATH})
set(CMAKE_FIND_ROOT_PATH ${BACKUP_${target}_CMAKE_FIND_ROOT_PATH})
endif()
return()
endif()
endforeach()
if(NOT "${${target_dep_list}}" STREQUAL "" AND NOT "${QT_HOST_PATH}" STREQUAL "")
set(CMAKE_PREFIX_PATH ${BACKUP_${target}_CMAKE_PREFIX_PATH})
set(CMAKE_FIND_ROOT_PATH ${BACKUP_${target}_CMAKE_FIND_ROOT_PATH})
endif()
endmacro()
# Please note the target_dep_list accepts not the actual list values but the list names that
# contain preformed dependencies. See foreach block for reference.
# The same applies for find_dependency_path_list.
macro(_qt_internal_find_dependencies target_dep_list find_dependency_path_list)
foreach(__qt_target_dep IN LISTS ${target_dep_list})
list(GET __qt_target_dep 0 __qt_pkg)
list(GET __qt_target_dep 1 __qt_version)
macro(_qt_internal_find_qt_dependencies target target_dep_list find_dependency_path_list)
foreach(__qt_${target}_target_dep IN LISTS ${target_dep_list})
list(GET __qt_${target}_target_dep 0 __qt_${target}_pkg)
list(GET __qt_${target}_target_dep 1 __qt_${target}_version)
if (NOT ${__qt_pkg}_FOUND)
set(__qt_pkg_names ${__qt_pkg})
if(__qt_pkg MATCHES "(.*)Private$")
set(__qt_pkg_names "${CMAKE_MATCH_1};${__qt_pkg}")
if (NOT ${__qt_${target}_pkg}_FOUND)
# TODO: Remove Private handling once sufficient time has passed, aka all developers
# updated their builds not to contain stale FooDependencies.cmake files without the
# _qt_package_name property.
set(__qt_${target}_pkg_names ${__qt_${target}_pkg})
if(__qt_${target}_pkg MATCHES "(.*)Private$")
set(__qt_${target}_pkg_names "${CMAKE_MATCH_1};${__qt_${target}_pkg}")
endif()
find_dependency(${__qt_pkg} ${__qt_version}
_qt_internal_save_find_package_context_for_debugging(${target})
find_dependency(${__qt_${target}_pkg} ${__qt_${target}_version}
NAMES
${__qt_pkg_names}
${__qt_${target}_pkg_names}
PATHS
${${find_dependency_path_list}}
${_qt_additional_packages_prefix_paths}
@ -23,3 +117,175 @@ macro(_qt_internal_find_dependencies target_dep_list find_dependency_path_list)
endif()
endforeach()
endmacro()
# TODO: Remove once a dependency update completes and most developers have the Dependencies.cmake
# files updated in their builds.
# The name is too generic, it doesn't look for any kind of dependencies but only Qt package
# dependencies.
macro(_qt_internal_find_dependencies target_dep_list find_dependency_path_list)
_qt_internal_find_qt_dependencies("none" "${target_dep_list}" "${find_dependency_path_list}")
endmacro()
# If a dependency package was not found, provide some hints in the error message on how to debug
# the issue.
#
# pkg_name_var should be the variable name that contains the package that was not found.
# e.g. __qt_Core_pkg
#
# message_out_var should contain the variable name of the original "not found" message, and it
# will have the hints appended to it as a string. e.g. ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
#
# infix is used as a unique prefix to retrieve the find_package paths context for the last package
# that was not found, for debugging purposes.
#
# The function should not be called in Dependencies.cmake files directly, because find_dependency
# returns out of the included file.
macro(_qt_internal_suggest_dependency_debugging infix pkg_name_var message_out_var)
if(${pkg_name_var}
AND NOT ${CMAKE_FIND_PACKAGE_NAME}_FOUND
AND ${message_out_var})
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.23")
string(APPEND ${message_out_var}
"\nConfiguring with --debug-find-pkg=${${pkg_name_var}} might reveal \
details why the package was not found.")
elseif(CMAKE_VERSION VERSION_GREATER_EQUAL "3.17")
string(APPEND ${message_out_var}
"\nConfiguring with -DCMAKE_FIND_DEBUG_MODE=TRUE might reveal \
details why the package was not found.")
endif()
if(NOT QT_DEBUG_FIND_PACKAGE)
string(APPEND ${message_out_var}
"\nConfiguring with -DQT_DEBUG_FIND_PACKAGE=ON will print the values of some of \
the path variables that find_package uses to try and find the package.")
else()
string(APPEND ${message_out_var}
"\n find_package search path values and other context for the last package that was not found:"
"\n CMAKE_MODULE_PATH: ${_qt_${infix}_CMAKE_MODULE_PATH}"
"\n CMAKE_PREFIX_PATH: ${_qt_${infix}_CMAKE_PREFIX_PATH}"
"\n \$ENV{CMAKE_PREFIX_PATH}: $ENV{CMAKE_PREFIX_PATH}"
"\n CMAKE_FIND_ROOT_PATH: ${_qt_${infix}_CMAKE_FIND_ROOT_PATH}"
"\n _qt_additional_packages_prefix_paths: ${_qt_${infix}_qt_additional_packages_prefix_paths}"
"\n _qt_additional_host_packages_prefix_paths: ${_qt_${infix}_qt_additional_host_packages_prefix_paths}"
"\n _qt_cmake_dir: ${_qt_${infix}_qt_cmake_dir}"
"\n QT_HOST_PATH: ${QT_HOST_PATH}"
"\n Qt6HostInfo_DIR: ${Qt6HostInfo_DIR}"
"\n Qt6_DIR: ${Qt6_DIR}"
"\n CMAKE_TOOLCHAIN_FILE: ${CMAKE_TOOLCHAIN_FILE}"
"\n CMAKE_FIND_ROOT_PATH_MODE_PACKAGE: ${CMAKE_FIND_ROOT_PATH_MODE_PACKAGE}"
"\n CMAKE_SYSROOT: ${CMAKE_SYSROOT}"
"\n \$ENV{PATH}: $ENV{PATH}"
)
endif()
endif()
endmacro()
# Save find_package search paths context just before a find_package call, to be shown with a
# package not found message.
macro(_qt_internal_save_find_package_context_for_debugging infix)
if(QT_DEBUG_FIND_PACKAGE)
set(_qt_${infix}_CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}")
set(_qt_${infix}_CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH}")
set(_qt_${infix}_CMAKE_FIND_ROOT_PATH "${CMAKE_FIND_ROOT_PATH}")
set(_qt_${infix}_qt_additional_packages_prefix_paths
"${_qt_additional_packages_prefix_paths}")
set(_qt_${infix}_qt_additional_host_packages_prefix_paths
"${_qt_additional_host_packages_prefix_paths}")
set(_qt_${infix}_qt_cmake_dir "${_qt_cmake_dir}")
endif()
endmacro()
function(_qt_internal_determine_if_host_info_package_needed out_var)
set(needed FALSE)
# If a QT_HOST_PATH is provided when configuring qtbase, we assume it's a cross build
# and thus we require the QT_HOST_PATH to be provided also when using the cross-built Qt.
# This tells the QtConfigDependencies file to do appropriate requirement checks.
if(NOT "${QT_HOST_PATH}" STREQUAL "" AND NOT QT_NO_REQUIRE_HOST_PATH_CHECK)
set(needed TRUE)
endif()
set(${out_var} "${needed}" PARENT_SCOPE)
endfunction()
macro(_qt_internal_find_host_info_package platform_requires_host_info)
if(${platform_requires_host_info})
find_package(Qt6HostInfo
CONFIG
REQUIRED
PATHS "${QT_HOST_PATH}"
"${QT_HOST_PATH_CMAKE_DIR}"
NO_CMAKE_FIND_ROOT_PATH
NO_DEFAULT_PATH)
endif()
endmacro()
macro(_qt_internal_setup_qt_host_path
host_path_required
initial_qt_host_path
initial_qt_host_path_cmake_dir
)
# Set up QT_HOST_PATH and do sanity checks.
# A host path is required when cross-compiling but optional when doing a native build.
# Requiredness can be overridden via variable.
if(DEFINED QT_REQUIRE_HOST_PATH_CHECK)
set(_qt_platform_host_path_required "${QT_REQUIRE_HOST_PATH_CHECK}")
else()
set(_qt_platform_host_path_required "${host_path_required}")
endif()
if(_qt_platform_host_path_required)
# QT_HOST_PATH precedence:
# - cache variable / command line option
# - environment variable
# - initial QT_HOST_PATH when qtbase was configured (and the directory exists)
if(NOT DEFINED QT_HOST_PATH)
if(DEFINED ENV{QT_HOST_PATH})
set(QT_HOST_PATH "$ENV{QT_HOST_PATH}" CACHE PATH "")
elseif(NOT "${initial_qt_host_path}" STREQUAL "" AND EXISTS "${initial_qt_host_path}")
set(QT_HOST_PATH "${initial_qt_host_path}" CACHE PATH "")
endif()
endif()
if(NOT QT_HOST_PATH STREQUAL "")
get_filename_component(_qt_platform_host_path_absolute "${QT_HOST_PATH}" ABSOLUTE)
endif()
if("${QT_HOST_PATH}" STREQUAL "" OR NOT EXISTS "${_qt_platform_host_path_absolute}")
message(FATAL_ERROR
"To use a cross-compiled Qt, please set the QT_HOST_PATH cache variable to the "
"location of your host Qt installation.")
endif()
# QT_HOST_PATH_CMAKE_DIR is needed to work around the rerooting issue when looking for host
# tools. See REROOT_PATH_ISSUE_MARKER.
# Prefer initially configured path if none was explicitly set.
if(NOT DEFINED QT_HOST_PATH_CMAKE_DIR)
if(NOT "${initial_qt_host_path_cmake_dir}" STREQUAL ""
AND EXISTS "${initial_qt_host_path_cmake_dir}")
set(QT_HOST_PATH_CMAKE_DIR "${initial_qt_host_path_cmake_dir}" CACHE PATH "")
else()
# First try to auto-compute the location instead of requiring to set
# QT_HOST_PATH_CMAKE_DIR explicitly.
set(__qt_candidate_host_path_cmake_dir "${QT_HOST_PATH}/lib/cmake")
if(__qt_candidate_host_path_cmake_dir
AND EXISTS "${__qt_candidate_host_path_cmake_dir}")
set(QT_HOST_PATH_CMAKE_DIR
"${__qt_candidate_host_path_cmake_dir}" CACHE PATH "")
endif()
endif()
endif()
if(NOT QT_HOST_PATH_CMAKE_DIR STREQUAL "")
get_filename_component(_qt_platform_host_path_cmake_dir_absolute
"${QT_HOST_PATH_CMAKE_DIR}" ABSOLUTE)
endif()
if("${QT_HOST_PATH_CMAKE_DIR}" STREQUAL ""
OR NOT EXISTS "${_qt_platform_host_path_cmake_dir_absolute}")
message(FATAL_ERROR
"To use a cross-compiled Qt, please set the QT_HOST_PATH_CMAKE_DIR cache variable "
"to the location of your host Qt installation lib/cmake directory.")
endif()
endif()
endmacro()

View File

@ -408,3 +408,74 @@ function(__qt_internal_apply_plugin_imports_finalizer_mode target)
set_target_properties(${target} PROPERTIES _qt_plugin_finalizer_imports_processed TRUE)
endfunction()
# Include CMake plugin packages that belong to the Qt module ${target} and initialize automatic
# linkage of the plugins in static builds.
# The variables inside the macro have to be named unique to the module because an included Plugin
# file might look up another module dependency that calls the same macro before the first one
# has finished processing, which can silently override the values if the variables are not unique.
macro(__qt_internal_include_plugin_packages target)
set(__qt_${target}_plugin_module_target "${QT_CMAKE_EXPORT_NAMESPACE}::${target}")
set(__qt_${target}_plugins "")
# Properties can't be set on aliased targets, so make sure to unalias the target. This is needed
# when Qt examples are built as part of the Qt build itself.
get_target_property(_aliased_target ${__qt_${target}_plugin_module_target} ALIASED_TARGET)
if(_aliased_target)
set(__qt_${target}_plugin_module_target ${_aliased_target})
endif()
# Include all PluginConfig.cmake files and update the _qt_plugins and QT_PLUGINS property of
# the module. The underscored version is the one we will use going forward to have compatibility
# with INTERFACE libraries. QT_PLUGINS is now deprecated and only kept so that we don't break
# existing projects using it (like CMake itself).
file(GLOB __qt_${target}_plugin_config_files
"${CMAKE_CURRENT_LIST_DIR}/${QT_CMAKE_EXPORT_NAMESPACE}*PluginConfig.cmake")
foreach(__qt_${target}_plugin_config_file ${__qt_${target}_plugin_config_files})
string(REGEX REPLACE
"^.*/${QT_CMAKE_EXPORT_NAMESPACE}(.*Plugin)Config.cmake$"
"\\1"
__qt_${target}_qt_plugin "${__qt_${target}_plugin_config_file}")
include("${__qt_${target}_plugin_config_file}")
if(TARGET "${QT_CMAKE_EXPORT_NAMESPACE}::${__qt_${target}_qt_plugin}")
list(APPEND __qt_${target}_plugins ${__qt_${target}_qt_plugin})
endif()
endforeach()
set_property(TARGET ${__qt_${target}_plugin_module_target}
PROPERTY _qt_plugins ${__qt_${target}_plugins})
# TODO: Deprecated. Remove in Qt 7.
set_property(TARGET ${__qt_${target}_plugin_module_target}
PROPERTY QT_PLUGINS ${__qt_${target}_plugins})
get_target_property(__qt_${target}_have_added_plugins_already
${__qt_${target}_plugin_module_target} __qt_internal_plugins_added)
if(__qt_${target}_have_added_plugins_already)
return()
endif()
foreach(plugin_target ${__qt_${target}_plugins})
__qt_internal_plugin_get_plugin_type("${plugin_target}" __has_plugin_type __plugin_type)
if(NOT __has_plugin_type)
continue()
endif()
__qt_internal_plugin_has_class_name("${plugin_target}" __has_class_name)
if(NOT __has_class_name)
continue()
endif()
list(APPEND "QT_ALL_PLUGINS_FOUND_BY_FIND_PACKAGE_${__plugin_type}" "${plugin_target}")
# Auto-linkage should be set up only for static library builds.
if(NOT QT6_IS_SHARED_LIBS_BUILD)
__qt_internal_add_static_plugin_linkage(
"${plugin_target}" "${__qt_${target}_plugin_module_target}")
__qt_internal_add_static_plugin_import_macro(
"${plugin_target}" ${__qt_${target}_plugin_module_target} "${target}")
endif()
endforeach()
set_target_properties(
${__qt_${target}_plugin_module_target} PROPERTIES __qt_internal_plugins_added TRUE)
endmacro()

View File

@ -0,0 +1,104 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
# This function wraps COMMAND with cmake script, that makes possible standalone run with external
# arguments.
#
# Generated wrapper will be written to OUTPUT_FILE.
# If WORKING_DIRECTORY is not set COMMAND will be executed in CMAKE_CURRENT_BINARY_DIR.
# Variables from ENVIRONMENT will be set before COMMAND execution.
# PRE_RUN and POST_RUN arguments may contain extra cmake code that supposed to be executed before
# and after COMMAND, respectively. Both arguments accept a list of cmake script language
# constructions. Each item of the list will be concantinated into single string with '\n' separator.
# COMMAND_ECHO option takes a value like it does for execute_process, and passes that value to
# execute_process.
function(_qt_internal_create_command_script)
#This style of parsing keeps ';' in ENVIRONMENT variables
cmake_parse_arguments(PARSE_ARGV 0 arg
""
"OUTPUT_FILE;WORKING_DIRECTORY;COMMAND_ECHO"
"COMMAND;ENVIRONMENT;PRE_RUN;POST_RUN"
)
if(NOT arg_COMMAND)
message(FATAL_ERROR "qt_internal_create_command_script: COMMAND is not specified")
endif()
if(NOT arg_OUTPUT_FILE)
message(FATAL_ERROR "qt_internal_create_command_script: Wrapper OUTPUT_FILE\
is not specified")
endif()
if(NOT arg_WORKING_DIRECTORY AND NOT QNX)
set(arg_WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
endif()
set(environment_extras)
set(skipNext false)
if(arg_ENVIRONMENT)
list(LENGTH arg_ENVIRONMENT length)
math(EXPR length "${length} - 1")
foreach(envIdx RANGE ${length})
if(skipNext)
set(skipNext FALSE)
continue()
endif()
set(envVariable "")
set(envValue "")
list(GET arg_ENVIRONMENT ${envIdx} envVariable)
math(EXPR envIdx "${envIdx} + 1")
if (envIdx LESS_EQUAL ${length})
list(GET arg_ENVIRONMENT ${envIdx} envValue)
endif()
if(NOT "${envVariable}" STREQUAL "")
set(environment_extras "${environment_extras}\nset(ENV{${envVariable}} \
\"${envValue}\")")
endif()
set(skipNext TRUE)
endforeach()
endif()
#Escaping environment variables before expand them by file GENERATE
string(REPLACE "\\" "\\\\" environment_extras "${environment_extras}")
if(WIN32)
# It's necessary to call actual test inside 'cmd.exe', because 'execute_process' uses
# SW_HIDE to avoid showing a console window, it affects other GUI as well.
# See https://gitlab.kitware.com/cmake/cmake/-/issues/17690 for details.
set(extra_runner "cmd /c")
endif()
if(arg_PRE_RUN)
string(JOIN "\n" pre_run ${arg_PRE_RUN})
endif()
if(arg_POST_RUN)
string(JOIN "\n" post_run ${arg_POST_RUN})
endif()
set(command_echo "")
if(arg_COMMAND_ECHO)
set(command_echo "COMMAND_ECHO ${arg_COMMAND_ECHO}")
endif()
file(GENERATE OUTPUT "${arg_OUTPUT_FILE}" CONTENT
"#!${CMAKE_COMMAND} -P
# Qt generated command wrapper
${environment_extras}
${pre_run}
execute_process(COMMAND ${extra_runner} ${arg_COMMAND}
WORKING_DIRECTORY \"${arg_WORKING_DIRECTORY}\"
${command_echo}
RESULT_VARIABLE result
)
${post_run}
if(NOT result EQUAL 0)
string(JOIN \" \" full_command ${arg_COMMAND})
message(FATAL_ERROR \"\${full_command} execution failed with exit code \${result}.\")
endif()"
)
endfunction()

View File

@ -22,7 +22,7 @@ function(__qt_internal_get_tool_imported_location out_var tool)
get_target_property(configs ${target} IMPORTED_CONFIGURATIONS)
list(TRANSFORM configs PREPEND _)
# Well-known configuration types
list(APPEND
list(APPEND configs
_RELWITHDEBINFO
_RELEASE
_MINSIZEREL
@ -41,3 +41,105 @@ function(__qt_internal_get_tool_imported_location out_var tool)
set(${out_var} "${${out_var}}" PARENT_SCOPE)
endfunction()
function(_qt_internal_generate_tool_command_wrapper)
get_property(is_called GLOBAL PROPERTY _qt_internal_generate_tool_command_wrapper_called)
if(NOT CMAKE_HOST_WIN32 OR is_called)
return()
endif()
set(prefixes "")
# In a prefix build, the just-built tools should pick up libraries from the current repo build
# dir.
if(QT_BUILD_DIR)
list(APPEND prefixes "${QT_BUILD_DIR}")
endif()
# Pick up libraries from the main location where Qt was installed during a Qt build.
if(QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX)
list(APPEND prefixes "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}")
endif()
# Needed for ExternalProjects examples, where the Qt build dir is passed via this variable
# to the example project.
if(QT_ADDITIONAL_PACKAGES_PREFIX_PATH)
__qt_internal_prefix_paths_to_roots(additional_roots
"${QT_ADDITIONAL_PACKAGES_PREFIX_PATH}")
list(APPEND prefixes ${QT_ADDITIONAL_PACKAGES_PREFIX_PATH})
endif()
# Fallback to wherever Qt6 package is.
if(QT6_INSTALL_PREFIX)
list(APPEND prefixes "${QT6_INSTALL_PREFIX}")
endif()
# When building qtbase, QT6_INSTALL_BINS is not set yet.
if(INSTALL_BINDIR)
set(bin_suffix "${INSTALL_BINDIR}")
else()
set(bin_suffix "${QT6_INSTALL_BINS}")
endif()
set(path_dirs "")
foreach(prefix IN LISTS prefixes)
set(bin_dir "${prefix}/${bin_suffix}")
if(EXISTS "${bin_dir}")
file(TO_NATIVE_PATH "${bin_dir}" path_dir)
list(APPEND path_dirs "${path_dir}")
endif()
endforeach()
set(tool_command_wrapper_dir "${CMAKE_BINARY_DIR}/.qt/bin")
file(MAKE_DIRECTORY "${tool_command_wrapper_dir}")
set(tool_command_wrapper_path "${tool_command_wrapper_dir}/qt_setup_tool_path.bat")
file(WRITE "${tool_command_wrapper_path}" "@echo off
set PATH=${path_dirs};%PATH%
%*")
set(QT_TOOL_COMMAND_WRAPPER_PATH "${tool_command_wrapper_path}"
CACHE INTERNAL "Path to the wrapper of the tool commands")
set_property(GLOBAL PROPERTY _qt_internal_generate_tool_command_wrapper_called TRUE)
endfunction()
# Wraps a tool command with a script that contains the necessary environment for the tool to run
# correctly.
# _qt_internal_wrap_tool_command(var <SET|APPEND> <command> [args...])
# Arguments:
# APPEND Selects the 'append' mode for the out_variable argument.
# SET Selects the 'set' mode for the out_variable argument.
#
# FIXME: Replace all usages of _qt_internal_wrap_tool_command
# with _qt_internal_get_wrap_tool_script_path and remove the former.
# The former always adds the COMMAND keyword, which does not allow the caller to wrap the
# commands in a generator expression. See _qt_internal_target_enable_qmllint for an example.
function(_qt_internal_wrap_tool_command out_variable action)
set(append FALSE)
if(action STREQUAL "APPEND")
set(append TRUE)
elseif(NOT action STREQUAL "SET")
message(FATAL_ERROR "Invalid action specified ${action}. Supported actions: SET, APPEND")
endif()
# Ensure the script wrapper exists.
_qt_internal_generate_tool_command_wrapper()
set(cmd COMMAND ${QT_TOOL_COMMAND_WRAPPER_PATH} ${ARGN})
if(append)
list(APPEND ${out_variable} ${cmd})
else()
set(${out_variable} ${cmd})
endif()
set(${out_variable} "${${out_variable}}" PARENT_SCOPE)
endfunction()
# Gets the path to tool wrapper shell script.
function(_qt_internal_get_tool_wrapper_script_path out_variable)
# Ensure the script wrapper exists.
_qt_internal_generate_tool_command_wrapper()
set(${out_variable} "${QT_TOOL_COMMAND_WRAPPER_PATH}" PARENT_SCOPE)
endfunction()

View File

@ -50,7 +50,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.10")
set(QT_EMCC_RECOMMENDED_VERSION "3.1.14")
set(${out_var} "${QT_EMCC_RECOMMENDED_VERSION}" PARENT_SCOPE)
endfunction()
@ -69,3 +69,33 @@ function(__qt_internal_show_error_no_emscripten_toolchain_file_found_when_using_
"or provide a path to a valid emscripten installation via the EMSDK "
"environment variable.")
endfunction()
function(__qt_internal_get_qt_build_emsdk_version out_var)
if(QT6_INSTALL_PREFIX)
set(WASM_BUILD_DIR "${QT6_INSTALL_PREFIX}")
elseif(QT_BUILD_DIR)
set(WASM_BUILD_DIR "${QT_BUILD_DIR}")
endif()
if(EXISTS "${WASM_BUILD_DIR}/src/corelib/global/qconfig.h")
file(READ "${WASM_BUILD_DIR}/src/corelib/global/qconfig.h" ver)
else()
file(READ "${WASM_BUILD_DIR}/include/QtCore/qconfig.h" ver)
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)
__qt_internal_get_emcc_recommended_version(_recommended_emver)
__qt_internal_get_emroot_path_suffix_from_emsdk_env(emroot_path)
__qt_internal_query_emsdk_version("${emroot_path}" TRUE current_emsdk_ver)
__qt_internal_get_qt_build_emsdk_version(qt_build_emcc_version)
if(NOT "${qt_build_emcc_version}" STREQUAL "${current_emsdk_ver}")
message("Qt Wasm built with Emscripten version: ${qt_build_emcc_version}")
message("You are using Emscripten version: ${current_emsdk_ver}")
message("The recommended version of Emscripten for this Qt is: ${_recommended_emver}")
message("This may not work correctly")
endif()
endfunction()

View File

@ -95,7 +95,8 @@ function(qt_generate_qmake_and_qtpaths_wrapper_for_target)
"${host_prefix}")
file(RELATIVE_PATH ext_prefix_relative_to_conf_file "${ext_prefix}/${INSTALL_BINDIR}"
"${ext_prefix}")
file(RELATIVE_PATH ext_prefix_relative_to_host_prefix "${host_prefix}" "${ext_prefix}")
file(RELATIVE_PATH ext_datadir_relative_to_host_prefix "${host_prefix}"
"${ext_prefix}/${INSTALL_MKSPECSDIR}/..")
set(content "")
@ -127,7 +128,10 @@ Prefix=${prefix}
"[Paths]
Prefix=${ext_prefix_relative_to_conf_file}
HostPrefix=${host_prefix_relative_to_conf_file}
HostData=${ext_prefix_relative_to_host_prefix}
HostBinaries=${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_BINDIR}
HostLibraries=${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_LIBDIR}
HostLibraryExecutables=${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_LIBEXECDIR}
HostData=${ext_datadir_relative_to_host_prefix}
Sysroot=${sysroot}
SysrootifyPrefix=${sysrootify_prefix}
TargetSpec=${QT_QMAKE_TARGET_MKSPEC}

View File

@ -8,7 +8,7 @@
# because CMake's handling of empty list elements is a cruel joke.
# For CMake < 3.18 the function qt_watch_current_list_dir must know about the finalizer.
#
# When using CMake 3.19 or higher, no more INGORE parameters are passed. Instead we
# When using CMake 3.19 or higher, no more IGNORE parameters are passed. Instead we
# use cmake_language(DEFER CALL) and pass arguments as usual.
# qt_watch_current_list_dir also doesn't need to know about the finalizer
function(qt_add_list_file_finalizer func)

View File

@ -23,18 +23,22 @@ if(FEATURE_developer_build)
set(_default_build_type "Debug")
endif()
# Decide whether output should be verbose or not.
# Default to verbose (--log-level=STATUS) in a developer-build and
# non-verbose (--log-level=NOTICE) otherwise.
# If a custom CMAKE_MESSAGE_LOG_LEVEL was specified, it takes priority.
# Passing an explicit --log-level=Foo has the highest priority.
if(NOT CMAKE_MESSAGE_LOG_LEVEL)
if(FEATURE_developer_build OR QT_FEATURE_developer_build)
set(CMAKE_MESSAGE_LOG_LEVEL "STATUS")
else()
set(CMAKE_MESSAGE_LOG_LEVEL "NOTICE")
function(qt_internal_set_message_log_level out_var)
# Decide whether output should be verbose or not.
# Default to verbose (--log-level=STATUS) in a developer-build and
# non-verbose (--log-level=NOTICE) otherwise.
# If a custom CMAKE_MESSAGE_LOG_LEVEL was specified, it takes priority.
# Passing an explicit --log-level=Foo has the highest priority.
if(NOT CMAKE_MESSAGE_LOG_LEVEL)
if(FEATURE_developer_build OR QT_FEATURE_developer_build)
set(CMAKE_MESSAGE_LOG_LEVEL "STATUS")
else()
set(CMAKE_MESSAGE_LOG_LEVEL "NOTICE")
endif()
set(${out_var} "${CMAKE_MESSAGE_LOG_LEVEL}" PARENT_SCOPE)
endif()
endif()
endfunction()
qt_internal_set_message_log_level(CMAKE_MESSAGE_LOG_LEVEL)
# Reset content of extra build internal vars for each inclusion of QtSetup.
unset(QT_EXTRA_BUILD_INTERNALS_VARS)
@ -55,6 +59,12 @@ elseif(CMAKE_CONFIGURATION_TYPES)
message(STATUS
"Default build configuration set to '${CMAKE_NINJA_MULTI_DEFAULT_BUILD_TYPE}'.")
endif()
if(CMAKE_GENERATOR STREQUAL "Ninja")
message(FATAL_ERROR
"It's not possible to build multiple configurations with the single config Ninja "
"generator. Consider configuring with -G\"Ninja Multi-Config\" instead of -GNinja."
)
endif()
else()
message(STATUS "CMAKE_BUILD_TYPE was set to: '${CMAKE_BUILD_TYPE}'")
endif()
@ -106,6 +116,10 @@ endif()
## Position independent code:
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# Does the linker support position independent code?
include(CheckPIESupported)
check_pie_supported()
# Do not relink dependent libraries when no header has changed:
set(CMAKE_LINK_DEPENDS_NO_SHARED ON)
@ -248,28 +262,18 @@ option(QT_BUILD_EXAMPLES_AS_EXTERNAL "Should examples be built as ExternalProjec
unset(_qt_build_examples_as_external)
option(QT_BUILD_MANUAL_TESTS "Build Qt manual tests" OFF)
option(QT_BUILD_MINIMAL_STATIC_TESTS "Build minimal subset of tests for static Qt builds" OFF)
## Find host tools (if non native):
if(WASM)
option(QT_BUILD_MINIMAL_STATIC_TESTS "Build minimal subset of tests for static Qt builds" ON)
else()
option(QT_BUILD_MINIMAL_STATIC_TESTS "Build minimal subset of tests for static Qt builds" OFF)
endif()
## Path used to find host tools, either when cross-compiling or just when using the tools from
## a different host build.
set(QT_HOST_PATH "$ENV{QT_HOST_PATH}" CACHE PATH
"Installed Qt host directory path, used for cross compiling.")
if (CMAKE_CROSSCOMPILING)
if(NOT IS_DIRECTORY "${QT_HOST_PATH}")
message(FATAL_ERROR "You need to set QT_HOST_PATH to cross compile Qt.")
endif()
endif()
if(NOT "${QT_HOST_PATH}" STREQUAL "")
find_package(${INSTALL_CMAKE_NAMESPACE}HostInfo
CONFIG
REQUIRED
PATHS "${QT_HOST_PATH}"
"${QT_HOST_PATH_CMAKE_DIR}"
NO_CMAKE_FIND_ROOT_PATH
NO_DEFAULT_PATH)
endif()
## Android platform settings
if(ANDROID)
include(QtPlatformAndroid)

View File

@ -1,2 +1,5 @@
find_package(@INSTALL_CMAKE_NAMESPACE@ @PROJECT_VERSION@
# TODO: Ideally this should look for each Qt module separately, with each module's specific version,
# bypassing the Qt6 Config file, aka find_package(Qt6SpecificFoo) repated x times. But it's not
# critical.
find_package(@INSTALL_CMAKE_NAMESPACE@ @main_qt_package_version@
REQUIRED COMPONENTS @QT_REPO_KNOWN_MODULES_STRING@)

View File

@ -480,7 +480,7 @@ endif()
# INTERFACE libraries don't have IMPORTED_LOCATION-like properties.
# OBJECT libraries have properties like IMPORTED_OBJECTS instead.
# Skip the rest of the procesing for those.
# Skip the rest of the processing for those.
if(target_type STREQUAL "INTERFACE_LIBRARY" OR target_type STREQUAL "OBJECT_LIBRARY")
continue()
endif()
@ -664,12 +664,12 @@ endfunction()
#
# MSVC generates 2 types of pdb files:
# - compile-time generated pdb files (compile flag /Zi + /Fd<pdb_name>)
# - link-time genereated pdb files (link flag /debug + /PDB:<pdb_name>)
# - link-time generated pdb files (link flag /debug + /PDB:<pdb_name>)
#
# CMake allows changing the names of each of those pdb file types by setting
# the COMPILE_PDB_NAME_<CONFIG> and PDB_NAME_<CONFIG> properties. If they are
# left empty, CMake will compute the default names itself (or rather in certain cases
# leave it up to te compiler), without actually setting the property values.
# leave it up to the compiler), without actually setting the property values.
#
# For installation purposes, CMake only provides a generator expression to the
# link time pdb file path, not the compile path one, which means we have to compute the
@ -850,7 +850,7 @@ endfunction()
# To achieve that, consumers of ${target} will only get the include directories of ${dep_target}
# if the latter package and target exists.
#
# A find_package(dep_target) dependency is added to ${target}'s ModuleDependencies.cmake file.
# A find_package(dep_target) dependency is added to ${target}'s *Dependencies.cmake file.
#
# We use target_include_directories(PRIVATE) instead of target_link_libraries(PRIVATE) because the
# latter would propagate a mandatory LINK_ONLY dependency on the ${dep_target} in a static Qt build.

View File

@ -33,6 +33,10 @@ function(qt_internal_add_benchmark target)
${exec_args}
)
# Benchmarks on iOS must be app bundles.
if(IOS)
set_target_properties(${target} PROPERTIES MACOSX_BUNDLE TRUE)
endif()
qt_internal_add_repo_local_defines(${target})
@ -43,7 +47,7 @@ function(qt_internal_add_benchmark target)
# Add a ${target}_benchmark generator target, to run single benchmark more easily.
set(benchmark_wrapper_file "${arg_OUTPUT_DIRECTORY}/${target}Wrapper$<CONFIG>.cmake")
qt_internal_create_command_script(COMMAND "$<TARGET_FILE:${target}>"
_qt_internal_create_command_script(COMMAND "$<TARGET_FILE:${target}>"
OUTPUT_FILE "${benchmark_wrapper_file}"
ENVIRONMENT "PATH" "${benchmark_env_path}"
"QT_PLUGIN_PATH" "${benchmark_env_plugin_path}"
@ -61,6 +65,8 @@ function(qt_internal_add_benchmark target)
if (TARGET benchmark)
add_dependencies("benchmark" "${target}_benchmark")
endif()
qt_internal_add_test_finalizers("${target}")
endfunction()
# Simple wrapper around qt_internal_add_executable for manual tests which insure that
@ -98,9 +104,15 @@ function(qt_internal_add_manual_test target)
${exec_args}
)
# Tests on iOS must be app bundles.
if(IOS)
set_target_properties(${target} PROPERTIES MACOSX_BUNDLE TRUE)
endif()
# Disable the QT_NO_NARROWING_CONVERSIONS_IN_CONNECT define for manual tests
qt_internal_undefine_global_definition(${target} QT_NO_NARROWING_CONVERSIONS_IN_CONNECT)
qt_internal_add_test_finalizers("${target}")
endfunction()
# This function will configure the fixture for the network tests that require docker network services
@ -187,7 +199,7 @@ endfunction()
# to ON. This is helpful if you want to use internal CMake tools within tests, like memory or
# sanitizer checks. See https://cmake.org/cmake/help/v3.19/manual/ctest.1.html#ctest-memcheck-step
# Arguments:
# BUILTIN_TESTDATA the option forces adding the provded TESTDATA to resources.
# BUILTIN_TESTDATA the option forces adding the provided TESTDATA to resources.
function(qt_internal_add_test name)
# EXCEPTIONS is a noop as they are enabled by default.
set(optional_args
@ -282,6 +294,11 @@ function(qt_internal_add_test name)
# and not print anything.
set_property(TARGET "${name}" PROPERTY WIN32_EXECUTABLE FALSE)
# Tests on iOS must be app bundles.
if(IOS)
set_target_properties(${name} PROPERTIES MACOSX_BUNDLE TRUE)
endif()
# QMLTest specifics
qt_internal_extend_target("${name}" CONDITION arg_QMLTEST
PUBLIC_LIBRARIES ${QT_CMAKE_EXPORT_NAMESPACE}::QuickTest
@ -467,6 +484,7 @@ function(qt_internal_add_test name)
endif()
endif()
qt_internal_add_test_finalizers("${name}")
endfunction()
# This function adds test with specified NAME and wraps given test COMMAND with standalone cmake
@ -477,7 +495,7 @@ endfunction()
# directly by 'cmake -P path/to/scriptWrapper.cmake', COMMAND will be executed in specified
# WORKING_DIRECTORY with arguments specified in ARGS.
#
# See also qt_internal_create_command_script for details.
# See also _qt_internal_create_command_script for details.
function(qt_internal_create_test_script)
#This style of parsing keeps ';' in ENVIRONMENT variables
cmake_parse_arguments(PARSE_ARGV 0 arg
@ -538,7 +556,7 @@ for this function. Will be ignored")
endif()
endif()
qt_internal_create_command_script(COMMAND "${crosscompiling_emulator} \${env_test_runner} \
_qt_internal_create_command_script(COMMAND "${crosscompiling_emulator} \${env_test_runner} \
\"${executable_file}\" \${env_test_args} ${command_args}"
OUTPUT_FILE "${arg_OUTPUT_FILE}"
WORKING_DIRECTORY "${arg_WORKING_DIRECTORY}"
@ -550,103 +568,11 @@ for this function. Will be ignored")
)
endfunction()
# This function wraps COMMAND with cmake script, that makes possible standalone run with external
# arguments.
#
# Generated wrapper will be written to OUTPUT_FILE.
# If WORKING_DIRECTORY is not set COMMAND will be executed in CMAKE_CURRENT_BINARY_DIR.
# Variables from ENVIRONMENT will be set before COMMAND execution.
# PRE_RUN and POST_RUN arguments may contain extra cmake code that supposed to be executed before
# and after COMMAND, respectively. Both arguments accept a list of cmake script language
# constructions. Each item of the list will be concantinated into single string with '\n' sepatator.
function(qt_internal_create_command_script)
#This style of parsing keeps ';' in ENVIRONMENT variables
cmake_parse_arguments(PARSE_ARGV 0 arg
""
"OUTPUT_FILE;WORKING_DIRECTORY"
"COMMAND;ENVIRONMENT;PRE_RUN;POST_RUN"
)
if(NOT arg_COMMAND)
message(FATAL_ERROR "qt_internal_create_command_script: COMMAND is not specified")
endif()
if(NOT arg_OUTPUT_FILE)
message(FATAL_ERROR "qt_internal_create_command_script: Wrapper OUTPUT_FILE\
is not specified")
endif()
if(NOT arg_WORKING_DIRECTORY AND NOT QNX)
set(arg_WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
endif()
set(environment_extras)
set(skipNext false)
if(arg_ENVIRONMENT)
list(LENGTH arg_ENVIRONMENT length)
math(EXPR length "${length} - 1")
foreach(envIdx RANGE ${length})
if(skipNext)
set(skipNext FALSE)
continue()
endif()
set(envVariable "")
set(envValue "")
list(GET arg_ENVIRONMENT ${envIdx} envVariable)
math(EXPR envIdx "${envIdx} + 1")
if (envIdx LESS_EQUAL ${length})
list(GET arg_ENVIRONMENT ${envIdx} envValue)
endif()
if(NOT "${envVariable}" STREQUAL "")
set(environment_extras "${environment_extras}\nset(ENV{${envVariable}} \
\"${envValue}\")")
endif()
set(skipNext TRUE)
endforeach()
endif()
#Escaping environment variables before expand them by file GENERATE
string(REPLACE "\\" "\\\\" environment_extras "${environment_extras}")
if(WIN32)
# It's necessary to call actual test inside 'cmd.exe', because 'execute_process' uses
# SW_HIDE to avoid showing a console window, it affects other GUI as well.
# See https://gitlab.kitware.com/cmake/cmake/-/issues/17690 for details.
set(extra_runner "cmd /c")
endif()
if(arg_PRE_RUN)
string(JOIN "\n" pre_run ${arg_PRE_RUN})
endif()
if(arg_POST_RUN)
string(JOIN "\n" post_run ${arg_POST_RUN})
endif()
file(GENERATE OUTPUT "${arg_OUTPUT_FILE}" CONTENT
"#!${CMAKE_COMMAND} -P
# Qt generated command wrapper
${environment_extras}
${pre_run}
execute_process(COMMAND ${extra_runner} ${arg_COMMAND}
WORKING_DIRECTORY \"${arg_WORKING_DIRECTORY}\"
RESULT_VARIABLE result
)
${post_run}
if(NOT result EQUAL 0)
string(JOIN \" \" full_command ${arg_COMMAND})
message(FATAL_ERROR \"\${full_command} execution failed with exit code \${result}.\")
endif()"
)
endfunction()
# This function creates an executable for use as a helper program with tests. Some
# tests launch separate programs to test certain input/output behavior.
# Specify OVERRIDE_OUTPUT_DIRECTORY if you dont' want to place the helper in the parent directory,
# Specify OVERRIDE_OUTPUT_DIRECTORY if you don't want to place the helper in the parent directory,
# in which case you should specify OUTPUT_DIRECTORY "/foo/bar" manually.
function(qt_internal_add_test_helper name)
@ -730,3 +656,14 @@ function(qt_internal_collect_command_environment out_path out_plugin_path)
string(REPLACE ";" "\;" plugin_paths_joined "${plugin_paths_joined}")
set(${out_plugin_path} "${plugin_paths_joined}" PARENT_SCOPE)
endfunction()
function(qt_internal_add_test_finalizers target)
# It might not be safe to run all the finalizers of _qt_internal_finalize_executable
# within the context of a Qt build (not a user project) when targeting a host build.
# At least one issue is missing qmlimportscanner at configure time.
# For now, we limit it to iOS, where it was tested to work, an we know that host tools
# should already be built and available.
if(IOS)
qt_add_list_file_finalizer(_qt_internal_finalize_executable "${target}")
endif()
endfunction()

View File

@ -30,7 +30,7 @@
# The argument accepts 'Bootstrap' or 'None' values. If the argument value is set to
# 'Bootstrap' the Qt::Bootstrap library is linked to the executable instead of Qt::Core.
# The 'None' value points that core library is not necessary and avoids linking neither
# Qt::Core or Qt::Bootstrap libraries. Otherwise the Qt::Core library will be publically
# Qt::Core or Qt::Bootstrap libraries. Otherwise the Qt::Core library will be publicly
# linked to the executable target by default.
function(qt_internal_add_tool target_name)
qt_tool_target_to_name(name ${target_name})
@ -168,9 +168,22 @@ function(qt_internal_add_tool target_name)
endif()
if(NOT QT_WILL_BUILD_TOOLS)
message(FATAL_ERROR "The tool \"${full_name}\" was not found in the "
"${tools_package_name} package. "
"Package found: ${${tools_package_name}_FOUND}")
if(${${tools_package_name}_FOUND})
set(pkg_found_msg "")
string(APPEND pkg_found_msg
"the ${tools_package_name} package, but the package did not contain the tool. "
"Make sure that the host module ${arg_TOOLS_TARGET} was built with all features "
"enabled (no explicitly disabled tools).")
else()
set(pkg_found_msg "")
string(APPEND pkg_found_msg
"the ${tools_package_name} package, but the package could not be found. "
"Make sure you have built and installed the host ${arg_TOOLS_TARGET} module, "
"which will ensure the creation of the ${tools_package_name} package.")
endif()
message(FATAL_ERROR
"Failed to find the host tool \"${full_name}\". It is part of "
${pkg_found_msg})
else()
message(STATUS "Tool '${full_name}' will be built from source.")
endif()
@ -220,6 +233,13 @@ function(qt_internal_add_tool target_name)
_qt_internal_apply_strict_cpp("${target_name}")
qt_internal_adjust_main_config_runtime_output_dir("${target_name}" "${output_dir}")
set_target_properties(${target_name} PROPERTIES
_qt_package_version "${PROJECT_VERSION}"
)
set_property(TARGET ${target_name}
APPEND PROPERTY
EXPORT_PROPERTIES "_qt_package_version")
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.19.0" AND QT_FEATURE_debug_and_release)
set_property(TARGET "${target_name}"
PROPERTY EXCLUDE_FROM_ALL "$<NOT:$<CONFIG:${QT_MULTI_CONFIG_FIRST_CONFIG}>>")
@ -335,6 +355,8 @@ function(qt_export_tools module_name)
set(extra_cmake_files "")
set(extra_cmake_includes "")
set(first_tool_package_version "")
foreach(tool_name ${QT_KNOWN_MODULE_${module_name}_TOOLS})
# Specific tools can have package dependencies.
# e.g. qtwaylandscanner depends on WaylandScanner (non-qt package).
@ -366,6 +388,13 @@ endif()
")
list(APPEND tool_targets "${QT_CMAKE_EXPORT_NAMESPACE}::${tool_name}")
list(APPEND tool_targets_non_prefixed "${tool_name}")
if(NOT first_tool_package_version)
qt_internal_get_package_version_of_target("${tool_name}" tool_package_version)
if(tool_package_version)
set(first_tool_package_version "${tool_package_version}")
endif()
endif()
endforeach()
string(APPEND extra_cmake_statements
@ -411,9 +440,30 @@ endif()
"${config_build_dir}/${INSTALL_CMAKE_NAMESPACE}${target}Config.cmake"
INSTALL_DESTINATION "${config_install_dir}"
)
# There might be Tools packages which don't have a corresponding real module_name target, like
# WaylandScannerTools.
# In that case we'll use the package version of the first tool that belongs to that package.
if(TARGET "${module_name}")
qt_internal_get_package_version_of_target("${module_name}" tools_package_version)
elseif(first_tool_package_version)
set(tools_package_version "${first_tool_package_version}")
else()
# This should never happen, because tools_package_version should always have at least some
# value. Issue an assertion message just in case the pre-condition ever changes.
set(tools_package_version "${PROJECT_VERSION}")
if(FEATURE_developer_build)
message(WARNING
"Could not determine package version of tools package ${module_name}. "
"Defaulting to project version ${PROJECT_VERSION}.")
endif()
endif()
message(TRACE
"Exporting tools package ${module_name}Tools with package version ${tools_package_version}"
"\n included targets: ${tool_targets_non_prefixed}")
write_basic_package_version_file(
"${config_build_dir}/${INSTALL_CMAKE_NAMESPACE}${target}ConfigVersionImpl.cmake"
VERSION ${PROJECT_VERSION}
VERSION "${tools_package_version}"
COMPATIBILITY AnyNewerVersion
ARCH_INDEPENDENT
)

View File

@ -2,21 +2,6 @@
# as well as CMake application projects.
# Expects various global variables to be set.
function(qt_internal_create_toolchain_file)
set(qt_host_path_required FALSE)
if(NOT "${QT_HOST_PATH}" STREQUAL "")
# If a QT_HOST_PATH is provided when configuring qtbase, we assume it's a cross build
# and thus we require the QT_HOST_PATH to be provided also when using the cross-built Qt.
# This tells the Qt toolchain file to do appropriate requirement checks.
set(qt_host_path_required TRUE)
# TODO: Figure out how to make the initial QT_HOST_PATH var relocatable in relation
# to the target CMAKE_INSTALL_DIR, if at all possible to do so in a reliable way.
get_filename_component(qt_host_path_absolute "${QT_HOST_PATH}" ABSOLUTE)
get_filename_component(qt_host_path_cmake_dir_absolute
"${Qt${PROJECT_VERSION_MAJOR}HostInfo_DIR}/.." ABSOLUTE)
endif()
if(CMAKE_TOOLCHAIN_FILE)
file(TO_CMAKE_PATH "${CMAKE_TOOLCHAIN_FILE}" __qt_chainload_toolchain_file)
set(init_original_toolchain_file
@ -210,8 +195,8 @@ set(__qt_chainload_toolchain_file \"\${__qt_initially_configured_toolchain_file}
# xcodebuild from the command line would try to build with the wrong architecture. Also
# provide an opt-out option just in case.
#
# For a multi-architecture build (so simulator_and_device) we don't set an explicit
# architecture and let Xcode and the developer handle it.
# For a multi-architecture build (so simulator_and_device) we set an explicit
# architecture for simulator only, via _qt_internal_set_ios_simulator_arch.
#
# When using the Ninja generator, specify the first architecture from QT_OSX_ARCHITECTURES
# (even with a simulator_and_device Qt build). This ensures that the default configuration

View File

@ -4,8 +4,7 @@ function (qt_internal_setup_wasm_target_properties wasmTarget)
target_link_options("${wasmTarget}" INTERFACE
"SHELL:-s ERROR_ON_UNDEFINED_SYMBOLS=1"
"SHELL:-s EXPORTED_RUNTIME_METHODS=[UTF16ToString,stringToUTF16]"
"SHELL:-s USE_WEBGL2=1"
"SHELL:-s MAX_WEBGL_VERSION=2"
"SHELL:-s FETCH=1"
"SHELL:-s WASM_BIGINT=1")
@ -25,16 +24,6 @@ function (qt_internal_setup_wasm_target_properties wasmTarget)
target_compile_options("${wasmTarget}" INTERFACE -O2 -msimd128 -msse -msse2)
endif()
if (QT_FEATURE_opengles3)
target_link_options("${wasmTarget}" INTERFACE "SHELL:-s FULL_ES3=1")
target_link_options("${wasmTarget}" INTERFACE "SHELL:-s FULL_ES3=1"
"SHELL:-s MAX_WEBGL_VERSION=2"
"SHELL:-s WEBGL2_BACKWARDS_COMPATIBILITY_EMULATION=1")
else()
target_link_options("${wasmTarget}" INTERFACE "SHELL:-s FULL_ES2=1")
endif()
set(disable_exceptions_catching 1)
if (QT_FEATURE_exceptions)
set(disable_exceptions_catching 0)
@ -83,7 +72,17 @@ function (qt_internal_setup_wasm_target_properties wasmTarget)
set(QT_CFLAGS_OPTIMIZE_DEBUG "-Os" CACHE STRING INTERNAL FORCE)
set(QT_FEATURE_optimize_debug ON CACHE BOOL INTERNAL FORCE)
target_link_options("${wasmTarget}" INTERFACE "SHELL:-s ASYNCIFY" "-Os" "-s" "ASYNCIFY_IMPORTS=[qt_asyncify_suspend_js, qt_asyncify_resume_js]")
target_link_options("${wasmTarget}" INTERFACE "SHELL:-s ASYNCIFY" "-Os")
target_compile_definitions("${wasmTarget}" INTERFACE QT_HAVE_EMSCRIPTEN_ASYNCIFY)
endif()
# Set ASYNCIFY_IMPORTS unconditionally in order to support enabling asyncify at link time.
target_link_options("${wasmTarget}" INTERFACE "SHELL:-sASYNCIFY_IMPORTS=qt_asyncify_suspend_js,qt_asyncify_resume_js")
endfunction()
function(qt_internal_wasm_add_finalizers target)
qt_add_list_file_finalizer(_qt_internal_add_wasm_extra_exported_methods ${target})
endfunction()

View File

@ -95,8 +95,18 @@ function(qt_internal_create_wrapper_scripts)
set(__qt_cmake_standalone_test_bin_name "qt-cmake-standalone-test")
set(__qt_cmake_standalone_test_bin_path
"${INSTALL_BINDIR}/${__qt_cmake_standalone_test_bin_name}")
set(__qt_cmake_private_path
"${QT_STAGING_PREFIX}/${INSTALL_BINDIR}/qt-cmake-private")
# Configuring a standalone test on iOS should use the Xcode generator, but qt-cmake-private uses
# the generator that was used to build Qt itself (e.g. Ninja).
# Use qt-cmake instead, which does use the Xcode generator since Qt 6.2.5, 6.3.1, 6.4.
if(IOS)
set(__qt_cmake_private_path
"${QT_STAGING_PREFIX}/${INSTALL_BINDIR}/qt-cmake")
else()
set(__qt_cmake_private_path
"${QT_STAGING_PREFIX}/${INSTALL_BINDIR}/qt-cmake-private")
endif()
set(__qt_cmake_standalone_test_path
"${__build_internals_install_dir}/${__build_internals_standalone_test_template_dir}")

View File

@ -132,7 +132,7 @@ Compiling for a target architecture that's different than the host requires one
host. This "host build" is needed because the process of building Qt involves the compilation of
intermediate code generator tools, that in turn are called to produce source code that needs to be
compiled into the final libraries. These tools are built using Qt itself and they need to run on the
machine you're building on, regardless of the architecure you are targeting.
machine you're building on, regardless of the architecture you are targeting.
Build Qt regularly for your host system and install it into a directory of your choice using the
``CMAKE_INSTALL_PREFIX`` variable. You are free to disable the build of tests and examples by

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleName</key>
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
<key>CFBundleDisplayName</key>
<string>${QT_INTERNAL_DOLLAR_VAR}{PRODUCT_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
<key>CFBundleExecutable</key>
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
<key>CFBundleVersion</key>
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
<key>CFBundleShortVersionString</key>
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
<key>CFBundleIconFile</key>
<string>${MACOSX_BUNDLE_ICON_FILE}</string>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleAllowMixedLocalizations</key>
<true/>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NOTE</key>
<string>This file was generated by Qt's default CMake support.</string>
<key>UILaunchStoryboardName</key>
<string>@qt_ios_launch_screen_plist_entry@</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

View File

@ -1,55 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleName</key>
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
<key>CFBundleDisplayName</key>
<string>${QT_INTERNAL_DOLLAR_VAR}{PRODUCT_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
<key>CFBundleExecutable</key>
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
<key>CFBundleVersion</key>
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
<key>CFBundleShortVersionString</key>
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
<key>NSHumanReadableCopyright</key>
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
<key>CFBundleIconFile</key>
<string>${MACOSX_BUNDLE_ICON_FILE}</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NOTE</key>
<string>This file was generated by Qt's default CMake support.</string>
<key>UILaunchStoryboardName</key>
<string>${QT_INTERNAL_IOS_LAUNCH_SCREEN_PLIST_ENTRY}</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

View File

@ -29,7 +29,9 @@
<string>${MACOSX_BUNDLE_ICON_FILE}</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<string>en</string>
<key>CFBundleAllowMixedLocalizations</key>
<true/>
<key>NSPrincipalClass</key>
<string>NSApplication</string>

View File

@ -1,4 +1,4 @@
// Copyright (C) 2021 The Qt Company Ltd.
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef @header_base_name_upper@_H
@ -16,10 +16,33 @@
# define Q_@module_define_infix@_EXPORT
#endif
#ifdef QT_@module_define_infix@_BUILD_REMOVED_API
#define QT_@module_define_infix@_REMOVED_SINCE(major, minor) QT_DEPRECATED_SINCE(major, minor)
#if !defined(QT_BUILD_@module_define_infix@_LIB) && !defined(QT_STATIC)
/* 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;
* 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
#define QT_@module_define_infix@_REMOVED_SINCE(major, minor) 0
/* inside library, outside removed_api.cpp:
* 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) \
QT_IF_DEPRECATED_SINCE(major, minor, 1, 0)
#endif
#ifdef QT_@module_define_infix@_BUILD_REMOVED_API
# define QT_@module_define_infix@_REMOVED_SINCE(major, minor) QT_DEPRECATED_SINCE(major, minor)
#else
# define QT_@module_define_infix@_REMOVED_SINCE(major, minor) 0
#endif
#endif // @header_base_name_upper@_H

View File

@ -3,11 +3,7 @@ set(__qt_toolchain_used_variables
QT_TOOLCHAIN_INCLUDE_FILE
QT_TOOLCHAIN_RELOCATABLE_CMAKE_DIR
QT_TOOLCHAIN_RELOCATABLE_PREFIX
QT_HOST_PATH
QT_HOST_PATH_CMAKE_DIR
QT_REQUIRE_HOST_PATH_CHECK
QT_ADDITIONAL_PACKAGES_PREFIX_PATH
QT_ADDITIONAL_HOST_PACKAGES_PREFIX_PATH
)
@init_additional_used_variables@
@ -38,7 +34,7 @@ if(__qt_chainload_toolchain_file)
"${__qt_chainload_toolchain_file}" REALPATH)
if(__qt_chainload_toolchain_file_real_path STREQUAL CMAKE_CURRENT_LIST_FILE)
message(FATAL_ERROR
"Woah, the Qt toolchain file tried to include itself recusively! '${__qt_chainload_toolchain_file}' "
"Woah, the Qt toolchain file tried to include itself recursively! '${__qt_chainload_toolchain_file}' "
"Make sure to remove qtbase/CMakeCache.txt and reconfigure qtbase with 'cmake' "
"rather than 'qt-cmake', and then you can reconfigure your own project."
)
@ -154,73 +150,6 @@ if(QT_TOOLCHAIN_INCLUDE_FILE)
endif()
endif()
# Set up QT_HOST_PATH and do sanity checks.
# A host path is required when cross-compiling but optional when doing a native build.
# Requiredness can be overridden via variable.
if(DEFINED QT_REQUIRE_HOST_PATH_CHECK)
set(__qt_toolchain_host_path_required "${QT_REQUIRE_HOST_PATH_CHECK}")
else()
set(__qt_toolchain_host_path_required "@qt_host_path_required@")
endif()
set(__qt_toolchain_initial_qt_host_path
"@qt_host_path_absolute@")
set(__qt_toolchain_initial_qt_host_path_cmake_dir
"@qt_host_path_cmake_dir_absolute@")
# QT_HOST_PATH precedence:
# - cache variable / command line option
# - environment variable
# - initial QT_HOST_PATH when qtbase was configured (and the directory exists)
if(NOT DEFINED QT_HOST_PATH)
if(DEFINED ENV{QT_HOST_PATH})
set(QT_HOST_PATH "$ENV{QT_HOST_PATH}" CACHE PATH "")
else(__qt_toolchain_initial_qt_host_path AND EXISTS "${__qt_toolchain_initial_qt_host_path}")
set(QT_HOST_PATH "${__qt_toolchain_initial_qt_host_path}" CACHE PATH "")
endif()
endif()
if(NOT QT_HOST_PATH STREQUAL "")
get_filename_component(__qt_toolchain_host_path_absolute "${QT_HOST_PATH}" ABSOLUTE)
endif()
if(__qt_toolchain_host_path_required AND
("${QT_HOST_PATH}" STREQUAL "" OR NOT EXISTS "${__qt_toolchain_host_path_absolute}"))
message(FATAL_ERROR
"To use a cross-compiled Qt, please set the QT_HOST_PATH cache variable to the location "
"of your host Qt installation.")
endif()
# QT_HOST_PATH_CMAKE_DIR is needed to work around the rerooting issue when looking for host tools
# See REROOT_PATH_ISSUE_MARKER.
# Prefer initially configured path if none was explicitly set.
if(__qt_toolchain_host_path_required AND NOT DEFINED QT_HOST_PATH_CMAKE_DIR)
if(__qt_toolchain_initial_qt_host_path_cmake_dir
AND EXISTS "${__qt_toolchain_initial_qt_host_path_cmake_dir}")
set(QT_HOST_PATH_CMAKE_DIR "${__qt_toolchain_initial_qt_host_path_cmake_dir}" CACHE PATH "")
else()
# First try to auto-compute the location instead of requiring to set QT_HOST_PATH_CMAKE_DIR
# explicitly.
set(__qt_candidate_host_path_cmake_dir "${QT_HOST_PATH}/lib/cmake")
if(__qt_candidate_host_path_cmake_dir AND EXISTS "${__qt_candidate_host_path_cmake_dir}")
set(QT_HOST_PATH_CMAKE_DIR
"${__qt_candidate_host_path_cmake_dir}" CACHE PATH "")
endif()
endif()
endif()
if(NOT QT_HOST_PATH_CMAKE_DIR STREQUAL "")
get_filename_component(__qt_toolchain_host_path_cmake_dir_absolute
"${QT_HOST_PATH_CMAKE_DIR}" ABSOLUTE)
endif()
if(__qt_toolchain_host_path_required AND
("${QT_HOST_PATH_CMAKE_DIR}" STREQUAL ""
OR NOT EXISTS "${__qt_toolchain_host_path_cmake_dir_absolute}"))
message(FATAL_ERROR
"To use a cross-compiled Qt, please set the QT_HOST_PATH_CMAKE_DIR cache variable to "
"the location of your host Qt installation lib/cmake directory.")
endif()
# Store initial build type (if any is specified) to be read by QtBuildInternals.cmake when building
# a Qt repo, standalone tests or a single test.
if(DEFINED CACHE{CMAKE_BUILD_TYPE})

View File

@ -33,7 +33,7 @@ instructions:
enable_if:
condition: property
property: target.osVersion
in_values: [Android_ANY, QEMU, INTEGRITY, QNX_710]
in_values: [Android_ANY, QEMU, IOS_ANY, QNX_710, INTEGRITY]
enable_if:
condition: or
conditions:

View File

@ -14,10 +14,7 @@ instructions:
equals_property: target.os
- condition: property
property: target.osVersion
in_values: [QEMU, QNX_710]
- condition: property
property: target.osVersion
equals_value: IOS_ANY
in_values: [QEMU, QNX_710, IOS_ANY]
- condition: property
property: features
contains_value: AndroidTestRun

View File

@ -4,6 +4,12 @@ accept_configuration:
property: features
not_contains_value: Disable
machine_type:
Build:
cores: 4
Test:
cores: 4
instructions:
Build:
- !include "{{qt/qtbase}}/coin_qtbase_build_template_v2.yaml"

View File

@ -8,7 +8,7 @@ import re
import shutil
from functools import lru_cache
from pathlib import Path
from typing import Dict
from typing import Dict, Union
class QtConanError(Exception):
@ -128,13 +128,22 @@ class QtBase(ConanFile):
print("Setting 3rd party package requirement: {0}".format(requirement))
self.requires(requirement)
def _resolve_qt_host_path(self) -> str:
# When cross-building the user needs to pass 'qt_host_path' which is transformed to
# QT_HOST_PATH later on. Resolve the exact path.
qt_host_path = self.options.get_safe("qt_host_path")
if not qt_host_path:
raise QtConanError("Expected 'qt_host_path' option in cross-build context")
return str(Path(os.path.expandvars(str(qt_host_path))).expanduser().resolve(strict=True))
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":
@ -249,7 +258,9 @@ class QtBase(ConanFile):
def package_info(self):
self._shared.package_info(self)
if tools.cross_building(conanfile=self):
self.env_info.QT_HOST_PATH.append(self._resolve_qt_host_path())
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

View File

@ -1,9 +0,0 @@
cmake_minimum_required(VERSION 3.16)
project(direct_extern_access LANGUAGES CXX)
# this is the test found in https://sourceware.org/bugzilla/show_bug.cgi?id=29087
add_library(no_extern_access_lib SHARED lib.cpp)
add_executable(no_extern_access_main main.cpp)
target_compile_options(no_extern_access_lib PUBLIC "-mno-direct-extern-access")
target_link_libraries(no_extern_access_main no_extern_access_lib)

View File

@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 3.16)
project(direct_extern_access LANGUAGES CXX)
# this is the test found in https://sourceware.org/bugzilla/show_bug.cgi?id=29087
# and https://sourceware.org/bugzilla/show_bug.cgi?id=29377
add_library(no_extern_access_lib SHARED lib.cpp)
add_executable(no_extern_access_main other.cpp main.cpp)
target_compile_options(no_extern_access_lib PRIVATE "-Werror")
target_compile_options(no_extern_access_lib PUBLIC "$<$<CXX_COMPILER_ID:GNU>:-mno-direct-extern-access>")
target_compile_options(no_extern_access_lib PUBLIC "$<$<CXX_COMPILER_ID:Clang>:-fno-direct-access-external-data>")
target_link_libraries(no_extern_access_main no_extern_access_lib)

View File

@ -6,5 +6,6 @@
#define BUILD
#include "lib.h"
void *S::ptr = nullptr;
S::~S() { }
void S::f() { }
void *S::f() { return ptr; }

View File

@ -12,5 +12,6 @@
struct LIB_API S
{
virtual ~S();
virtual void f();
virtual void *f();
static void *ptr;
};

View File

@ -0,0 +1,20 @@
// Copyright (C) 2022 Intel Corporation.
// SPDX-License-Identifier: MIT
// This is combining the tests found in:
// https://sourceware.org/bugzilla/show_bug.cgi?id=29087
// https://sourceware.org/bugzilla/show_bug.cgi?id=29377
#include "lib.h"
extern void foo(); // other.cpp
void (*get_foo())()
{
return foo;
}
struct Local : S { };
int main()
{
Local l;
}

View File

@ -1,12 +1,8 @@
// Copyright (C) 2022 Intel Corporation.
// SPDX-License-Identifier: MIT
// This is the test found in https://sourceware.org/bugzilla/show_bug.cgi?id=29087
// This is the test found in https://sourceware.org/bugzilla/show_bug.cgi?id=29377
#include "lib.h"
struct Local : S { };
int main()
__attribute__((visibility("protected"))) void foo()
{
Local l;
}

View File

@ -54,7 +54,7 @@ qt_feature("use_bfd_linker"
PRIVATE
LABEL "bfd"
AUTODETECT false
CONDITION NOT WIN32 AND NOT INTEGRITY AND NOT WASM AND TEST_use_bfd_linker
CONDITION NOT MSVC AND NOT INTEGRITY AND NOT WASM AND TEST_use_bfd_linker
ENABLE INPUT_linker STREQUAL 'bfd'
DISABLE INPUT_linker STREQUAL 'gold' OR INPUT_linker STREQUAL 'lld'
OR INPUT_linker STREQUAL 'mold'
@ -80,7 +80,7 @@ qt_feature("use_lld_linker"
PRIVATE
LABEL "lld"
AUTODETECT false
CONDITION NOT WIN32 AND NOT INTEGRITY AND NOT WASM AND TEST_use_lld_linker
CONDITION NOT MSVC AND NOT INTEGRITY AND NOT WASM AND TEST_use_lld_linker
ENABLE INPUT_linker STREQUAL 'lld'
DISABLE INPUT_linker STREQUAL 'bfd' OR INPUT_linker STREQUAL 'gold'
OR INPUT_linker STREQUAL 'mold'
@ -188,9 +188,9 @@ qt_config_compiler_supports_flag_test(optimize_debug
FLAG "-Og"
)
qt_config_compile_test(no_extern_direct_access
LABEL "-mno-direct-extern-access support"
PROJECT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/config.tests/direct_extern_access"
qt_config_compile_test(no_direct_extern_access
LABEL "-mno-direct-extern-access / -fno-direct-access-external-data support"
PROJECT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/config.tests/no_direct_extern_access"
)
qt_config_linker_supports_flag_test(enable_new_dtags
@ -701,12 +701,13 @@ qt_feature("reduce_exports" PRIVATE
)
qt_feature_definition("reduce_exports" "QT_VISIBILITY_AVAILABLE")
qt_feature_config("reduce_exports" QMAKE_PUBLIC_QT_CONFIG)
qt_feature("no_extern_direct_access" PRIVATE
qt_feature("no_direct_extern_access" PRIVATE
LABEL "Use protected visibility and -mno-direct-extern-access"
CONDITION NOT WIN32 AND TEST_no_extern_direct_access
CONDITION NOT WIN32 AND TEST_no_direct_extern_access
AUTODETECT OFF
)
qt_feature_definition("no_extern_direct_access" "QT_USE_PROTECTED_VISIBILITY")
qt_feature_config("no_extern_direct_access" QMAKE_PUBLIC_QT_CONFIG)
qt_feature_definition("no_direct_extern_access" "QT_USE_PROTECTED_VISIBILITY")
qt_feature_config("no_direct_extern_access" QMAKE_PUBLIC_QT_CONFIG)
qt_feature("reduce_relocations" PUBLIC
LABEL "Reduce amount of relocations"
CONDITION NOT WIN32 AND TEST_reduce_relocations
@ -911,7 +912,7 @@ qt_feature("system-zlib" PRIVATE
LABEL "Using system zlib"
CONDITION WrapSystemZLIB_FOUND
)
qt_feature("zstd" PRIVATE
qt_feature("zstd" PUBLIC
LABEL "Zstandard support"
CONDITION WrapZSTD_FOUND
)
@ -989,7 +990,6 @@ qt_feature("printsupport" PRIVATE
)
qt_feature("sql" PRIVATE
LABEL "Qt Sql"
CONDITION QT_FEATURE_thread AND NOT WASM
)
qt_feature("testlib" PRIVATE
LABEL "Qt Testlib"
@ -1167,7 +1167,7 @@ qt_configure_add_report_entry(
# special case begin
# qt_configure_add_report_entry(
# TYPE ERROR
# MESSAGE "Debug build wihtout Release build is not currently supported on ios see QTBUG-71990. Use -debug-and-release."
# MESSAGE "Debug build without Release build is not currently supported on ios see QTBUG-71990. Use -debug-and-release."
# CONDITION IOS AND QT_FEATURE_debug AND NOT QT_FEATURE_debug_and_release
# )
# special case end

View File

@ -1 +1 @@
url.examples = "https://code.qt.io/cgit/qt/qtquickcontrols2.git/tree/examples/\1?h=$QT_VER"
url.examples = "https://code.qt.io/cgit/qt/qtdeclarative.git/tree/examples/\1?h=$QT_VER"

View File

@ -3,7 +3,7 @@
dita.metadata.default.author = Qt Project
dita.metadata.default.permissions = all
dita.metadata.default.publisher = Qt Project
dita.metadata.default.copyryear = 2022
dita.metadata.default.copyryear = 2023
dita.metadata.default.copyrholder = The Qt Company Ltd
dita.metadata.default.audience = programmer
@ -23,6 +23,7 @@ ignorewords += \
ignoresince = 5.0
sourcedirs += includes $$BUILDDIR
exampledirs += snippets
url = https://doc.qt.io/qt

View File

@ -563,6 +563,6 @@
*/
/*!
\externalpage https://www.froglogic.com/testcenter/
\title Squish Test Center
\externalpage https://www.qt.io/product/quality-assurance/test-center
\title Test Center
*/

View File

@ -78,7 +78,7 @@ HTML.footer += \
" <ul id=\"menu-footer-submenu\" class=\"right clearfix\"><li id=\"menu-item-1795\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-1795\"><a title=\"Sign into your account.\" href=\"https://account.qt.io/login\">Sign In</a></li>\n" \
" <li id=\"menu-item-10375\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-10375\"><a href=\"mailto:feedback@theqtcompany.com?Subject=Feedback%20about%20doc.qt.io%20site\">Feedback</a></li>\n" \
" <li id=\"menu-item-1494\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1494\"><a href=\"http://qt.io/contact-us/\">Contact us</a></li>\n" \
" <li id=\"menu-item-4472\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-4472\"><a href=\"http://qt.io/about-us/\">© 2022 The Qt Company</a></li>\n" \
" <li id=\"menu-item-4472\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-4472\"><a href=\"http://qt.io/about-us/\">© 2023 The Qt Company</a></li>\n" \
" </ul>\n" \
"</div>\n" \
"</div>\n" \

View File

@ -8,7 +8,7 @@ HTML.footer = \
"</div>\n" \
"<div class=\"footer\">\n" \
" <p>\n" \
" <acronym title=\"Copyright\">&copy;</acronym> 2022 The Qt Company Ltd.\n" \
" <acronym title=\"Copyright\">&copy;</acronym> 2023 The Qt Company Ltd.\n" \
" Documentation contributions included herein are the copyrights of\n" \
" their respective owners.<br/>" \
" The documentation provided herein is licensed under the terms of the" \

View File

@ -0,0 +1,175 @@
// Copyright (C) 2022 Giuseppe D'Angelo <dangelog@gmail.com>.
// Copyright (C) 2022 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
//! [porting-to-qregularexpression]
The QRegularExpression class introduced in Qt 5 implements Perl-compatible
regular expressions and is a big improvement upon QRegExp in terms of APIs
offered, supported pattern syntax, and speed of execution. The biggest
difference is that QRegularExpression simply holds a regular expression,
and it's \e{not} modified when a match is requested. Instead, a
QRegularExpressionMatch object is returned, to check the result of a match
and extract the captured substring. The same applies to global matching and
QRegularExpressionMatchIterator.
Other differences are outlined below.
\note QRegularExpression does not support all the features available in
Perl-compatible regular expressions. The most notable one is the fact that
duplicated names for capturing groups are not supported, and using them can
lead to undefined behavior. This may change in a future version of Qt.
\section3 Different pattern syntax
Porting a regular expression from QRegExp to QRegularExpression may require
changes to the pattern itself.
In specific scenarios, QRegExp was too lenient and accepted patterns that
are simply invalid when using QRegularExpression. These are easy to detect,
because the QRegularExpression objects built with these patterns are not
valid (see QRegularExpression::isValid()).
In other cases, a pattern ported from QRegExp to QRegularExpression may
silently change semantics. Therefore, it is necessary to review the
patterns used. The most notable cases of silent incompatibility are:
\list
\li Curly braces are needed to use a hexadecimal escape like \c{\xHHHH}
with more than 2 digits. A pattern like \c{\x2022} needs to be ported
to \c{\x{2022}}, or it will match a space (\c{0x20}) followed by the
string \c{"22"}. In general, it is highly recommended to always use
curly braces with the \c{\x} escape, no matter the number of digits
specified.
\li A 0-to-n quantification like \c{{,n}} needs to be ported to \c{{0,n}}
to preserve semantics. Otherwise, a pattern such as \c{\d{,3}} would
match a digit followed by the exact string \c{"{,3}"}.
\li QRegExp by default does Unicode-aware matching, while
QRegularExpression requires a separate option; see below for more
details.
\li c{.} in QRegExp does by default match all characters, including the
newline character. QRegularExpression excludes the newline character
by default. To include the newline character, set the
QRegularExpression::DotMatchesEverythingOption pattern option.
\endlist
For an overview of the regular expression syntax supported by
QRegularExpression, please refer to the
\l{https://pcre.org/original/doc/html/pcrepattern.html}{pcrepattern(3)}
man page, describing the pattern syntax supported by PCRE (the reference
implementation of Perl-compatible regular expressions).
\section3 Porting from QRegExp::exactMatch()
QRegExp::exactMatch() served two purposes: it exactly matched a regular
expression against a subject string, and it implemented partial matching.
\section4 Porting from QRegExp's Exact Matching
Exact matching indicates whether the regular expression matches the entire
subject string. For example, the classes yield on the subject string \c{"abc123"}:
\table
\header \li \li QRegExp::exactMatch() \li QRegularExpressionMatch::hasMatch()
\row \li \c{"\\d+"} \li \b false \li \b true
\row \li \c{"[a-z]+\\d+"} \li \b true \li \b true
\endtable
Exact matching is not reflected in QRegularExpression. If you want
to be sure that the subject string matches the regular expression
exactly, you can wrap the pattern using the QRegularExpression::anchoredPattern()
function:
\snippet code/doc_src_port_from_qregexp.cpp 0
\section4 Porting from QRegExp's Partial Matching
When using QRegExp::exactMatch(), if an exact match was not found, one
could still find out how much of the subject string was matched by the
regular expression by calling QRegExp::matchedLength(). If the returned length
was equal to the subject string's length, then one could conclude that a partial
match was found.
QRegularExpression supports partial matching explicitly by means of the
appropriate QRegularExpression::MatchType.
\section3 Global matching
Due to limitations of the QRegExp API, it was impossible to implement global
matching correctly (that is, like Perl does). In particular, patterns that
can match 0 characters (like \c{"a*"}) are problematic.
QRegularExpression::globalMatch() implements Perl global match correctly, and
the returned iterator can be used to examine each result.
For example, if you have code like:
\snippet code/doc_src_port_from_qregexp.cpp 1
You can rewrite it as:
\snippet code/doc_src_port_from_qregexp.cpp 2
\section3 Unicode properties support
When using QRegExp, character classes such as \c{\w}, \c{\d}, etc. match
characters with the corresponding Unicode property: for instance, \c{\d}
matches any character with the Unicode \c{Nd} (decimal digit) property.
Those character classes only match ASCII characters by default when using
QRegularExpression: for instance, \c{\d} matches exactly a character in the
\c{0-9} ASCII range. It is possible to change this behavior by using the
QRegularExpression::UseUnicodePropertiesOption pattern option.
\section3 Wildcard matching
There is no direct way to do wildcard matching in QRegularExpression.
However, the QRegularExpression::wildcardToRegularExpression() method
is provided to translate glob patterns into a Perl-compatible regular
expression that can be used for that purpose.
For example, if you have code like:
\snippet code/doc_src_port_from_qregexp.cpp 3
You can rewrite it as:
\snippet code/doc_src_port_from_qregexp.cpp 4
Please note though that some shell-like wildcard patterns might not be
translated to what you expect. The following example code will silently
break if simply converted using the above-mentioned function:
\snippet code/doc_src_port_from_qregexp.cpp 5
This is because, by default, the regular expression returned by
QRegularExpression::wildcardToRegularExpression() is fully anchored.
To get a regular expression that is not anchored, pass
QRegularExpression::UnanchoredWildcardConversion as the conversion
options:
\snippet code/doc_src_port_from_qregexp.cpp 6
\section3 Minimal matching
QRegExp::setMinimal() implemented minimal matching by simply reversing the
greediness of the quantifiers (QRegExp did not support lazy quantifiers,
like \c{*?}, \c{+?}, etc.). QRegularExpression instead does support greedy,
lazy, and possessive quantifiers. The QRegularExpression::InvertedGreedinessOption
pattern option can be useful to emulate the effects of QRegExp::setMinimal():
if enabled, it inverts the greediness of quantifiers (greedy ones become
lazy and vice versa).
\section3 Caret modes
The QRegularExpression::AnchorAtOffsetMatchOption match option can be used to
emulate the QRegExp::CaretAtOffset behavior. There is no equivalent for the
other QRegExp::CaretMode modes.
//! [porting-to-qregularexpression]

View File

@ -18,9 +18,10 @@
//! [using qt module]
//! [using the c++ api]
Using a Qt module requires linking against the module library, either
directly or through other dependencies. Several build tools have dedicated
support for this, including \l{CMake Documentation}{CMake} and \l{qmake}.
Using a Qt module's C++ API requires linking against the module library,
either directly or through other dependencies. Several build tools have
dedicated support for this, including \l{CMake Documentation}{CMake} and
\l{qmake}.
//! [using the c++ api]
//! [using the qml api]

View File

@ -85,3 +85,6 @@ macro.cmakevariableandroidonly = "\\note This variable is used only if targeting
macro.versionlessCMakeCommandsNote = "If \\l{Versionless commands}{versionless commands} are disabled, use \\c{\1} instead. It supports the same set of arguments as this command."
macro.cmakepropertywebassemblyonly = "\\note This property is used only if targeting the WebAssembly platform."
macro.cmakepropertyiosonly = "\\note This property is used only if targeting iOS."
macro.cmakevariableiosonly = "\\note This variable is used only if targeting iOS."

View File

@ -71,7 +71,24 @@ manifestmeta.android.names = "Qt3D/Qt 3D: Basic Shapes C++ Example" \
"QtQML/Extending QML - Signal Support Example" \
"QtQML/Qt Quick Examples - XMLHttpRequest" \
"QtQml/Qt Quick Examples - XMLHttpRequest" \
"QtQuick/*" \
"QtQuick/C++ Extensions*" \
"QtQuick/Models and Views*" \
"QtQuick/QQuickRenderControl OpenGL Example" \
"QtQuick/QQuickWidget - QQuickView Comparison Example" \
"QtQuick/QML*" \
"QtQuick/Qt Quick*" \
"QtQuick/Scene Graph - Custom Geometry" \
"QtQuick/Scene Graph - Custom Material" \
"QtQuick/Scene Graph - Graph" \
"QtQuick/Scene Graph - OpenGL Under QML" \
"QtQuick/Scene Graph - Painted Item" \
"QtQuick/Scene Graph - Rendering FBOs" \
"QtQuick/Scene Graph - Two Texture Providers" \
"QtQuick/Scene Graph - Vulkan Under QML" \
"QtQuick/Scene Graph - Vulkan Texture Import" \
"QtQuick/Threaded ListModel Example" \
"QtQuick/TabWidget Example" \
"QtQuick/UI Components*" \
"QtQuickControls/*" \
"QtQuickControls1/Qt Quick Controls 1 - Calendar Example" \
"QtQuickControls1/Qt Quick Controls 1 - Gallery" \
@ -216,6 +233,8 @@ manifestmeta.ios.names = "QtCore/Contiguous Cache Example" \
"QtQuick/Qt Quick Examples - MouseArea" \
"QtQuick/Qt Quick Examples - Positioners" \
"QtQuick/Qt Quick Examples - Right to Left" \
"QtQuick/Scene Graph - Metal Texture Import" \
"QtQuick/Scene Graph - Metal Under QML" \
"QtQuick/Scene Graph - OpenGL Under QML" \
"QtQuick/Qt Quick Examples - Shader Effects" \
"QtQuick/Qt Quick Examples - Text" \

View File

@ -1,222 +1,8 @@
versionsym = QT_VERSION_STR
defines += Q_QDOC \
Q_CLANG_QDOC \
QT_.*_SUPPORT \
QT_.*_LIB \
QT_COMPAT \
QT_KEYPAD_NAVIGATION \
QT_NO_EGL \
Q_BYTE_ORDER \
QT_DEPRECATED \
QT_DEPRECATED_* \
Q_NO_USING_KEYWORD \
Q_OS_.* \
Q_COMPILER_INITIALIZER_LISTS \
Q_COMPILER_UNIFORM_INIT \
Q_COMPILER_RVALUE_REFS
clangdefines += Q_QDOC \
Q_CLANG_QDOC \
QT_COMPAT \
QT_BUILD_CORE_LIB \
QT_BUILD_EGL_DEVICE_LIB \
QT_BUILD_LOCATION_LIB \
QT_BUILD_SCRIPT_LIB \
QT_BUILD_TESTLIB_LIB \
QT_BUILD_WIDGETS_LIB \
QT_CORE_LIB \
QT_DEPRECATED \
QT_GUI_LIB \
QT_KEYPAD_NAVIGATION \
QT_LARGEFILE_SUPPORT \
QT_NETWORK_LIB \
QT_NO_EGL \
QT_OPENGL_SUPPORT \
QT_SCRIPT_LIB \
QT_SHARED_POINTER_BACKTRACE_SUPPORT \
QT_WIDGETS_LIB \
Q_BYTE_ORDER \
Q_CC_CLANG \
Q_COMPILER_CONSTEXPR \
Q_COMPILER_DEFAULT_MEMBERS \
Q_COMPILER_DELETE_MEMBERS \
Q_COMPILER_EXPLICIT_OVERRIDES \
Q_COMPILER_INITIALIZER_LISTS \
Q_COMPILER_MANGLES_RETURN_TYPE \
Q_COMPILER_NOEXCEPT \
Q_COMPILER_NULLPTR \
Q_COMPILER_RVALUE_REFS \
Q_COMPILER_STATIC_ASSERT \
Q_COMPILER_UNIFORM_INIT \
Q_COMPILER_VARIADIC_MACROS \
Q_COMPILER_VARIADIC_TEMPLATES \
Q_ATOMIC_INT16_IS_SUPPORTED \
Q_ATOMIC_INT64_IS_SUPPORTED \
Q_ATOMIC_INT8_IS_SUPPORTED
# Q_COMPILER_REF_QUALIFIERS is not yet supported by all compilers
Cpp.ignoretokens += \
ENGINIOCLIENT_EXPORT \
PHONON_EXPORT \
Q_ALWAYS_INLINE \
Q_AUTOTEST_EXPORT \
Q_BLUETOOTH_EXPORT \
Q_COMPAT_EXPORT \
Q_CORE_EXPORT \
Q_CORE_EXPORT_INLINE \
Q_DBUS_EXPORT \
Q_DECL_CONSTEXPR \
Q_DECL_RELAXED_CONSTEXPR \
Q_DECL_CONST_FUNCTION \
Q_DECL_DEPRECATED \
Q_DECL_NOEXCEPT \
Q_DECL_FINAL \
Q_DECL_OVERRIDE \
Q_DECL_NOTHROW \
Q_DECL_PURE_FUNCTION \
Q_DECL_UNUSED \
Q_DECL_CF_RETURNS_RETAINED \
Q_DECL_NS_RETURNS_AUTORELEASED \
Q_DECL_EQ_DEFAULT \
Q_DECLARATIVE_EXPORT \
Q_EXPLICIT \
Q_EXPORT \
Q_EXPORT_PLUGIN \
Q_EXPORT_PLUGIN2 \
Q_GADGET \
Q_GADGET_EXPORT \
Q_GFX_INLINE \
Q_GUI_EXPORT \
Q_GUI_EXPORT_INLINE \
Q_GUI_EXPORT_STYLE_CDE \
Q_GUI_EXPORT_STYLE_COMPACT \
Q_GUI_EXPORT_STYLE_MAC \
Q_GUI_EXPORT_STYLE_MOTIF \
Q_GUI_EXPORT_STYLE_MOTIFPLUS \
Q_GUI_EXPORT_STYLE_PLATINUM \
Q_GUI_EXPORT_STYLE_POCKETPC \
Q_GUI_EXPORT_STYLE_SGI \
Q_GUI_EXPORT_STYLE_WINDOWS \
Q_INLINE_TEMPLATE \
Q_INTERNAL_WIN_NO_THROW \
Q_INVOKABLE \
Q_LOCATION_EXPORT \
Q_POSITIONING_EXPORT \
Q_MULTIMEDIA_EXPORT \
Q_NAMESPACE \
Q_NAMESPACE_EXPORT \
Q_NETWORK_EXPORT \
Q_NEVER_INLINE \
Q_NORETURN \
Q_OPENGL_EXPORT \
Q_OPENVG_EXPORT \
Q_OUTOFLINE_TEMPLATE \
Q_PRINTSUPPORT_EXPORT \
Q_QML_EXPORT \
Q_REQUIRED_RESULT \
Q_SCRIPT_EXPORT \
Q_SCRIPTTOOLS_EXPORT \
Q_SERIALBUS_EXPORT \
Q_SQL_EXPORT \
Q_SVG_EXPORT \
Q_TESTLIB_EXPORT \
Q_TYPENAME \
Q_WEAK_OVERLOAD \
Q_WIDGETS_EXPORT \
Q_WINEXTRAS_EXPORT \
Q_XML_EXPORT \
Q_XMLPATTERNS_EXPORT \
Q_XMLSTREAM_EXPORT \
QAXFACTORY_EXPORT \
QDBUS_EXPORT \
QDESIGNER_COMPONENTS_LIBRARY \
QDESIGNER_EXTENSION_LIBRARY \
QDESIGNER_SDK_LIBRARY \
QDESIGNER_SHARED_LIBRARY \
QDESIGNER_UILIB_LIBRARY \
QHELP_EXPORT \
QM_AUTOTEST_EXPORT \
QM_EXPORT_CANVAS \
QM_EXPORT_DNS \
QM_EXPORT_DOM \
QM_EXPORT_FTP \
QM_EXPORT_HTTP \
QM_EXPORT_ICONVIEW \
QM_EXPORT_NETWORK \
QM_EXPORT_OPENGL \
QM_EXPORT_OPENVG \
QM_EXPORT_SQL \
QM_EXPORT_TABLE \
QM_EXPORT_WORKSPACE \
QM_EXPORT_XML \
QT_ASCII_CAST_WARN \
QT_ASCII_CAST_WARN_CONSTRUCTOR \
QT_BEGIN_INCLUDE_NAMESPACE \
QT_BEGIN_NAMESPACE \
QT_BOOTSTRAPPED \
QT_DESIGNER_STATIC \
QT_END_INCLUDE_NAMESPACE \
QT_END_NAMESPACE \
QT_FASTCALL \
QT_MUTEX_LOCK_NOEXCEPT \
QT_POPCOUNT_CONSTEXPR \
QT_POST_CXX17_API_IN_EXPORTED_CLASS \
QT_SIZEPOLICY_CONSTEXPR \
QT_WARNING_DISABLE_DEPRECATED \
QT_WARNING_PUSH \
QT_WARNING_POP \
QT_WIDGET_PLUGIN_EXPORT \
QWEBKIT_EXPORT
Cpp.ignoredirectives += \
__attribute__ \
K_DECLARE_PRIVATE \
PHONON_HEIR \
PHONON_OBJECT \
Q_CLASSINFO \
Q_DECLARE_INTERFACE \
Q_DECLARE_METATYPE \
QT_DECL_METATYPE_EXTERN \
QT_IMPL_METATYPE_EXTERN \
Q_DECLARE_OPERATORS_FOR_FLAGS \
Q_DECLARE_PRIVATE \
Q_DECLARE_PRIVATE_D \
Q_DECLARE_PUBLIC \
Q_DECLARE_SHARED \
Q_DECLARE_TR_FUNCTIONS \
Q_DECLARE_TYPEINFO \
Q_DECL_NOEXCEPT_EXPR \
QT_DEPRECATED_X \
QT_SYSINFO_DEPRECATED_X \
Q_DISABLE_COPY \
Q_DUMMY_COMPARISON_OPERATOR \
Q_ENUM \
Q_ENUMS \
Q_ENUM_NS \
Q_FLAG \
Q_FLAGS \
Q_FLAG_NS \
QT_HAS_INCLUDE \
Q_INTERFACES \
Q_PRIVATE_PROPERTY \
QT_FORWARD_DECLARE_CLASS \
Q_DECLARE_HANDLE \
Q_REVISION \
QT_WARNING_DISABLE_CLANG \
QT_WARNING_DISABLE_GCC \
QT_WARNING_DISABLE_INTEL \
QT_WARNING_DISABLE_MSVC \
Q_ATTRIBUTE_FORMAT_PRINTF \
Q_MV_IOS \
QT6_ONLY \
QT7_ONLY
# Qt 6: Remove
falsehoods += \
"QT_VERSION >= QT_VERSION_CHECK\\(\\s*6\\s*,\\s*0\\s*,\\s*0\\s*\\)"
defines += QT_GUI_LIB \
QT_WIDGETS_LIB \
QT_KEYPAD_NAVIGATION
excludefiles += \
"*_posix.cpp" \

View File

@ -23,7 +23,7 @@ HTML.navigationseparator = \
"<span class=\"naviSeparator\"> &#9702; </span>\n"
# Add some padding around code snippets, as we cannot
# currectly style them for QTextBrowser using only CSS.
# correctly style them for QTextBrowser using only CSS.
codeindent = 1
codeprefix = "\n"
codesuffix = "\n"

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