Compare commits

...

818 Commits
dev ... 6.9.0

Author SHA1 Message Date
Shawn Rutledge
2598674694 QTextMarkdownImporter: Fix heap-buffer-overflow
After finding the end marker `---`, the code expected more characters
beyond: typically at least a trailing newline. But QStringView::sliced()
crashes if asked for a substring that starts at or beyond the end.

Now it's restructured into a separate splitFrontMatter() function, and
we're stricter, tolerating only `---\n` or `---\r\n` as marker lines.
So the code is easier to prove correct, and we don't need to check
characters between the end of the marker and the end of the line
(to allow inadvertent whitespace, for example). If the markers are
not valid, the Markdown parser will see them as thematic breaks,
as it would have done if we were not extracting the Front Matter
beforehand.

Amends e10c9b5c0f8f194a79ce12dcf9b6b5cb19976942 and
bffddc6a993c4b6b64922e8d327bdf32e0d4975a

Credit to OSS-Fuzz which found this as issue 42533775.

[ChangeLog][QtGui][Text] Fixed a heap buffer overflow in
QTextMarkdownImporter. The first marker for Front Matter
must begin at the first character of a Markdown document,
and both markers must be exactly ---\n or ---\r\n.

Done-with: Marc Mutz <marc.mutz@qt.io>
Fixes: QTBUG-135284
Pick-to: dev 6.9 6.8
Change-Id: I66412d21ecc0c4eabde443d70865ed2abad86d89
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2025-03-28 12:18:37 +01:00
Thiago Macieira
b5e47fa433 QThread/Unix: fix silly mistake: static was missing after refactoring
Amends commit 6763e25cbc16cf8c54ab9b1ef97030aab9bb0eec, which refactored
        static struct Cleanup {

to move the body if said cleaning up closer to the rest of the clean up
code in QThreadDataDestroyer::EarlyMainThread. But it accidentally
forgot the static keyword. As a result, we attempted to clean up before
::currentThreadData was set yet, resulting in a no-op and no clean up.

Task-number: QTBUG-135044
Task-number: QTBUG-134080
Task-number: QTBUG-133861
Task-number: QTBUG-132697
Task-number: QTBUG-102984
Task-number: QTBUG-132381
Pick-to: dev 6.9 6.8
Change-Id: Ibe40567bba8dea205401fffdb71f7e6a3be130e4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2025-03-25 18:37:13 +00:00
Christian Ehrlicher
c63c918f3a QLabel: don't cache scaled pixmap in QIcon
Caching the scaled QPixmap directly in QIcon is not a good idea
 - the cached pixmap might be used as starting point for a pixmap with
   another size so it gets blurry
 - QIcon has no caching mechanism to throw away unneeded QPixmaps after
   some time so the memory usage grows indefinitely

Fixes: QTBUG-134930
Change-Id: Ic490ba15438a5cd07a555692e1d08cd1c211d005
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7a238e1225f49b81772516ed5d0a5a4f4f2e9268)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 04cb0a1b55cc3c2b402d22f9f7a76b726407dc71)
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2025-03-24 05:35:41 +00:00
Topi Reinio
4c02701ecd Doc: Fix incorrect \fn signatures
Several \fn signatures were either incorrect or missing qualifiers
required to make QDoc match the documentation with the declarations.

These were not caught in the CI when testing documentation builds due
to a bug in QDoc.

Task-number: QTBUG-134250
Change-Id: I7a4af11d9bc3687597b348cc2d4ee15212e0281f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b6a01d7d22583263a16242af604e74bbe694d766)
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit f08721bb3962125f4207a5dccdb4415990161084)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2025-03-24 05:35:34 +00:00
Thiago Macieira
457a863154 3rdparty: update TinyCBOR to v0.6.1
[ChangeLog][Third-Party Code] The copy of TinyCBOR in Qt was updated to
0.6.1.

Manual conflict resolution for 6.9:
- worked around 34f60877bdb54786c62fd1bf5b44a81430aa411f not having
  been picked to older branches

Change-Id: If5d5ef6220874ae8858efffd1712a567597b6317
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 7df128675a22391bc3ade2a45b558bc38eee1c67)
(cherry picked from commit cd395a79993e6d088f0d539d7f2516671524ee53)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-13 19:53:21 +00:00
Thiago Macieira
2f169f9e0c QThread/Unix: split the destruction of the exiting thread's QThreadData
As noted in the comment, we had a chicken-and-the-egg problem with
plugins and the event dispatchers: we need to destroy the event
dispatcher when plugins are still loaded (otherwise we could and did
crash) but we also wanted the QThreadData to exist when the plugins
unload.

The solution for that is to split the work: destroy the event dispatcher
first, then unload pugins, then destroy the current thread's
QThreadData. On ELF systems, this is guaranteed to work because we set
the init_priority to call destroy_current_thread_data() to higher than
QLibraryStore. In other systems, it's a best effort with dynamic
libraries and not guaranteed at all with static builds (don't even
report bugs).

Fixes: QTBUG-134080
Fixes: QTBUG-133861
Task-number: QTBUG-132697
Task-number: QTBUG-102984
Task-number: QTBUG-132381
Change-Id: Ifaa28bb87338f4117d51fffdf721da68c0762e5a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 6763e25cbc16cf8c54ab9b1ef97030aab9bb0eec)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 97b41af2a2e89c9b64a78246cba4778fd12a02f5)
2025-03-13 12:52:48 -07:00
Thiago Macieira
12c4cfb1b8 tst_Q*Application: centralize the mainAppInAThread skipping
By adding a way for the apphelper to let the caller know that it must
skip this test.

Change-Id: I750e7188b8f54cea7278fffd584f8fbf433f496b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 00a30f4312876f6f2919b6a47ff404d503255e2f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 9e18d7ded574dc24fe3b699f9e4ff4eaa471d7e4)
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2025-03-13 19:52:45 +00:00
Volker Hilsheimer
4ad126219e QDockWidget: fix documentation of the new dockLocation property
Follow the standard syntax for property documentation.

Amends cbd2f56c14159a1a566f4e423b910256724fdb6a.

Change-Id: I3557eba1990b684a35ab70f95e7f8ccf33850537
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit df96b28f65ad0ba1094c756929cfcdd9f19e4529)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit c90130a72d17219842b6936a952ccd2e5b3a2a01)
2025-03-12 05:49:12 +00:00
Matthias Rauter
4db483e83a Fix mistakes and inconsistencies in string overview
Amends 80b6f2e63dc537f419186585a528ff749f9ff739

Task-number: QTBUG-133882
Change-Id: I8aa5f79838aba0b7fb73e1b884c1a1ceb96aec9d
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit fcde54148dc3ea433bdcaaa550676cd0ab368673)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit b330d8e06a846d10af3e9ac06e06006e08395e96)
2025-03-12 05:49:04 +00:00
Thiago Macieira
a1c85decc2 tst_Q*Application: avoid race conditions during exitFromThread
Amends commit bfbd1a281dd00c47df315c06e895bf5d53cd8764. I've noticed
this on my Mac, because the main thread crashed at the same time as the
exitFromThread() thread was exiting and was running ~QLibraryStore:

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x106)
  * frame #0: 0x00007ff8020533be libobjc.A.dylib`getMethodNoSuper_nolock(objc_class*, objc_selector*) + 47
...
    frame #19: 0x0000000103839694 QtCore`QCoreApplication::exec() at qcoreapplication.cpp:1454:32
    frame #20: 0x0000000101fc94ea QtGui`QGuiApplication::exec() at qguiapplication.cpp:1993:12
    frame #21: 0x0000000100004b59 apphelper`exitFromThread(argc=1, argv=0x00007ff7bfeff318) at apphelper.cpp:50:5
  thread #8, name = 'QThread'
...
    frame #11: 0x00007ff8020c4f94 dyld`dyld4::APIs::dlclose(void*) + 178
    frame #12: 0x0000000103e82476 QtCore`QLibraryPrivate::unload_sys(this=0x0000600001254160) at qlibrary_unix.cpp:252:24
    frame #13: 0x0000000103e793fc QtCore`QLibraryPrivate::unload(this=0x0000600001254160, flag=UnloadSys) at qlibrary.cpp:561:36
    frame #14: 0x00000001039740c8 QtCore`QFactoryLoader::~QFactoryLoader(this=0x00000001029e5e70) at qfactoryloader.cpp:438:21
    frame #15: 0x00000001039745e9 QtCore`QFactoryLoader::~QFactoryLoader(this=0x00000001029e5e70) at qfactoryloader.cpp:425:1
    frame #16: 0x0000000101eb723c QtGui`void std::__1::__destroy_at[abi:sn180100]<QFactoryLoader, 0>(__loc=0x00000001029e5e70) at construct_at.h:67:11
    frame #17: 0x0000000101eb7209 QtGui`void std::__1::destroy_at[abi:sn180100]<QFactoryLoader, 0>(__loc=0x00000001029e5e70) at construct_at.h💯3
    frame #18: 0x0000000102046762 QtGui`QtGlobalStatic::Storage<QFactoryLoader, (anonymous namespace)::Q_QGS_piLoader>::destroyYourself(nextState=Destroyed) at qglobalstatic.h:61:9
    frame #19: 0x0000000102046736 QtGui`QtGlobalStatic::Holder<(anonymous namespace)::Q_QGS_piLoader, (anonymous namespace)::Q_QGS_piLoader>::~Holder(this=0x00000001029e5e61) at qglobalstatic.h:83:9
    frame #20: 0x00000001020465d9 QtGui`QtGlobalStatic::Holder<(anonymous namespace)::Q_QGS_piLoader, (anonymous namespace)::Q_QGS_piLoader>::~Holder(this=0x00000001029e5e61) at qglobalstatic.h:82:5
    frame #21: 0x00007ff8022f4231 libsystem_c.dylib`__cxa_finalize_ranges + 402
    frame #22: 0x00007ff8022f4052 libsystem_c.dylib`exit + 35
    frame #23: 0x000000010000755a apphelper`exitFromThread(int, char**)::$_1::operator()(this=0x000060000175612c) const at apphelper.cpp:47:9

Change-Id: Ib1c72c7975b247cc2d17fffd6c5de89a95c22dad
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit e6a6757c1485d09a4b7a124d67260f06d8022fef)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 87c790851e9dad7d9f65e2582c047dddedbeb66a)
2025-03-10 13:32:47 +00:00
Eskil Abrahamsen Blomfeldt
54555755f8 windows: Fix rendering monochrome glyphs in color fonts
If we encounter a normal, monochrome glyph in a color font, we
go via the normal glyph rendering code path. But since we are
drawing into a color-capable glyph cache, we need to make sure
the image we draw has an alpha channel.

This was inadvertedly broken by the refactoring in
1b85143d217042876209794bf8d0361b7ce8834f, causing black
backgrounds on all such glyphs. Since the default font in Qt Creator
is a color font, it was noticed when upgrading this to 6.9.

Pick-to: dev 6.9
Fixes: QTBUG-134473
Change-Id: Iee7eb73a5727324e2ff3bacc2d9ae45cb64fd0b9
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2025-03-07 15:12:39 +01:00
Juha Vuolle
11f7ab988e Allow unhandled custom uri-scheme opens to create QFileInfoEvent
On macOS custom uri-scheme opens may generate a QFileOpenEvent that
the applications can handle. However when adding support also for
QDesktopServices::setUrlHandler(), this delivery mechanism stopped
from working because the event was unconditionally consumed /
delivered to only the url handler.

Instead change the logic such that if the url handler does not
handle it, allow a QFileInfoEvent to be created.

Amends: 664c7ffb212eb898ed03f7b19c883400fa027b6b

Fixes: QTBUG-134316
Change-Id: Ib1ed371ef531586bf549cf473b2a54748584d91d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 4755f52c08aac424b18ad94404ca8f7dabf8220d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 0c7bea06c4871d25ebd334512cf1c38879b4b547)
2025-03-07 05:57:35 +00:00
Matthias Rauter
578b4685c0 Correct the diagrams in string overview
Amends 80b6f2e63dc537f419186585a528ff749f9ff739

Task-number: QTBUG-133882
Change-Id: If53f8feb73255f8ba035290944b10af2cdf6baf9
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit feefea87b7130bea23510819ea34b3c620686f53)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 15ea46495fa87640c79e8dbe5aa4ff660511e9d9)
2025-03-07 05:57:27 +00:00
Rami Potinkara
153010d284 Android: bump Android target API level to 35
This patch
-updated target API level to 35 into build tools
-updated target API level to 35 in build.gradle files

Task-number: QTBUG-129461
Task-number: QTBUG-130284
Change-Id: Iebdc99e6f607352652c3f0022f17de60eae97d58
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 997a1fae98d35cd0d4d16f37ab68afe2729ff551)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 07f088d340568a3e47cf5cd487c96a6160354afa)
2025-03-07 05:57:16 +00:00
Assam Boudjelthia
7fdeb99038 Android: account for edge-to-edge in tst_android
When running on Android 15 with target sdk set to 35 (Android 15),
the new edge-to-edge behavior is enforced, so the test needs to
account for that and take the full screen size instead of deducting
the insects.

Task-number: QTBUG-132311
Change-Id: I178265b02878206ba95c8f83507963ce0bd0d732
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
(cherry picked from commit 1f3c5f8f9025057f9a7f6b6143f33a529583ab19)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit a6e68f636e2116d4fc771f1a5a5da8b19620df7d)
2025-03-07 05:57:10 +00:00
Tor Arne Vestbø
b90b473ee0 macOS: Preserve styleMask bits that we don't control when updating mask
We use QCocoaWindow::windowStyleMask to compute a new styleMask for the
NSWindow, based on the QWindow flags. However, some styleMask bits we
do not control in this function, so we need to preserve them in case
they were already set on the NSWindow, as otherwise we end up clearing
those bits. We did this already for NSWindowStyleMaskFullScreen, but now
we do it for all style mask bits we don't control.

This fixes an issue after QCocoaWindow::applyContentBorderThickness()
started calling setWindowFlags to control NSWindowStyleMaskTexturedBackground,
after the introduction of the Qt::NoTitleBarBackgroundHint window flag in
a1e6fed44964a3eb14045bf819d232d6cbad9f59 and then
bddc0198297828ba29e5cf4b39e07412a506a551.

The symptom was losing the NSWindowStyleMaskDocModalWindow style mask
for sheets or other modal windows with a QTabWidget in them, as that
widget ends up calling applyContentBorderThickness().

Fixes: QTBUG-134447
Pick-to: 6.9 dev
Change-Id: Ie3e9ca3ff14f84ce70438d3633bd283fb78b9e8c
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2025-03-06 20:52:26 +01:00
Volker Hilsheimer
3a8ac066e8 Doc: fix documentation warning for QByteArray::fromCFData
\brief tags are not used for member function documentation.
Explicitly set the prototype for qdoc instead, it doesn't seem to
know what to do with the definition in an ObjectiveC file and
produces link warnings.

Change-Id: I89252e7b84586e987ed6d950d90142e916d8f1df
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 03efe9a21bb7a879ae51e3ad007dd2cdb8c6d981)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit cb8a6a5ea90edef666cd769c233f937147fbb436)
2025-03-06 06:09:41 +00:00
Ivan Solovev
52b46a7c46 QFuture: avoid warnings about unreachable code with /W4 in MSVC
... when instantiating the MetaTypeQFutureHelper for QFuture<void>.

Simply enabling /W4 for tst_qfuture also generates this warning, but
also much more. So I'm not providing any unit-test here.

Amends 90d9a86c2e762c9426d0facbd54ed5dbff574ecd.

Fixes: QTBUG-133406
Change-Id: I22a53b872818763b80f333f597ddd19a1c1e30ac
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ff6bf61b17ee4fc8ca11e016242d7c3399a02045)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 7a7c7322fa820425aa4896bb15172e922dc974ea)
2025-03-06 06:09:34 +00:00
Thiago Macieira
b918224987 a11y uia: fix build: MinGW has those macros
Don't do proxy checks for the thing you want to test. Whenever possible,
test the thing you want to test.

We can't check for the definition of certain structs, though. Those have
to remain a proxy check.

Change-Id: I5003e785706cd66923e4fffd6b11254233d09dc5
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9c4c5dc9f9c4358489d138dc4cf5aa6131b1bd24)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 2125135064ad8ce192d861e510eddde4c5946ba9)
2025-03-06 06:09:31 +00:00
Christian Ehrlicher
ab60d805ca QStyleHelper: fix compilation with disabled features
When certain features are disabled, qguiapplication.h does not get
included which results in a compiler error. Therefore add it directly.

Fixes: QTBUG-134235
Change-Id: I7836fc52c5037ca15c7ce48617c9f814d71963aa
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 98653cca453fe3d88807d1a314ae17efadd7c958)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 8b59467d20598527206d43ea1543e4d0961080b1)
2025-03-06 06:09:25 +00:00
Leena Miettinen
76f9e8a0c2 Doc: Use Qt Design System colors also in help CSS
- Replace colors in offline-dark.css
- Do not use the note and attention icons in offline templates

Task-number: QTBUG-133761
Change-Id: I55e81d6c3887764542e23c8f85f4d46e273b3885
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit c770015876390de0cc9c77a3d5b123637204b92c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 9a0716b7281b31fbfc9fdb1d342829c8ec3008b0)
2025-03-05 08:08:26 +00:00
Eskil Abrahamsen Blomfeldt
ecc8ca605c Upgrade Harfbuzz to 10.4.0
[ChangeLog][Third-Party Code] Upgraded Harfbuzz to version
10.4.0.

Fixes: QTBUG-134282
Pick-to: dev 6.9 6.8 6.5 5.15
Change-Id: Ib36df2ae6b0fa4cf667b25d460473d45e8b34350
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2025-03-05 09:08:07 +01:00
Assam Boudjelthia
5634bc529c Android: fix uncompressed libs loading from split APKs
When split APKs, when an AAB is used for example, the native libraries
are kept in a separate APK and not under the main app APK, thus, we
need to use that instead to get the path of the native libs otherwise
the app would crash failing to load Qt libraries.

Amends 0db5b424cdaede8724886e8a1eda1380382d9aaf.

Fixes: QTBUG-134101
Change-Id: I930ba005aaefc15e4500b7290167892dc2428066
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 75367d1cfe564953d980b0c6917257f8ec0faa93)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit b172090299b4296fc2ad60aefe15eea3f27f4bd1)
2025-03-04 07:05:38 +00:00
Christian Strømme
a234b472d7 visionOS: Change how the initial immersion style is set
Set the initial style to be automatic, that's the default. With this
change we also get rid of the warnings shown on application startup
complaining about the application not defining an initial immersion
style:
"Since your app does not define an initial immersion style in its
Application Scene Manifest, the default immersion style will be
applied. This does not match the immersion style defined at runtime
'full'. To make sure your app's state matches its runtime behavior
define an initial immersion style."

Change-Id: I1b8bba5f919b72d4f2507a19a30de49e8bfcd708
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 08146377db8ce782bac5b9561338ba20f7101ac5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-02 16:15:11 +00:00
Axel Spoerl
8633c8e446 tst_QScroller::overshoot(): improve diagnostic output, blacklist on mac
Test is flaky on macOS.
Use QCOMPARE_LT instead of QVERIFY(a < b).
Blacklist on macOS.

Task-number: QTBUG-134105
Pick-to: 6.8
Change-Id: I8f1274ad67bd9ead392ecd0f9c9b7a01dc3edb1e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 7c7731a8229a44050c02d33c7111e4d522909c1d)
2025-03-02 17:15:04 +01:00
Thomas Moerschell
ce7cf1a8b1 QScroller: Fix no overshoot behavior
Correct previously mixed up parameters to pushSegment(). stopProgress
can be set to 1 so stopPos is the only terminating condition.

Pick-to: 6.8
Change-Id: If590555ed08170800b67063aa10e853411180aa3
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 84e09e060bedd37d8de7cded7e430371e335c029)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-02 17:15:02 +01:00
Marc Mutz
bcdd7c260b Long live \constraints!
We have divergence in the way we document function, operator and
constructor constraints. About half use \note, while the other
doesn't. Some say "if and only if" while others say just "participates
only if".

So add a qdoc macro, \constraints, to semantically mark up these
constraints. It expands to a section titled `Constraints`, and
uses a predefined sentence (prefix) for constraints.

Documentation for constraints is moved to the end of the comment
blocks to separate them from the rest of the text.

Apply them to all the standard-ish constraint documentation blocks
(grepped for "participate"). I didn't look for other, one-off, ways
documentation authors may have documented constraints, but I'm also
not aware of any.

Re-wrap lines only if the result fits into a single line.

As a drive-by, drop additional "if"s, as in "only if X and -if- Y" to
make the texts work with the `Constraints` section.

Fixes: QTBUG-106871
Pick-to: 6.8 6.5
Change-Id: I18c2f9f734474017264e49165389f8c9c7f34030
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit b7a67b46e66f161def5bf879f19c66d3fcec1d8b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-02 07:10:48 +00:00
Andreas Eliasson
f87929371a Doc: Improve deprecation description for QApplication::fontMetrics()
Add a link to QFontMetrics, which provides more information about the
differences between QFontMetrics and QFontMetricsF and why the latter
is the preferred choice.

Fixes: QTBUG-127528
Pick-to: 6.8 6.5 6.2
Change-Id: Ib5713a9d39bf312a6eae6b8b1a6d1dc1d47e25be
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit bdf453afd7613d3e88099defb759444537527195)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-02 07:10:47 +00:00
Vladislav Tarakanov
593f69a861 QCupsPrintEnginePrivate: Use "true" for "landscape" option
CUPS treats the "landscape" option as a boolean value
(IPP_TAG_BOOLEAN). In this case, all values ​​other than "true", "on" and
"yes" are considered as false. As a result, using an empty string as the
value for the "landscape" option results in the print area still being
portrait.

Currently, the problem with printing landscape images (png, jpeg, etc.)
in Qt programs (e.g. Okular, Gwenview) occurs on Fedora 41 and other
distributions using cups-filters v2.0+.

The patch adds passing the value "true" instead of an empty string for
the "landscape" option, as CUPS expects for changing the orientation.

Pick-to: 6.8
Change-Id: Ib7ad1e2debcfff10e673757c97ef5614fb59a6ca
Reviewed-by: Albert Astals Cid <aacid@kde.org>
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
(cherry picked from commit a77173486aaf9d2e4107f6e1120ac2316ae1c96f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-02 07:10:47 +00:00
Nicholas Bennett
f5de04d9c4 Docs: Create \Q4A macro for "Qt for Android" and replace instances
"Android" is trademarked and needs to be referenced in a certain way.
The following steps were taken:
-Created qdoc macro.
-Updated "Qt Android" and "Qt for Android" to use \Q4A in qdoc files.

The macro will need to be adopted in all documentation projects.

Task-number: QAA-2836
Pick-to: 6.8 6.5
Change-Id: I4b52247a4ed52047242a06404e6d3aa19de9c16c
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 9c6c6d7d388bee01ea4e5ea102d3b0ed359c3f00)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-02 07:10:47 +00:00
Eskil Abrahamsen Blomfeldt
1a4e2e869f Update Harfbuzz to version 10.3.0
[ChangeLog][Third-Party Code] Upgraded Harfbuzz to version
10.3.0.

Pick-to: 6.8 6.5 5.15
Change-Id: I3a4daaa9c0747c4f4717ac8f0f9e7baf9a9a449e
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 82a3357d007837b1d54dcf6dd6309363649d186f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-02 07:10:47 +00:00
Thiago Macieira
0777144b45 QColorDialogOptions: delete QSettings code and stop saving globally
[ChangeLog][QtGui][QColorDialogOptions] The class no longer
automatically saves settings such as the custom colors to a global
QSettings("QtProject") shared by all applications and no longer restores
custom colors from there. Applications that wish to retain the custom
color settings should use customColors() and setCustomColor() with their
own settings files.

Task-number: QTBUG-133805
Change-Id: I49cd7312054f41ca4cdbfffdcb60d6ea242393fc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 9a753fa656a9bcae4193ceb38cfaf6e21641ddc2)
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2025-03-02 00:46:01 -03:00
Milian Wolff
cc6074c543 Add maybe_unused in benchmark to guard against nodiscard in the future
Requested by Marc Mutz when adding the utc() benchmark.

Pick-to: 6.8 6.5 5.15
Change-Id: I6f97f9e4dab07d10718280b4fb7ac158e42b8d67
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 1f0bcec874dba8adbdf8de34e899565e89e80a38)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-01 23:45:17 +00:00
Milian Wolff
c4618d6020 Add a benchmark for QTimeZone::utc
On my machine this gives me:

```
********* Start testing of tst_QTimeZone *********
Config: Using QtTest library 6.10.0, Qt 6.10.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 14.2.1 20250207), arch unknown
PASS   : tst_QTimeZone::initTestCase()
PASS   : tst_QTimeZone::utc()
RESULT : tst_QTimeZone::utc():
     358.686871 nsecs per iteration (total: 358,686,513, iterations: 999999)
     896.524312 CPU cycles per iteration, 2,5 GHz (total: 896,523,416, iterations: 999999)
     2,227.000427 instructions per iteration, 2,484 instr/cycle (total: 2,226,998,200, iterations: 999999)
     560.000375 branch instructions per iteration, 1,56 G/sec (total: 559,999,815, iterations: 999999)
PASS   : tst_QTimeZone::cleanupTestCase()
Totals: 3 passed, 0 failed, 0 skipped, 0 blacklisted, 374ms
********* Finished testing of tst_QTimeZone *********
```

Profiling shows some quite unexpected code paths that
I will try to optimize in follow-up patches. Note that
this function can be called frequently when deserializing
QDateTime over a QDataStream e.g. - I have stumbled over
it while profiling some KDE PIM code in akonadi.

Pick-to: 6.8 6.5 5.15
Change-Id: I7439df53ae8512c766f63cb4b0d4f33d14aa3a01
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 29c7beac2e0065cc0d03b9db6a701f7c690c6f56)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-01 23:45:17 +00:00
Marc Mutz
8e2c6a5904 tst_QByteArray: check replace() doesn't replace the terminating \0
It doesn't.

Pick-to: 6.8 6.5 5.15
Change-Id: Ica3fb2b8a65d0f9d14490ecdcce72eba82258916
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit fff69288781bf946ad645fd781ad51ab48ebcbdc)
2025-03-01 21:02:09 +01:00
Marc Mutz
c653cf1171 tst_QByteArray: check replace() with empty and null needles and haystacks
Some time ago, we spent a lot of time fine-tuning the behavior of
indexOf() and split() w.r.t. matching of empty needles, or in empty
haystacks. Make sure that (QByteArray) replace() is behaving
consistently.

It isn't. Filed QTBUG-134079 to track the issue.

Pick-to: 6.8 6.5
Task-number: QTBUG-134079
Change-Id: I16af5d2bb5b309a56e81854be434fa9430ae284f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5fc1e9fa0c1925654412af5bf46ff95da99bc190)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-01 20:02:02 +00:00
Alexandru Croitor
dcb72b5315 CMake: Add function to set up SBOM generation defaults
Move the setting up of options like QT_GENERATE_SBOM into a separate
function, that can be called by projects other than Qt.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I337c4e9b0b3154ff97f494887bf88ee01e8ed00c
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit dc5c7f9ead7e47b92c5717ca24d585a718a8b5f0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-01 18:26:19 +00:00
Alexandru Croitor
2769ef7174 CMake: Include license and license file attribution in SBOM comment
Some attribution entries don't have a SPDX license id specified, in
that case it's good to at least include the free-form license name and
file path.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I75bb5c30645684ea74fe94da92ea30eb29965ad4
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit cf9f09cd60e3db37643ac6cf6cfd51aa00749892)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-01 18:26:16 +00:00
Giuseppe D'Angelo
35c18eba64 QColorTransferGeneric: fix the BT.2100 PQ EOTF
The PQ EOTF formula for BT.2100 [1][2] was incorrect. Fix it; while at
it, rename the variables to match the symbols used in the original
formula.

The inverse EOTF was correct, but also rename the variables there (for
the same reason).

[1] https://www.itu.int/rec/R-REC-BT.2100-2-201807-I/en
[2] https://en.wikipedia.org/wiki/Perceptual_quantizer#Technical_details

Change-Id: I6ce3a609824bee82053a16b3ff3cfc7cb396ce8f
Pick-to: 6.8
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit a7ff4679facb9a44dff8b63a7e461ababa6aedfb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-01 11:57:55 +00:00
Ulf Hermann
b9169c1210 QByteArray: Make gcc 12 happy
It somehow concludes that asize may be negative and would then cast to
an obscenely large size_t. This produces the following warning:

.../qbytearray.cpp: In member function ‘replace.constprop.isra’:
.../qbytearray.cpp:2579:23: warning: ‘memcpy’ specified bound between 9223372036854775808 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
 2579 |                 memcpy(d + to, a, asize);
      |                       ^

Check for asize > 0 rather than asize != 0.

Pick-to: 6.8 6.5
Change-Id: I63bccb1bf3ff45d539af4efe6843d2c648d7cb86
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 177cd123d29f818413db4bb7a9d92b8485c95947)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-28 23:15:07 +00:00
Eirik Aavitsland
8159f4626b Raster engine: Fix painting of zero length, square cap wide lines
Such lines are rendered by drawing a capless line that is pen-width
long, i.e. a square, to represent the two line caps. However, the line
length offset was added before any transformation, so one could end up
with a long line being rendered if the world transform had a large
scale, say.

Pick-to: 6.8
Change-Id: Idff8a2de54c97e35facc8f4e09c43dfea7397588
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 56de11397559af3b9694ef2b99d93a469889ae5e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-28 20:05:00 +00:00
Laszlo Agocs
e71708a6e5 rhi: d3d: Fix 3D textures exposed via UAV
The docs for D3D11_TEX3D_UAV do not mention accepting -1 as WSize,
unlike D3D12_TEX3D_UAV. Hence passing in m_depth for D3D11.

Fixes: QTBUG-129300
Pick-to: 6.8
Change-Id: I517d23e076039543361d2bca1b91cddd47abcfaa
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
(cherry picked from commit 6f89357f59b507c0dcdc177bc1ecfbbc94d6fed3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-28 12:12:05 +00:00
Marc Mutz
d561d864eb QByteArray::replace(): use std::string instead of QVLA<char>
QVLA preallocates space for 256 entries, and while that should be
enough for most uses, it may be too much in the way of stack usage.

Instead of using a QVLA with a non-standard preallocation, use the
more compact std::string benefitting from its SSO.

Pick-to: 6.8 6.5
Change-Id: Ia22543fb287a1976f316f7a4d27b23a22f511463
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 7c21630ce625817f1dc8e7182023b3fc6d36ac37)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-28 10:50:03 +00:00
Jani Heikkinen
b0e9665e7d Revert "Revert "Android: update to Gradle 8.12 and AGP 8.8.0""
This reverts commit 22f33e1bd2c43e0223cd52b94e6ecead56a2e1b5.

Reason for revert: Needed provisioning changes are now in

Change-Id: Ibc1d1833942394efec0c24dc7e7a3e6ada5b8eea
Reviewed-by: Jukka Jokiniva <jukka.jokiniva@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
2025-02-28 10:04:46 +00:00
Alexandru Croitor
37c60080dd CMake: Handle installing files with same name during SBOM generation
It's possible for a project to install a custom file with the same name
into different destination directories, and want to include them in
the SBOM.
Previously this failed at CMake generation time with an error like:

CMake Error: Files to be generated by multiple different commands:
qt_sbom/SPDXRef-PackagedFile-foo-bar.cmake

This happened due to using a non-unique filename for the generated
SBOM building file, as well as the spdx id the file name is based on.

Include a short hash based on the installed relative path of the file
to avoid spdx id clashes, and thus generated file name clashes.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I4c2ecd4652708504ef299af9b6f53d680d542382
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 9245d0a0f0761364e7b5b3d1c5c96cba16522820)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-27 19:19:48 +00:00
Alexandru Croitor
5fd8af81ad CMake: Handle DIRECTORIES in SBOM custom file sets
Previously one could only pass an explicit list of FILES to
_qt_internal_sbom_add_files. Add a new DIRECTORIES option, which will
glob the given directory paths, and include the found files in the
SBOM.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: Ia27afa93460d9f2e4462a49e30e4d6338300e8f7
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 9db03c9dca1b7e403458fd9f43adb17a0ac8e55c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-27 15:57:45 +00:00
Alexandru Croitor
8a1dcd2bb9 CMake: Extract Qt-specific license concluded handling
Extract the handling of the license concluded expression for Qt
entities into the Qt specific handling file.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: Ib6f9a64f66dae0c971c43e8fffbc54362487b271
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit ba93956be1179e4b4afaaecdf53b918b724cf500)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-27 15:57:44 +00:00
Alexandru Croitor
1f8a8da7c2 CMake: Unqtify THIRD_PARTY_SOURCES handling for SBOM attributions
Nested SBOM attribution targets were always created with the
QT_THIRD_PARTY_SOURCES type even in user projects.
Set an appropriate type depending on whether we are handling a qt
entity type or not.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: Id8144d1b8093de78f2987a611a6de8e6d4777084
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 0d9106bf7670b08c4bae11c3986b9cf3e0818b52)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-27 15:57:43 +00:00
Alexandru Croitor
68856adf1d CMake: Add a new SBOM entity type: THIRD_PARTY_SOURCES
It mirrors the Qt-specific QT_THIRD_PARTY_SOURCES one, to be used when
creating an SBOM attribution target that references a 3rd party
library's sources, as opposed to a complete 3rd party library.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I8f7f9f7386ffdc18dd8ae6ee32e39019639f5303
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 8b06d37fb08d22e9f81ae2653aeafc105fc5bb61)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-27 15:57:41 +00:00
Alexandru Croitor
db7e6d6fed CMake: Remove leftover code after refactoring
The assignment is not used anywhere.

Amends f1ac316191c010b1389f6f3549c9f0b4424b9936

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I3e6326b2782ab42dee8219353953ee6f4378ccfb
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 17c482d818facd8f7d821aac87876ae079ff79d4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-27 15:57:40 +00:00
Alexandru Croitor
8d8cf0bbfe CMake: Re-order SBOM embedded qt_attribution.json fields
Put the attribution file path and entry first, followed by the id,
and the rest of the fields.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I478a48980e6207646189d6b80ec57dbc9efb4902
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit a5c7eb97ceb19ac90f8117240ad04cc717803555)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-27 15:57:38 +00:00
Alexandru Croitor
c276fa45dc CMake: Allow creating nested SBOM attribution targets for all entities
Allow creating nested SBOM attribution targets also for non-Qt targets
in user projects. This will allow using qt_attribution.json files in
user projects.

Rename PARENT_TARGET to ATTRIBUTION_PARENT_TARGET to make it clear
what the parent target is for.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: Ia08ee934a9dc03827fcc26d0fc90e072499e8a21
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit a2ddd4fbd88353b21617e539266196b592683a3a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-27 15:57:37 +00:00
Alexandru Croitor
21c5970da4 CMake: Allow including specific attribution ids in SBOMs
Previously one could attach all attributions from a
qt_attribution.json file to a target, or a specific entry based on a
given numeric index.

This is not always practical, as the index of an entry can change, and
including all entries might be too much.

Allow specifying a list of attribution ids to include in the SBOM.
This will parse all the attribution entries and only include those
that match the given ids.

If a list of ids is provided, and any of them is not found, an error
will be shown.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I2ca442fe0cd6d18773861f90f32ab7380aaeacdd
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 52045e51e7e95f31a37127215c53e430fa77c8d3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-27 15:57:35 +00:00
Alexandru Croitor
1dc3a9cac2 CMake: Sanitize nested SBOM attribution target names
To avoid issues with characters like "/" which might come from
attribution ids.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I65bec3b301f7fe1008cfd06aba3e1fbbb93f38c3
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 4a0b5661fdd1f1120018efb5f08bfbc1ed16cc13)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-27 15:57:34 +00:00
Alexandru Croitor
59745fc798 CMake: Remove type restriction on attribution file extra SBOM info
So it can be used in other non-Qt projects.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I11d81d2c6819906fffbffe81f4db1b7af28cb99b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 6cd7f0c09b71ea49bdd3dd925b9a85dfe6cc943e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-27 15:57:32 +00:00
Alexandru Croitor
bccb4c8328 CMake: Remove type restriction on attribution download location
So it can be read / used in other non-Qt projects. We don't have such
a restriction on other keys read from the qt attribution files.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I225d83b26c68323761a8b13b3e6442057b5f7c7f
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 422f5d859f3056433e6ee33ea389f2ecff1543d5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-27 15:57:30 +00:00
Marc Mutz
0e7f52c872 tst_QStringTokenizer: check when the lazy range may be empty
Only when using SkipEmptyParts...

Pick-to: 6.8 6.5
Change-Id: I7dd67b801fa0deaab14eb7bb7e9905f60891ec48
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit cef7892135b4fccc85512629e8bee76ddfbc3240)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-27 15:11:35 +00:00
Alexei Cazacov
18dd4f9479 Doc: Move 'Classes for string data' topic to Qt Core and add it to TOC
Fixes: QTBUG-133954
Change-Id: If51abefc39eaae29f7d533af2974017793ef9358
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
(cherry picked from commit baeed8e1e75db988aa53aa56353aa9c1f821b542)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-27 15:11:33 +00:00
Konsta Alajärvi
31e6f4a2ca Unblacklist tst_qrhi threeDimTexture()
Unblacklist tst_qrhi threeDimTexture() test function, by skipping
it with Android OpenGLES.

Fixes: QTQAINFRA-6333
Pick-to: 6.8
Change-Id: I795dd73fc7b35ab065f206030458088d829be9c8
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit d8f75f34c94aadff98722ec236a43115dfae8956)
2025-02-27 09:27:51 +00:00
Sze Howe Koh
206a8fec2c [Doc] QObject: Sync warnings of isSignalConnected() and receivers()
Extends e75c1a00e31723f1c9deb8427725fa0a58fae2a8 because calling
receivers() in disconnectNotify() can deadlock too.

As a drive-by, some statements are generalized further:
* "expensive initialization" -> "expensive operations" since that is
  what the relevant snippets actually show.
* The potential race condition is not limited to "after this function
  returns and before the signal gets emitted"

Task-number: QTBUG-106025
Change-Id: Iff014706b9e8d8147e3bbb9ac51542197eec5db3
Pick-to: 6.8 6.5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f5b874fd2d393b783dad85c95a158383420e481a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-27 06:57:25 +00:00
Thiago Macieira
54ef8bf929 Use QThread::isMainThread() in a few places
It's thread-safe, whereas trying to load qApp isn't in Qt 6.x (will be
in 7.0) and dereferencing it to call QObject::thread() will probably
never be. It's also faster, being a single function call instead of two
or three.

This is not an exhaustive search, it's just a few places I found while
searching for QThread::instance().

Pick-to: 6.8
Change-Id: I3b4e1c75bb3966e2cd2dfffd79bfc8a40f6cf40b
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 6fb39ca2cbb111469ce09c8342997eb5375e3239)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-27 06:57:25 +00:00
Ahmad Samir
d47af17a0d QDir: improve mkdir/mkpath API docs
Pick-to: 6.8 6.5
Task-number: QTBUG-132633
Change-Id: Iafe4a20bacbbf55d19377e8cd04f940d4f2a66f6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 23981aae0e059d876d441bfffae9d9d0fd671bde)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-27 01:04:10 +00:00
Rami Potinkara
d2f48abeb5 Android: update Android SDK to version 35.0.1
This patch updates the macro AndroidBuildToolsVer to
version 35.0.1.

The version 35.0.1 is used elsewhere, see
b49421a984ac2b203b7995f3787b67184c990089

Amends: 9b475eadfcf04194a094454f65295c3a456000a4

Task-number: QTBUG-129462
Pick-to: 6.8 6.5
Change-Id: Ic15e12c563fa3d16315daa13b6f6b6ef19535954
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
(cherry picked from commit 7a7093eb87ebc986555b855611018066e2c39bed)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-26 21:27:28 +00:00
Giuseppe D'Angelo
79539c50cd Q_DECL_EQ_DELETE_X: properly version the check for Clang
Clang 20 has fixed the referenced issue. Once more this shows the
importance of versioning compiler-related checks...
Amends 1b1ae345025d1cac953985d4cfebd20fadb6bc99.

Change-Id: Iea88d466883562b0130639d7c0f2f3b984acdbc2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit fb1824a9d669c601ebd540c9ca16a9687d7d9706)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-26 20:13:12 +00:00
Cristian Le
926abdce78 Bundle Kitware's RunCMake test module
Introduce a new module `TestInternalPrivate`.

Kitware's RunCMake allows to create more granular unit tests using
`cmake -P` scripts instead of configuring, generating and building full
projects.

[ChangeLog][Third-Party Code]
Add upstream cmake's RunCMake test infrastructure module to
src/testinternal/3rdparty/cmake to aid in creation of cmake auto-tests.

Pick-to: 6.8
Change-Id: I08cb7c6dc6f61bde29f176d58295f4f660b34ca8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 39e7946cb6562c6f9b1baf5c44b1694922d0538e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-26 16:06:36 +00:00
Alexandru Croitor
143b016277 CMake: Add quotes around QT_DEBUG_OPTIMIZATION_FLAGS compiler flags
To more easily spot white space differences.

Pick-to: 6.8
Change-Id: I1e07960f78c95ca536243ce5c4fc6c302c47a7db
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 2dd0c4520fdee50a3511ca2f83decdf807ba2cb3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-26 16:06:35 +00:00
Alexandru Croitor
38835684b3 CMake: Fix full rebuilds when using MSVC and reconfiguring the build
When reconfiguring an MSVC -release build with 'cmake .' after a full
build, instead of being a no-op, it rebuilt everything.

This happened because of CMAKE_CXX_FLAGS_RELEASE being accidentally
modified on each reconfiguration, resulting in extra whitespace being
added to the compiler command line rules.

Specifically, this was because we always added '-O2 -Ob3 ' as a string
to the compiler flags, but due to stripping, always tried to remove
only '-O2 -Ob3' (no trailing white space) when removing the
optimizations flags, resulting in an extra white space for each run.

Remove the trailing white space after '-Ob3 '.

Amends 2fb134f3fe8fdeb1f36c346cff3b09a2b7a095a7

Pick-to: 6.8
Change-Id: I46eb4c3b769ae6b063fe62df05c0cb92f13bda30
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit fdb9a5141446ed8aa767d88a921c24221b0704ea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-26 16:06:34 +00:00
Cristian Le
1fa408f328 Make AdditionalTargetInfo.cmake optional
Pick-to: 6.8
Change-Id: I8b8d6383b6c50e9403bc90e76d4da8eb6c314854
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 2433d02856bb55150d62d84b71b7d8a90c0ce81f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-26 16:06:33 +00:00
Cristian Le
0bd6b909ab Add interface to install EXTRA_CMAKE_FILES in other paths
If the source file sets `QT_INSTALL_PATH` property, it will install the
CMake files in the relative path starting from the config-dir in both
the build and install paths.

Pick-to: 6.8
Change-Id: I86197d62bfac96f9c142d8abfe85c9b6f6f1a527
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit aef789ad97ee9b8f3254a0e315a0d8a4785bcbf7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-26 16:06:30 +00:00
Eirik Aavitsland
5f3708e190 Update bundled libpng to version 1.6.47
[ChangeLog][Third-Party Code] libpng was updated to version 1.6.47

Pick-to: 6.8 6.5 5.15
Change-Id: I11a0f266dddaad480a7700c3cdc4ec6da8de2fae
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 8b75f4735b36a77b6426c7dab55190416e6a4af5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-26 07:45:35 +00:00
Giuseppe D'Angelo
dbd149375b Docs: uppercase spelling of utf-8
It should be spelled UTF-8 (official name by the Unicode Consortium).

Pick-to: 6.8
Change-Id: Ib358d0870e77f0cb4cdb920ed5ca829f100707a1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 0770171dcda24a567d6f57b87fdd284011e56e16)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-25 20:35:41 +00:00
Fabian Kosmale
34625db91a qt-cmake-create: Modernize QML template
- Do not use a version for the executable module target
- Rely on QTP0001 for the RESOURCE_PREFIX (via
  qt_standard_project_setup)
- Do not use OUTPUT_DIRECTORY to avoid a URI mismatch, potentially
  causing issues with the implicit import. Instead, use
  RUNTIME_OUTPUT_NAME to avoid a conflict between folder and executable
  name.

Change-Id: Ic6188d96042e7b34eb3f423daf2b57290ca18a11
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit e84145d6c14e92c3a499904f70046bc3ceee5960)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-25 03:04:43 +00:00
Michael Weghorn
6f559732cf QWizard: Drop obsolete sentence in QWizard::currentId doc
Commit 2140edaaab0bf61f354db521efca773568becc56 introduced
QWizard::setCurrentId that allows setting the property
directly, so drop the obsolete sentence in the QWizard::currentId
doc stating that this isn't possible.

Pick-to: 6.8 6.5
Change-Id: I5e7da2323e66a6e8bfd653dfebcba4363023b744
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 71246cbdc64c4a5b3b3859421221bcc36c4a61c3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-24 23:57:34 +00:00
Alexey Edelev
16639502a7 Make PlatformGraphics lookup QUIET
Let's do not litter user's logs with our internals.

Pick-to: 6.8
Change-Id: I79e9210960f1298a6e8e2b6f10e1bfefdbfede7f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit f9a05c7cae10c05b701003f8ed848d0bfef8290a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-24 22:38:38 +00:00
Lauri Pohjanheimo
3fe904e231 RenderToRgb10Texture test unblacklisted
On CI an Android emulator with SwiftShader software graphics
implementation is used. SwiftShader implementation is unable
to emulate this OpenGL functionality.

Blacklisting removed. QSKIP the test if it is run in Android platform,
OpenGL and SwiftShader sw graphics implementation is found.

Task-number: QTQAINFRA-6331
Pick-to: 6.8
Change-Id: I4a7e64e464ea04409154be2e7b3135ecd88a29fc
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-02-24 09:16:05 +02:00
David Faure
ebbf2d298b Document the default value for QAbstractItemView::editTriggers
Change-Id: I4456dcfcecf739299533167867208e1943bc4a26
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
(cherry picked from commit 408959c8c85badfcd374b21fb2e6071c40e5cba4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-23 12:15:39 +00:00
Thiago Macieira
9593852f24 CBOR: remove QT_X11_DEFINES_FOUND dead code
Amends commit be0f1af3f1829da0d321c12dbd40d5743d3b2eb5 ("CBOR: remove
the X11 True and False for good"), which removed the #define from the
top of the files, but didn't remove the checking of the macro from the
bottom of them.

Change-Id: I92e76842a4117f6feed3fffdac2fcec01367101e
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 00f3ca950a6cab105c95b53ce2b3b93282abcea8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-23 07:56:00 +00:00
Thiago Macieira
fab3e958da QT_TEST_EQUALITY_OPS: insert QCOMPARE before the current code
The macro, as it was, makes debugging REALLY hard:

FAIL!  : tst_QStorageInfo::operatorEqual()
 The computed value is expected to be equal to the baseline, but is not
  Computed (lhs == rhs)   : 0
  Baseline (expectedEqual): 1
  Loc: [qcomparisontesthelper_p.h(178)]

It prints the location of the macro helper, not the line that called it,
so one has to guess which of the many uses in a function has failed. And
it prints the boolean of whether the comparison result is the expected
value, not the values of left and right.

QT_TEST_ALL_COMPARISON_OPS also needs a similar fix, but I don't have
time for it. Ideally we'd replace the qScopeGuard with a proper QTest
failure report, which would extract the printers for Left and Right.

Change-Id: I7a643066137c5fcdb9e7fffd83d9bf7cf4cccd6c
Reviewed-by: Rym Bouabid <rym.bouabid@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 4a4c4252919d4894c7e5c6f2e636dda5dc1b1d0d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-23 01:34:06 +00:00
Christian Ehrlicher
5518a384b2 SQLite: Update SQLite to v3.49.1
[ChangeLog][Third-Party Code] Updated SQLite to v3.49.1

Pick-to: 6.8 6.5 5.15
Task-number: QTBUG-132862
Change-Id: I544a7e2435315469fc174e2b2bf8c9ddbcf78c06
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit bc06c7c61a4fe8fb695d581e43779fa5351febbf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-22 23:02:47 +00:00
Eskil Abrahamsen Blomfeldt
e51d03e334 Escape calculating vertical windows-metrics if they're too big
This amends 073fae097ce40bee1532c252a8c696840b5dfc16 which added
an escape before calculating the vertical metrics if they were too
big and would overflow. It missed one spot, which was when using
the winAscent/winDescent instead of the typo-metrics.

Change-Id: Ib6a7705f6676c66bfd04b37efa30fe2d1b99581c
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
(cherry picked from commit f846754663aae1652e4eec9a441ee222af352319)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-21 23:23:28 +00:00
Alexandru Croitor
dbfd84ae4c CMake: Rework SBOM PURL handling
Previously, only 3 purl entries could be added to a target, which
tightly coupled to Qt's needs: a QT one pointing to code.qt.io,
a MIRROR one pointing to github, and an upstream one pointing to some
upstream third party location.

Rework the implementation to allow for an unlimited number of PURL
entries and to allow more flexibility when adding PURLs in a user
project.

The new syntax for adding PURLs to a target, which is also the basis
for a future public API is as follows:

qt_internal_add_sbom(<target>
    PURLS
        [[PURL_ENTRY
            PURL_ID <id>
            PURL_TYPE <type>
            PURL_NAMESPACE <namespace>
            PURL_NAME <name>
            PURL_VERSION <version>]...]
    PURL_VALUES
        [purl-string...]
)

The PURLS keyword is used to specify multiple PURL entries, each
starting with the PURL_ENTRY keyword. The PURL_VALUES keyword is used
to specify a list of pre-built purl strings.

PURL_ID is an optional argument used to identify a specific purl
entry, which is mostly needed for Qt's needs, to post-process them
further.

The rest of the options are pre-existing from the previous
implementation.

Implementation-wise, there's a new custom parser to be able to parse
and validate PURL_ENTRY arguments.

The VERSION option was renamed to PACKAGE_VERSION, to avoid some
issues in cmake_parse_arguments parsing with nested VERSION options.

The NO_PURL option was removed because it makes no sense in the new
implementation, because if you specify some PURL arguments, there is
already an intention to generate a PURL entry.

Qt entities no longer have a restriction on which specific purl ids
they can have.

The new Qt specific purl IDs have been renamed:
- QT -> GENERIC
- MIRROR -> GITHUB

Amends f7e1123620b623be0c321b54eaba7a1d618a7ce1

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I050decece1c6d9e6e0e06547043f864d6f497ea7
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit a28a9e194cbcaf501c93df988c7dc6f5e09ee5d1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-21 19:49:41 +00:00
Alexandru Croitor
2d51fc3c69 CMake: Move generic PURL function from qt-specific file to main one
Move generic PURL function from qt-specific file to main one. It was
mistakenly added to the wrong file during the initial split.

Amends f1ac316191c010b1389f6f3549c9f0b4424b9936

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I1884f53ee7d30a25b873d85ee04b8c8d1e0532f5
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit fd622bc3ae90ba27069744bf61524139f1642872)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-21 19:49:41 +00:00
Alexandru Croitor
a70a4f65fe CMake: Move more Qt-specific SBOM PURL functions to the right file
The Qt specific functions belong in the
QtPublicSbomQtEntityHelpers.cmake file, not
QtPublicSbomPurlHelpers.cmake.

Amends f1ac316191c010b1389f6f3549c9f0b4424b9936

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: If5dd77672306c520404b294a6b5bde4f0e6ab8bc
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit e7cdf9d4385f02fa82e2d9f23abb8aa06f9440b4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-21 19:49:41 +00:00
Wladimir Leuschner
b1979646fb QWindowsTheme: Set highlight color to accent color in light mode
GetSysColor(COLOR_HIGHLIGHT) did not report the right highlight color in
light mode palette, Leading to a wrong accent color on
Windows. This patch uses the accent color analog to the dark mode
palette for QPalette::Highlight.

Fixes: QTBUG-130458
Pick-to: 6.8
Change-Id: If21f392e31c3187c28e871919ff17f417c8d144b
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit a55db2cbee914d7bdc5678f35da297b79aec7613)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-21 14:54:42 +00:00
Toni Saario
1a5499ce5f Coin: Extend VxWorks restart matching to RTPLib errors
Running many tests on the VxWorks in the emulator without
restarting it between can cause exhaustion of some
resources and cause an RTP spawn fail in some tests.

This change will restart the emulator in such cases, which
allows the test to try again on fresh boot.

Change-Id: I5ad715f243867d43b055271d6bc61ca4ccb3089b
Reviewed-by: Simo Fält <simo.falt@qt.io>
Reviewed-by: Michał Łoś <michal.los@siili.com>
(cherry picked from commit 5be7a9773e106f9675e8d57121c298539f4ce343)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-21 14:52:54 +00:00
Marc Mutz
56c05f47f6 QByteArray::remove(n,n): minor code cleanup
The result of d.begin() is only used in one of the branches, so
defining it outside both branches is a bit unmotivated; instead, drag
toRemove_start out of the else branch and reuse it in the then branch,
too.

Amends 358b7a9e747549f85c1d1631dfb21210b52b36f5.

Pick-to: 6.8 6.5
Change-Id: I162d72de7097a1257c8a0a01b69c36fc87466114
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 2831ce613fdaebe94e35a8afe45a057004548991)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-21 13:28:47 +00:00
Marc Mutz
72f41f8756 QByteArray: delegate to replace(char,char) from replace(QBAV,QBAV)
Don't go and build (among other things) a Boyer-Moore table for the
trivially optimizable replacement of single characters with single
characters. Just call the existing replace(char, char) overload.

Pick-to: 6.8
Change-Id: Ic69527bdaa5ce95bf937295366b94366e2ace933
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 60af93847e365fc00ccc4bcf61bb90ef6da1f0b2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-21 13:28:41 +00:00
Marc Mutz
6cefb8be96 QLocale: fix UB (signed overflow) in formattedDataSize()
Coverity complains that qCountLeadingZeroBits() may return 64 and then
the RHS will be out-of-range for int. Of course, 64 leading zero bits
means that the argument is 0, which we excluded in the first `if` of
the if-else chain.

I can only guess (because it doesn't tell me which value of `bytes` it
is using for the analysis) that Coverity assumes bytes ==
numeric_limits<qint64>::min() and considers the overflow in qAbs() to
yield a 0, because, it being UB, it may yield anything.

Be that as it may, the fact remains that formattedDataSize() invokes
UB when passed numeric_limits<qint64>::min(), as confirmed by ubsan:

   global/qnumeric.h:479:26: runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself
   text/qlocale.cpp:5062:82: runtime error: signed integer overflow: -2147483648 * 3 cannot be represented in type 'int'
   text/qlocale.cpp:5062:26: runtime error: division by zero
   FAIL!  : tst_QLocale::formattedDataSize(English-Decimal-min) Compared values are not the same
      Actual   (QLocale(language).formattedDataSize(bytes, decimalPlaces, units)): "-inf bytes"
      Expected ("output")                                                        : "-9.22 EB"

So fix the overflow by using the new QtPrivate::qUnsignedAbs(). Then
sit back and await Coverity's verdict on the next run.

[ChangeLog][QtCore][QLocale] Fix issue when calling
formattedDataSize() with numeric_limits<qint64>::min().

Amends 9d23aebb271ea534a66cb3aceb2e63d9a1c870d6.

Pick-to: 6.8 6.5 6.2 5.15
Coverity-Id: 474294
Change-Id: I9a5a5acbdcf881a624bb827ca1dd970771f1bb6e
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit b93575de01760ff2ab0d817557a642c71cdb4414)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-21 13:28:39 +00:00
Marc Mutz
9479f9bbfc tst_QCryptographicHash: remove remnants of BigData split
The ensureLargeData() and 'large' members were only used in BigData
tests that have since moved to a different executable.

Amends fff217824b532da7306af1ac755581e76e098a27.

Pick-to: 6.8 6.5 6.2 5.15
Change-Id: Idc99a868e082098dda4e1bee62470370c7e20f62
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 5cd046f154a0a31635c935bf6c9f1abd27837b80)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-21 13:28:37 +00:00
Marc Mutz
646bea85a5 QByteArray: don't recurse when needle or replacement alias *this
While the idea to delay the construction of the QVLAs until we know we
need them is elegant, we're doing a lot of checks twice or thrice this
way, so merely re-set the a, b pointers and otherwise continue
executing.

This requires us to default-construct the QVLAs before potentially
assign()ing to them, but that ought to be cheap, given the compiler
can see everything that's going on in QVLA.

Pick-to: 6.8 6.5
Change-Id: I4e42d5ab48711af91cc1785171524be5fb45ae2f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 4308ab70cafa4398aa72dfe63bc580a6ecff9e52)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-21 13:28:34 +00:00
Patrick Stewart
09c093f969 Close the Qt namespace even when QT_NO_TRANSLATION is defined
Pick-to: 6.8 6.5
Change-Id: I5e463b81f7e73b2946a0e3b3036a09de2105307b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c9c8abb52d4ba77c551513baf678be0761d1c895)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-21 11:46:18 +00:00
Christian Ehrlicher
3cd991037d QSqlTableModelTest: misc cleanup
Cleanup QSqlTableModelTest:
 - use pmf QSignalSpy ctor
 - use QCOMPARE/QCOMPARE_GE instead QVERIFY where possible
 - properly close additional databases so temporary folders created for
   sqlite can be deleted on exit

Pick-to: 6.8
Change-Id: I84e8960b81128c141a0e2cd6d03837c9b5ac6652
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit a47dc990793a1e299e9ba869e1d6c76fa0bf9d65)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-21 11:46:16 +00:00
Joerg Bornemann
3c178b40e7 configure: Fix the -sbomdir argument
The argument must be added in qt_cmdline.cmake to work.

Pick-to: 6.8
Change-Id: Ic256c0fda0caf3794b37ad8c5e8b6515fb45b0e6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 5971e94bafacfebdcd28ef84a7cfea61ffd48689)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-21 10:52:15 +00:00
Thiago Macieira
81443770ce QDirListing: std::exchange is <utility> not <memory>
The Clang analyser in Qt Creator was letting us know that <memory> was
unused in this header. Also, this is Include What You Need.

Pick-to: 6.8
Change-Id: Id7c260818f9e84847971fffda11da096169a0047
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 9dc8bc80de03ccf52fabf63855128c5852d51605)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-21 03:21:18 +00:00
Even Oscar Andersen
87e28fc8ec wasm: call focus on window if not editable
We used to call focus on the input element even for things
like pushbuttons.

This will display a keyboard on android, instead call
focus on the focus window.

Fixes: QTBUG-133781
Pick-to: 6.8
Change-Id: Ide4d6ec21a14f17b40d3d3de077c0ab073682f19
Reviewed-by: Lorn Potter <lorn.potter@qt.io>
(cherry picked from commit 442e2f4aeb2081c1b8344a8f5cc2c6f2e7bb7d5b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-21 00:03:29 +00:00
Tor Arne Vestbø
9fbb8e0090 iOS: Set LD_ENTRY_POINT for generated Xcode project
We normally override the entrypoint to _qt_main_wrapper via the -e flag
to the linker, but if a Swift file is added to the Xcode project, Xcode
does some magic, building the app as a shared library, and wrapping it
with the Swift code into a custom executable. The -e flag will then be
a noop when linking our shared library.

To work around this we set the custom LD_ENTRY_POINT Xcode build setting,
which triggers Xcode to pass -e when linking the wrapper-executable.

This works in practice, but produces a warning on the console that the
entrypoint is not found, which has been reported as FB16519113.

Fixes: QTBUG-133577
Pick-to: 6.8
Change-Id: I9d8310b39ac5a4900693df55c2e5bfa346c0300a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 430ba7c0f826ee6f91fbfdc861525cb62b8e725c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-20 19:11:47 +00:00
Wladimir Leuschner
4488dfcbf6 QWindows11Style: Add horizontal offset for Qt::AlignVCenter Labels
The progressbar label overlaps with the progressbar grove, when
vertically centered aligned. This patch adds a y offset to the
label, in case it is vertically centered to avoid the overlap.

Fixes: QTBUG-128458
Pick-to: 6.8
Change-Id: Iac977f83f09c2e4d12d1e0ed5f0eab3120c07b96
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 564633f9d4e4cc8fa361de8165a9dfb203b7248e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-20 17:36:15 +00:00
Eirik Aavitsland
87e53579ea Windows: Fix rounding error in BitmapInfoHeader calculation
A potential rounding error in calculating the padded scanline length
could lead to the biSizeImage field being assigned a too small value.

Fixes: QTBUG-133782
Pick-to: 6.8 6.5
Change-Id: I251212cf2859f7268fc8ad6ca1cbc57f2bb1f1c0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 3d389ee2ac6478a470f19e73826a3889dd117337)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-20 17:01:13 +00:00
Alexandru Croitor
9491249fc6 CMake: Avoid warnings _qt_internal_sbom_replace_qa_placeholders
We should only pass the VERSION option if we have a value to pass.

Fixes warnings like the one below when using CMake 3.31:

CMake Warning (dev) at cmake/QtPublicSbomAttributionHelpers.cmake:511
(cmake_parse_arguments):
  The VERSION keyword was followed by an empty string or no value at
  all.
  Policy CMP0174 is not set, so cmake_parse_arguments() will unset the
  arg_VERSION variable rather than setting it to an empty string.
Call Stack (most recent call first):
  cmake/QtPublicSbomHelpers.cmake:954
  (_qt_internal_sbom_replace_qa_placeholders)

Amends bc3bbb51b7b48d3c4a44a432441938863582242c

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I671a9153d72b21b6aed2112bea45f577a5cee4eb
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 4174f388e6804fb138f625aab3eb75b90c2c7bd4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-20 17:01:11 +00:00
Mate Barany
5581c62922 Do not keep the headers and message body in case of temporary redirect
The implementation of GET requests with body (QTBUG-112871) keeps the
body after it has been redirected. However, in case of temporary
redirect (status code 307) this seems to be an incorrect behavior.

Reset the headers and the body in case of temporary redirect.

Pick-to: 6.8
Change-Id: I10be702b017a42cca27a37dfe2249da2f59c0328
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit f6a5c7e011d24db22afa5a3bf92749b9bb9e9354)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-20 15:12:31 +00:00
Eskil Abrahamsen Blomfeldt
e7562a50b9 Accept multiple fonts with the same family and style name
When the style name is included in the request to
QtFontFoundry::style(), then it will ignore the other properties
and just return the hit that matches it. This is because we want
the style name to take precedence over all other properties when
the user specifies it in a request.

However, we were using the same function to check if a specific
font already exists. If we are registering a font and it is
already in the database, we want it to replace the existing one.
But for fonts such as the variable "Noto Sans Display" there would
actually be multiple styles in the family that were called the
same ("Regular") but had very different properties.

Due to how fonts are populated on GDI, this issue did not occur
there, so the issue is perceived as a regression in Qt 6.8 when
we switched to DirectWrite as the default backend.

We fix this by ignoring the style name when checking if the font
already exists and instead prioritizing the specific properties
it has. If multiple different styles with the same name exists,
they will all be registered.

Note that it will not be possible to differentiate between the fonts
using the style name, same as before, but you will now at least
be able to select the different styles by specifying properties
such as weight.

[ChangeLog][QtGui][Fonts] Fixed an issue with font families where
only the last of multiple sub-families sharing the same name would
be registered.

Pick-to: 6.8
Fixes: QTBUG-131574
Change-Id: I86a04547065c2d9ef88d9a761af95af33eb9b3d6
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
(cherry picked from commit 1d6f71779f05df1af3daacd48f309cd92523152a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-20 13:18:05 +00:00
Eskil Abrahamsen Blomfeldt
333a08c98f Fix divide by zero when opening font on invalid image
If you open a QFont on an invalid image, its dpi will be 0. In
other places we check for this before calculating the point
size, but this was missing in one spot, causing divide by
zero.

This would happen e.g. in the tst_QFontMetrics::same() test.
While it would pass normally, running this with an undefined sanitizer build would warn about the division by zero.

There's nothing useful we can do with the fonts on the invalid
image, so like in the other places, we just leave the point size
as is when this happens.

Pick-to: 6.8 6.5 5.15
Change-Id: I4769e23e2b4dbb92f675cb8a77f8554c90bc2afd
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
(cherry picked from commit c136de2deb46fb5f60728bc5a4083b9439ea0a3a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-20 08:27:14 +00:00
Thiago Macieira
c1bb08ab26 QVariant: don't use the static CanUseInternalSpace with existing objects
It's possible for the QVariant to have been created by an older or newer
build of the library in question in which the type in question was
relocatable but has ceased to be, or wasn't relocatable but now is.

[ChangeLog][QtCore][QVariant] Fixed a bug where QVariant could misbehave
regarding types that changed from non-relocatable to relocatable (or
vice-versa) and not all uses of it were recompiled. To benefit from this
fix, applications must be recompiled, but they will be safe going
forward.

Pick-to: 6.8
Change-Id: I222806b3804df6272abdfffd45f96312d23be1af
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit eb87b0444ac8fec4d86bc26dc4bec80f82953f7c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-19 21:55:14 +00:00
Jani Heikkinen
22f33e1bd2 Revert "Android: update to Gradle 8.12 and AGP 8.8.0"
This reverts commit e60b493c2e5c672528efd7e0bc8f659e0fd2e2e5.

Reason for revert: temporarily revert it to pass submodule
update round.

Change-Id: I63e8cf78c93d84add4aaaee388b01f2c15cca312
Reviewed-by: Jukka Jokiniva <jukka.jokiniva@qt.io>
2025-02-19 18:52:16 +00:00
Eric Beuque
dcf09c0c63 Fix bad signal restoration which can cause infinite loop
This fix the FatalSignalHandler destructor to restore properly the
signal handler which cause an infinite loop when a signal is emitted
like SIGABRT or SIGINT and when we are using two QTest object in same
program.

Fixes: QTBUG-132121
Pick-to: 6.8 6.5
Change-Id: Ie9476e1ff9c0f29c3e35ae6dff565fab4a77ba86
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 50d1a22e5c6361e7c1ef09432b2a151eee3e6114)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-19 18:14:09 +00:00
David Boddie
73e9605765 doc: Remove link to missing showShaded() function
Pick-to: 6.8
Change-Id: I8a70558521a6829e0bd99f03a7aa695681061945
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit c08ca6ff02af9d735b2692b958c1666ea96996bd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-19 17:14:17 +00:00
Wladimir Leuschner
7cab94a4c8 QWindows11Style: Use Highlight color for ItemView with alternating rows
When using alternating rows in ItemViews, the currently selected item is
hard to distinguish from the background colors. This patch uses for
ItemViews with alternating row colors the highlight color for the
selected and hovered item.

Fixes: QTBUG-133118
Pick-to: 6.8
Change-Id: Ib5dbe0f58d5970c41cc9d14cf2188a7e5b1abd1a
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit c3d2a4972ca6bec5bfe9dbe989e2dc6e347f02c1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-19 17:14:16 +00:00
Edward Welbourne
320a3b1328 Avoid returning null from find{Next,Prev}InOrder(non-null)
The checkNode(p) call relies on p being non-null, so CodeChecker
grumbled. In any case, we should be returning node_impl if we fall off
the end of the structure (which shouldn't be possible, since we
descended into the three and can't come back out on the way up without
passing through node_impl, for which we check). Include a null-check
in checkNode(), save the nsURI.isNull() check when !p->isElement()
makes it redundant and fix some coding style nits while I'm about it.

Amends commit 8609982791928a30a6d836b25810143a064f8c6f

Coverity-Id: 474724
Coverity-Id: 474725
Coverity-Id: 474726
Change-Id: Id622a91d2e443276756e50729cf155b10f7164a1
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
(cherry picked from commit 82ae262de27534170060e61e8d1f4b045ae13fb8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-19 17:04:00 +00:00
Edward Welbourne
05b91b1195 Fix UB in QTextStreamPrivate::putNumber()
Negating a negative value may attempt to negate the minimal value for
the signed type, whose only set bit is its sign; this is UB. So don't
do that. Since the non-decimal branch of the code just prepends
locale.negativeSign(), and we're passing -1 as width parameter to the
QLocalePrivate formatters (so there's no zero-padding, whose size
would be reduced to make space for a sign), we can treat decimal the
same as all other bases. This, furthermore, simplifies the code.

In the process, I noticed (because a test only done for decimal
failed) that if QTextStream::ForceSign is set, this code-path for
negatives would prepend the minus sign before a plus sign supplied by
QLocaleData. Skip the flag to include sign, for negative input, since
we'll be including a negative sign anyway. Remove the QEXPECT_FAIL()
from the test I've added for this in a preparatory commit.

Purge one now-redundant comment and revise some others. Expand on why
we need to hack octal zero to display two zeros. Add a second test row
to keep the lonely zero-row company in the test for that.

Fixes: QTBUG-133269
Pick-to: 6.8 6.5 5.15
Change-Id: I35c9bdf34b812cff578de9b0a2570a60e6145c80
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 44ddb34da07f7fdb2214cb39b56cf114d4aa209e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-19 17:03:58 +00:00
Marc Mutz
4372292136 QBenchmarkPerfEvents: help Coverity understand the code
Coverity thinks that r may be negative and not -1 and warns that the
cast to quint64 may overflow.

Change the check for `== -1` to `< 0` to help Coverity (and other
readers of the code) understand that this cannot happen.

Amends c63420a117fe67107466d806890e901d091cb1d5.

Pick-to: 6.8 6.5 6.2 5.15
Coverity-Id: 474172
Change-Id: I7615e0ef152e1e6e9cbc6dec1b8ecd4f8879521c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 24a26ed3a3842398276ae54602e8e1936a2f2323)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-19 16:45:02 +00:00
Marc Mutz
173eebbd96 tst_QLocale: actually check formattedDataSize() with qint64
... not just int, and not just non-negative values.

Reveals a problem with bytes == numeric_limit<qint64>::min(), says
ubsan (example; all min64 fail):

    global/qnumeric.h:479:26: runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself
    text/qlocale.cpp:5062:82: runtime error: signed integer overflow: -2147483648 * 3 cannot be represented in type 'int'
    text/qlocale.cpp:5062:26: runtime error: division by zero
    FAIL!  : tst_QLocale::formattedDataSize(English-Decimal-min) Compared values are not the same
       Actual   (QLocale(language).formattedDataSize(bytes, decimalPlaces, units)): "-inf bytes"
       Expected ("output")                                                        : "-9.22 EB"

So exclude that from testing, for now.

Pick-to: 6.8 6.5 6.2 5.15
Coverity-Id: 474294
Change-Id: Ia1f8e87c58a9fdc2668b6745956e913384cff4c7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 562cb8e4d9c5e6482b8c6b85fbb6f735d3000ad2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-19 16:44:55 +00:00
Cristian Le
aa0e38c607 Fix: Use _qt_internal_set_source_file_generated
`SKIP_AUTOGEN` was a bit too zealous.
Hotfix for 6865c21e41be5d86b5a04889bfe28fac55c89f29

Fixes: QTBUG-133850
Change-Id: I6ec984a7a5d8eefb56e53a0f56c4f4384a56e0ae
Reviewed-by: Nicolas Fella <nicolas.fella@kdab.com>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 97517b20aaaccb9f2bfa6d571a71f40560507476)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-19 16:44:53 +00:00
Marc Mutz
76783a4487 tst_QCryptographicHashBigData: skip Sha1 tests on ASAN CI builds
The SHA-1 test has started to time out in CI ASAN builds recently, so
skip it there. Keep it on non-CI or non-ASAN builds, though.

Amends c6e092a5f84b7fc72556897b50c7697152967925.

Pick-to: 6.8 6.5 6.2
Change-Id: I8d653c2a8304cfae290befafda570d5c49dd4536
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 929466ba64c503cc1a7c6205f0a424350a9a201f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-19 14:50:38 +00:00
Konsta Alajärvi
fd15b2178a Unblacklist tst_qrhi renderToTextureSampleWithSeparateTextureAndSampler
Unblacklist test function by skipping it with Android with Vulkan.

Fixes: QTQAINFRA-6335
Pick-to: 6.8
Change-Id: I2ee093542f09f68044baa044b697a09af066fcd8
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Lauri Pohjanheimo <lauri.pohjanheimo@qt.io>
(cherry picked from commit 83a4128ecbc260231b942f811b34fbe7595b14bc)
2025-02-19 10:35:44 +00:00
Axel Spoerl
4c1aef25ce Correct childNumber() reference in editable tree model example
childNumber() has been renamed to row() in the code, but not in
the documentation.
Correct it.

Pick-to: 6.8 6.5
Change-Id: Ibe6f1f27c0dd1982ff663dc680738babf2db87d7
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit d0cb3c0acdd4a482fd749684f282451bdd13557f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-18 22:58:21 +00:00
Topi Reinio
d83f820ab4 Doc: Ignore 'Unknown base <type> for QML type' warnings for now
These warnings are false positives when testing in the CI
when a documentation module containing the  base type is meant
to be loaded as a dependency; In the CI, the .index files for
doc dependencies are not available so we see this warning.

Ignore these warnings for now in the global documentation config.

Pick-to: 6.8
Change-Id: Ic1711bf7389e9f9d4a04e3b72b2c9f8b25539357
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 3336422289079b421797ac2d194241976929c7d8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-18 22:58:20 +00:00
Alexey Edelev
09e4baf5eb Ensure <target>_copy_apk_dependencies is called for QtC build
QtC doesn't use the make_[apk|aab|aar] targets, it runs the deployment
manually. The top-level android build target for QtC is the
<target>_prepare_apk_dir target. Make it depending on
<target>_copy_apk_dependencies target, to ensure that all abi-specific
artifacts are copied before running the deployment procedure, from
either QtC or command line.

Amends 44149f9d8b62b5343a5d06628b0c9588f035ccc2

Fixes: QTBUG-133810
Fixes: QTBUG-131862
Pick-to: 6.8
Change-Id: I4f3630798658a793b0c96a99fc4644ec1dd0504b
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 7a6b3e1a9c0555e91f3e510b63bc0cc18bb1ef16)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-18 22:58:20 +00:00
Alexey Edelev
af7ca1d159 Mention QT_ANDROID_MULTI_ABI_FORWARD_VARS in QT_ANDROID_BUILD_ALL_ABIS docs
Help users to navigate in docs.

Pick-to: 6.8 6.5
Task-number: QTBUG-107893
Change-Id: I95774e03ba4027dad82ba652b3f119f19b9d6760
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 4d6a2850ad72a9f4ca9eae49d543809c10e1fe0d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-18 22:58:20 +00:00
Thiago Macieira
56993ad559 QThreadStorage: don't print the destruction ordering warning on app exit
This warning here was very confusing (so I'm also updating the language
to be clearer what it means). It is here to advise users of
QThreadStorage that they may have destroyed the object before all
threads using the object have finished. That means there will be memory
leaks, hence the user should fix the issue.

But the one time we don't care (too much) about memory leaks is when the
application is about to exit -- all memory is being released back to the
OS anyway. This may happen because of Static De-Initialization Order
Fiasco: the Q_GLOBAL_STATIC or equivalents holding QThreadStorage were
destroyed before the QThreadData for the exit()ing thread did. That
problem became more prevalent after the series of changes ending in
commit 2f69a05bd0cd7ce63890f709ff3ed7a4f78acd70, because that made the
QThreadData clean up happen very late in the execution.

Unfortunately, there's no way for us to know when we're being called
during application exit, so this is the next best thing:
QCoreApplication::instance() does not exist. We're using a private
function in QCoreApplication because in Qt 6.x, QCoreApplication::self
is not atomic and reading it would be a data race.

The QThread::currentThread() call was superfluous, because it was always
true. It was a relic from Qt 3, from before we had QAdoptedThread.

Pick-to: 6.8
Fixes: QTBUG-133500
Change-Id: I48d84d76f2b72483ed92fffdd54c6ad17e3d67d3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit fd857d400a098598072ff08b0a54f4ba2589357b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-18 22:58:20 +00:00
Thomas Moerschell
69f78f3cbe QScroller: Remove workaround for timer start
The CI is flakey, likely due to missing timer events. Instead of
skipping the first event, start the timer only when the new state has
been set.

Task-number: QTBUG-30133
Pick-to: 6.8
Change-Id: Ia58e4b091d8791d1b77642ded67312bc3927d0b7
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c093b57c8696079fc3408796e0e17c62a990bce2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-18 22:58:20 +00:00
Ulf Hermann
5dddcc3cdc Doc: Clarify need to qt_add_standard_project_setup early
Pick-to: 6.8
Fixes: QTBUG-115050
Change-Id: If8b3aabd0072bfb2bef6dea106af06524f144990
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 8f5c6434e81f554989557ea9643aa6f323903aba)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-18 22:58:20 +00:00
Alexandru Croitor
057ef3e1d3 CMake: Add project supplier to generated source SBOM
Make sure to specify the creator organization when calling reuse to
generate the source SBOM.

This replaces
  'Creator: Organization: Anonymous'
with
  'Creator: Organization: TheQtCompany (https://qt.io)'

Pick-to: 6.8
Fixes: QTBUG-133796
Change-Id: I3532d9f35ca3eacd9c20bee7db88f35c76db9672
Reviewed-by: Lucie Gerard <lucie.gerard@qt.io>
(cherry picked from commit 52a64aca2099a1efc5a8819c9e60a57aefde4370)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-18 22:58:19 +00:00
Michael Cho
224fc1daaa CMake: Add support for pkg-config files on macOS
This enables generation of pkg-config files that work with Qt's
libdir-installed macOS frameworks. QtFinishPkgConfigFile.cmake
wasn't modified as POSTFIX has no impact on framework name.

Change-Id: I2da8f43608e778aa286ad625b70c5be20b447193
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 7a31e402f24ec29c571f825e06bd569477501dfc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-18 22:58:19 +00:00
David Boddie
3009ca730d doc: Fix a couple of typos that cause broken links
Pick-to: 6.8
Change-Id: I7f9aafa12d98475fc28230fcb25ba6a4570889aa
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
(cherry picked from commit 3c4ec4de1426e42055a09cbe37b7ea2448da4943)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-18 22:58:19 +00:00
Eskil Abrahamsen Blomfeldt
80b39d24ec Treat variation selectors as ignorable chars
The variation selectors only make sense in the context of the
previous glyph and should never be shaped by themselves, therefore
we should not pick a different font engine for these even if
the cmap does not support it. They are sometimes needed to
properly resolve the emojis, but the OpenType rules in the font
may not be written with them in mind.

If the cmap lookup fails for these, then Harfbuzz will map them
to a zero-width space, thus ignoring them when resolving the
OpenType rules.

We treat these the same as other control characters and just
ignore them when doing font merging.

Note: This was handled through an ad hoc mechanism prior to
the introduction of the emoji segmenter in 6.9.When the emoji
segmenter is disabled, we still use this mechanism, which
depends on us not ignoring the character in that case.

Fixes: QTBUG-133480
Change-Id: I8fa4e8d5e1aabad0946b8fd3fff044e2b2af5d0e
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
(cherry picked from commit cf674f38450f623d94e5695a221a186c0e551e27)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-18 13:53:31 +00:00
Lucie Gérard
770f9e5897 Correct doc/images licensing
Pick-to: 6.8
Change-Id: I202366f8294920fa4ac15f95a4352d5c56c1a6cd
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit e5fab54e54b47b71585781b5f69ccf8d7668ec9e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-18 13:12:18 +00:00
Matthias Rauter
b05f06d5b9 Silence warning in tst_qwidget.cpp
Amends: 1a0f056f318417ba5e54c8110257b75cf5537acb

Pick-to: 6.8
Change-Id: Ib67016bbb7d5abe48224d23d49e36e2e01e416fc
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 2c15086b7ed561b59cfb0d028c35d15631c12738)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-18 13:12:18 +00:00
Giuseppe D'Angelo
7b0e3fb969 qcompare_impl.h: include what you use
Both enable_if and is_null_pointer belong to type_traits, include it.

Amends 631a0cc45cbe70940746cd944d325d7d3bab8c15.

Pick-to: 6.8
Fixes: QTBUG-133808
Change-Id: I9626ba80b2d9799d1bfed8ca9c9090691b8d8715
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 72cde6f7dd9102d0c3730a75a6c85af69b8a0e3c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-18 13:12:17 +00:00
Marc Mutz
a5bafadf8e QByteArray: optimize replace(char, char)
Write every byte only once.

Amends 83c2c5055405f09043c35b93cd5ba9b9969f3174 (as well as the start
of the public history).

Pick-to: 6.8
Task-number: QTBUG-106185
Change-Id: I883b2f00c754806882131a09dc3cbc5613420151
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 2753924fcbeb29fa5b34782bd6ad6ed4fe4b51f1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-18 10:15:24 +00:00
Christian Ehrlicher
0d36941a78 Windows11Style: don't modify palette for buttons in polish()
There is no need to screw up the palette of buttons in polish() - the
colors are not honored at all.

Pick-to: 6.8
Task-number: QTBUG-132433
Change-Id: I4df1f046690d1aa9b07fc538441d6ea50d0216ce
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
(cherry picked from commit 6a46395614bf89a8b69fd2b7edb9503bd8f16ceb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-18 05:15:13 +00:00
Thiago Macieira
6ad615cd12 GUI: no need to unregister input device if list is destroyed
Fixes: QTBUG-133776
Pick-to: 6.8
Change-Id: If4a148e3ebf753ccd661a5ed1b321dbd7751576e
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 1040728e39b8b898d6e96b79a4c7bfcd0cb3f027)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-18 02:03:24 +00:00
Frédéric Lefebvre
e20364d6c9 Harden tst_QWindow::framePositioningStableAfterDestroy()
StablePosition was in some cases recording a wrong position, as it was
taking the framePosition and considering it to be the widget's
position. That erroneous position was then used to place the window,
resulting in a correct position but a wrong framePosition.

Wait and check for the window.geometry() and the
window.frameGeometry() to be different. If not the frame
has not been updated, or there is no frame when there
should be one. The test will most likely fail because
of this.

Fix flakiness on Opensuse 15

Pick-to: 6.8 6.5
Change-Id: I8e05ee7769de4efc2ac55ec7afbe366f76e325db
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 21ef8bed6d738551c1a322e78366d3c347a0e09e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-17 17:20:25 +00:00
Cristian Le
d61c784273 Use _qt_internal_set_source_file_generated
Migrate implementations that set `GENERATED` source property

Task-number: QTBUG-125077
Change-Id: Ia77ecf8422bf3983f7746c26e5a9994d1f6415f2
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 6865c21e41be5d86b5a04889bfe28fac55c89f29)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-17 16:13:54 +00:00
Shawn Rutledge
78dd1c5cd0 doc: Add QTextDocument::MarkdownFeature docs
Detailed docs were omitted before (and QTextMarkdownImporter::Feature is
not public) because
- "GitHub dialect" is a moving target (although we may have supported
  all known features when it was introduced). We should reserve the
  right to add to the feature set accordingly: so the numeric flags
  can be expected to change.
- the writer mostly ignores the feature flags and writes back to
  GitHub dialect; only the front matter can be omitted that way
- recognizing non-URL links seems fuzzy; md4c does it, so we allow that
  feature, but if it goes wrong it would be an md4c bug
- hex flags look strange: in fact they come from
  https://github.com/mity/md4c/blob/master/src/md4c.h#L306
  If we assume that they might change, it would be better not to
  document the numeric values in detail. But so far, md4c has never
  removed any, only added a few (and we don't yet support all the
  new ones).

Change-Id: I6552da1226bf7ad6242432c1d5d3df9ec8f61d6f
Reviewed-by: David Boddie <david.boddie@qt.io>
Reviewed-by: Tommi M. Tauriainen <tommi.m.tauriainen@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 280025fc7e97ad943ed2938f6434cadf94bd635f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-17 16:13:54 +00:00
Cristian Le
3ad691586e Add _qt_internal_set_source_file_generated function
Create a function `_qt_internal_set_source_file_generated` that sets the
source file property `GENERATED` along with Qt relevant properties:
- `SKIP_LINTING` if CMake>=3.27 and `QT_FEATURE_lint_generated_code`

Task-number: QTBUG-125077
Change-Id: I0ef5f7901f502366aaf2d020554c72e4845101b6
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit f654519c7bd142d5cc9f81e0c826dfd31956791d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-17 16:13:53 +00:00
Alexandru Croitor
f32dbf337d CMake: Add internal API to check if json SBOM generation deps are met
Will be used by WebEngine configure checks to check if the
dependencies are met and show an according error message if not.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I56d46fe5cf12051903d1aec893336be5ae8983a2
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 414b73075c537481280179ea78748dd2a6b45f9e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-17 16:13:53 +00:00
Alexandru Croitor
25840bcc32 CMake: Make sure to look up deps when converting json to tag SPDX doc
When converting a json SPDX document to a tag/value SPDX document, we
need to make sure that the python dependencies are looked up.
After they are looked up, either error out or silently return
depending on whether the operation is required or not.

By default when _qt_internal_sbom_generate_tag_value_spdx_document is
called it is required to succeed and thus requires the python
dependencies to be present. A caller can opt out using the OPTIONAL
argument.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: Iccb68f900f4892a816360843dd87f9e469104bf7
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 8b6b17ae87abcdb2120255b490ce6fe03b0e2e08)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-17 16:13:53 +00:00
Alexandru Croitor
4ae0667e2b CMake: Improve error reporting about missing SBOM dependencies
Improve wording when python or some dependency is missing, deduplicate
the strings and make sure to mention what is actually missing.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I26af38f0330a5462c6001cae03c46284e742fbda
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit ad82afb05417e2b07a55a4520105b1f01a802487)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-17 16:13:53 +00:00
Alexandru Croitor
71130a16f8 CMake: Work around upstream AUTOGEN issue with discarded dependencies
Upstream CMake has a nasty bug where AUTOGEN dependencies are
discarded if a library is added as a dependency more than once (or
rather the number of times it is added is not equal to the number of
configured build configs).

This can result in racy build failures, where a <module>_autogen
target is supposed to depend on some <other_module>_sync_headers
target, but doesn't, and thus moc generates empty metatypes files
because it can't find a synced header.

To avoid the AUTOGEN dependencies from being discarded, manually
add all dependencies passed to qt_internal_extend_target to the
AUTOGEN_TARGET_DEPENDS property.

The issue is fixed in CMake 4.0, so the workaround is gated on the
cmake version used. Add a flag called
QT_NO_AUTOGEN_DISCARDED_DEPENDENCIES_WORKAROUND to disable the
workaround, in case the fix gets reverted upstream.

Pick-to: 6.8 6.5
Fixes: QTBUG-133725
Change-Id: I857d7e774fc9f9f5203a58311daea5e7177e0d67
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit fcb20586316aff2ccc39e2ae840b79f8b0e904a7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-17 16:13:53 +00:00
Alexandru Croitor
ac0e10db65 CMake: Always save SBOM python interpreter path
To ensure that when we find the interpreter, but not some python
dependency, we actually show the error about the dependency.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: Ib4f42e04f071f800d0f5bbe3700a1208e1017a19
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 46ee11a426292bc1538b5138501136b2dadc7173)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-17 16:13:53 +00:00
Giuseppe D'Angelo
0730c7ea55 Update PCRE2 to 10.45
New upstream version.

Importing note: 10.45 is missing a licence file for the sljit
dependency. This is tracked upstream at

https://github.com/PCRE2Project/pcre2/issues/686

so it may get fixed in 10.46 (in which case the import script /
qt_attribution.json may need to be amended).

[ChangeLog][Third-Party Code] PCRE2 was updated to version 10.45.

Pick-to: 6.8 6.5
Change-Id: Ifa0430782bed8ffb1c26f44ca6eb06cd26aaa1f9
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 3cb58b053c26603ba1d541b3c9c51ec25212ee80)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-17 16:13:53 +00:00
Marc Mutz
a639174daa qhighdpiscaling: de-pessimize qEnvironmentVariableOptional*() functions
Don't call qEnvironmentVariableIsSet(), since it locks the environment
mutex. Since qgetenv() and qEnvironmentVariable() both report whether
the value was set (returning non-isNull()), we can avoid the extra
mutex lock (and envvar lookup) by just calling those and then checking
for isNull().

In qEnvironmentVariableOptionalReal(), in addition, use qgetenv()
instead of qEnvironmentVariable(). While on Windows, that may convert
encoding, QString::toDouble() first converts to Latin-1, and only then
converts to double, so we avoid one encoding conversion, even on
Windows; on Unix we avoid two.

Amends 4d1f13f3549a73f5ca4e64dac9137e83138080fa.

Pick-to: 6.8 6.5
Change-Id: I6803e2277b324c2568726765245681bcbf517362
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 8669bc97ff6811bae304a8bb2a0e3af2bb78cfe0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-17 12:56:12 +00:00
Alexei Cazacov
03fc43b5e9 Docs: Move qmake-specific documentation out of Qt's documentation
This commit moves the third-party-libraries.html topic to the qmake
documentation. The topic is renamed and links to it are corrected.

See also: 623150

Task-number: QTBUG-132504
Change-Id: I711400d887b7e4894021b0433eb1cd61dfdd5349
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 1e7e0b0cacaae4fb0bb2b730dd6cdb34d7e93afe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-17 09:43:40 +00:00
Giuseppe D'Angelo
5adddf6cd9 QMenu: make mousePopupPos a QPointF
QMenuPrivate::mousePopupPos is a QPoint which gets set to
QGuiApplicationPrivate::lastCursorPosition, and only read from
QMenuPrivate::hasMouseMoved to determine if the mouse has moved enough.

When the last mouse position is not known, lastCursorPosition.toPoint()
returns {INT_MAX,INT_MAX} (see c5792dcfd631abb4f9e2b92cd6e88d7e5c373406
for the reasoning). This is extremely prone to overflows. In fact, one
was happening into QMenuPrivate::hasMouseMoved:

  (mousePopupPos - globalPos).manhattanLength()

On the first mouse move the subtraction yields an enormous result which
overflows manhattanLength.

The solution is simple, make mousePopupPos so that these calculations
happen in fp coordinates. The length itself is only used as a threshold
against QApplication::startDragDistance, so its representation doesn't
actually matter.

Pick-to: 6.8
Change-Id: I9c8e30a637de120d086d6f7171725702c205da78
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 7736823500fe8d97bc6d12ffb88001d34d1980bb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-16 18:08:23 +00:00
Cristian Le
ea4a6cfdfa Check the PROJECT_NAME more thoroughly
This was missed in 3e1a223318dbda50a010ba851841a9e51c80c42b

Task-number: QTBUG-127953
Pick-to: 6.8
Change-Id: I2ff6cafe852ec2696aea37e2e79e3c8b95c0e8ca
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit b8b6382b02457963fa5d0e67e069dc92e6d6c9d9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-15 03:48:58 +00:00
Thiago Macieira
c6fdf954e3 QResource: try to survive being created during application shut down
Similar to commit 12d4bf1ab52748cb84894f50d437064b439e0b7d, which was
for QLocale. Like it, QResource can be used very late in the execution,
like for example the logging system. For example (simplified):

 #9  0x00007ffff759d497 in resourceMutex () at /io/qresource.cpp:188
 #10 0x00007ffff759d615 in QResourcePrivate::load (this=0x41c940, file=...) at /io/qresource.cpp:333
 #11 0x00007ffff759dc19 in QResourcePrivate::ensureInitialized (this=0x41c940) at /io/qresource.cpp:386
 #14 0x00007ffff75011a9 in QLibrarySettings::load() at /global/qlibraryinfo.cpp:80
 #22 0x00007ffff7501756 in havePaths () at /global/qlibraryinfo.cpp:149
 #23 0x00007ffff75028e3 in QLibraryInfoPrivate::paths (p=QLibraryInfo::DataPath, usageMode=QLibraryInfoPrivate::RegularUsage) at /global/qlibraryinfo.cpp:613
 #26 0x00007ffff758e4f0 in QLoggingRegistry::initializeRules () at /io/qloggingregistry.cpp:309
 #34 0x00007ffff758f007 in QLoggingRegistry::instance () at io/qloggingregistry.cpp:424
 #35 0x00007ffff758c50b in QLoggingCategory::init () at io/qloggingcategory.cpp:188
 #43 0x00007ffff758c6bb in QLoggingCategory::defaultCategory () at io/qloggingcategory.cpp:317
 #44 0x00007ffff750ff8e in qt_message_print (msgType=QtWarningMsg, context=..., message=...) at global/qlogging.cpp:2036
 #45 0x00007ffff7509515 in qt_message(msgType=QtWarningMsg, context=..., msg=...) at global/qlogging.cpp:360
 #46 0x00007ffff750a712 in QMessageLogger::warning (this=0x7fffffffd8b0, msg=...) at global/qlogging.cpp:600
 #47 0x00007ffff790e083 in QThreadStorageData::finish (p=0x41b588) at thread/qthreadstorage.cpp:160
 #50 0x00007ffff78ed423 in QThreadPrivate::finish (this=0x41b5e0) at thread/qthread_unix.cpp:404
 #51 0x00007ffff78ec8ed in destroy_current_thread_data (p=0x41b520) at thread/qthread_unix.cpp:154
 #52 0x00007ffff78ec9ec in Cleanup::~Cleanup () at thread/qthread_unix.cpp:204

Task-number: QTBUG-133206
Task-number: QTBUG-133500
Pick-to: 6.8
Change-Id: I7b653afb1b41ef3c1c9afffdaa93e6558740016b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit ba18ae3869fd6703fbaad548d2421a82e7e675cc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-15 03:48:53 +00:00
Thiago Macieira
ddd0a08490 tst_QGetPutEnv: use a lambda instead of a macro
Neater and more debuggable. This code was added in Qt 5.4, before we
could use C++11.

Pick-to: 6.8 6.5 6.2 5.15
Change-Id: Icd8acccb4a9ae1f500e7fffdc4d4fc7c310cbb89
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit b888bc09ce33a91800cb2119a52097897f3d62d1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-15 03:48:44 +00:00
Thiago Macieira
ff7675817d qEnvironmentVariableIntValue: fix off-by-one with MSVC's getenv_s
This meant a string containing the octal form of INT_MIN (-020000000000)
would be just too long and getenv_s() would fail. This was never caught
because code that was meant to test different bases simply forgot to use
the base. Amends commit bb56586e32677ee9be23bffa4f3cc9a913ef192f.

I've renamed the rows to be the text being parsed, so it matches the
previous rows and it makes clear what was being parsed just by reading
the test's output. That also revealed a duplicate row to be removed.

[ChangeLog][QtCore][QtEnvironment] Fixed a bug that caused
qEnvironmentVariableIntValue() to fail to parse octal values from
-020000000000 to -010000000000 with MSVC. Other compilers were not
affected.

Pick-to: 6.8 6.5
Change-Id: I9095d86cccd9e8001e85fffd6fbbcd6a9a1678c3
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 83f2d1130aa49228a8a87547660791708735dd4b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-15 03:48:33 +00:00
Thiago Macieira
16b8fc51fe QCborStreamWriter: remove stale doc about 2 GB size limits
Those applied to Qt 5's int-based size types.

Pick-to: 6.8 6.5
Change-Id: Id8436bae9c641e33770bfffdd55bb1b883863a7c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit e62407b429f4dc5d900e77a26410f87f56c7d5cd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-15 03:48:23 +00:00
Ulf Hermann
3fd08e19d4 QLibraryInfo: Consider resource paths as absolute
This is what QDir::isRelativePath() does, for better or worse. We've
used QDir::isRelativePath() before and we shouldn't change the behavior.

Amends commit c74cba1117355a6312b1f0cc815efa4cdea4bbfa

Pick-to: 6.8
Change-Id: I03e3e921977af2b9c6ff2593535d846d6ce28fe2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit dd2dc8c70d0227ff235a8c7feaca7d7c4ead9c63)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-14 20:54:42 +00:00
Thiago Macieira
b6d2f86695 tst_QFontEngine: fix argc going out of scope
Q{Core,Gui,}Application constructors take a reference to argc.

Amends 4db368d4741eff4d2b2942c25d5e633648e23a64.

Change-Id: I0a0c9a0ba574133ac7b8fffdb80e4656267d2ed2
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 434222f635ac134c64dd1d523f1f81dc1c598d90)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-14 20:54:41 +00:00
Thiago Macieira
5b10a1e8b4 tst_QByteArrayView: stop using std::basic_string<signed char>
That's not a valid type for the Standard's string, because the Standard
doesn't allow for std::char_traits<signed char> either.

Pick-to: 6.8
Fixes: QTBUG-133689
Change-Id: Icd0d4928fa4cdc9d806bfffd4053f0eb1073e6b4
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 0cc41083c30c1474a862a34b59a4f755d4c51640)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-14 20:54:41 +00:00
Thiago Macieira
0fef016748 QLoggingCategory: remove init() and merge with the constructor
Nothing else calls it.

Drive-by initialize the two pointers via NSDMI.

Pick-to: 6.8
Change-Id: I8c51cf5126aeb8bd6254fffdd21a37526329bbf3
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit c7ec043e4643d4b18731fdf2efc14976a81e1809)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-14 20:54:40 +00:00
Thiago Macieira
edb8d08e46 QDesktopServices: don't use openDocument if the URL has a query
[ChangeLog][QtGui][QDesktopServices] Fixed a bug that caused
QDesktopServices::openUrl() to discard a query when opening a local file
URL that contained a query but no fragment.

Pick-to: 6.8
Fixes: QTBUG-133663
Change-Id: Ie8fa190036417f590540fffdcf03e53f3c99b38f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit aad0ab897f61bcb6ac9ba908afd1ee33e05fe4db)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-14 20:54:40 +00:00
Thiago Macieira
b80f632f28 QStringConverter: mark QStringConverterBase as removed in Qt 7
It's an internal class containing the common content between
QStringConverter and QTextCodec (Qt5CoreCompat) so the latter didn't get
the new API from the former.

This allows us to remove the QStringConverter::Flags qdoc hack too.

Change-Id: Iacf32fb88e3c3d0ea369fffd153356cec308e3dd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c2fa41a081e4c9fe308dcd47283537eedf05c24a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-14 20:54:39 +00:00
Mårten Nordheim
9a634a5c4b QByteArray(View)::lastIndexOf: Guard against needle > haystack
Otherwise we would traverse beyond bounds.

We calculate the delta in sizes between the haystack and the needle and
if this delta is smaller than the starting position
(the `from` argument) then we start from there.

The default value for `from` is size(). With the needle being longer
than the haystack, the delta is negative and we set our starting
position to be the delta, i.e. we start before the start of the
haystack.

[ChangeLog][QtCore][QByteArray/QByteArrayView] Fixed a bug in
lastIndexOf() that could lead to out-of-bounds access when the needle
is longer than the haystack.

Pick-to: 6.8 6.5 6.2 5.15
Change-Id: Id5cd772f00b0c3c50fbf61b4e888bba5587391ee
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d25e5e2cb78a2e2f2a1791fed250421ce9eefc46)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-14 20:54:39 +00:00
Mårten Nordheim
6dbb95e69c QNetworkInfo: Document threading restriction
Specifically on Windows we use COM, which requires being
de-initialized in the same thread as it was initialized.
Given that QNetworkInfo is a GLOBAL_STATIC with a qAddPostCondition
(iirc APPLICATION_STATIC was not yet implemented at the time) to
delete the backend when qApp is destructed, we need to cope with
destruction happening on the main thread.
If the backend is loaded on a secondary thread, the thread may
have shut down, or we may not otherwise be able to rely on
emitting Queued emissions to perform the destruction.
Conversely we also can't trivially move the construction to the
application thread (eg. using BlockingQueued emission during first load)
because we may cause a deadlock.

This leaves us with just documenting where the first load should happen.

Fixes: QTBUG-133644
Pick-to: 6.8 6.5
Change-Id: I7f52e884151c6c24acc34f1112faabc897d9b0f9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6ad2918de4a300d11472edcafe62f07ae2f63cd8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-14 20:54:39 +00:00
David Boddie
25107519e5 doc: Add missing fromArray() documentation
QAnyStringView::fromArray() was not documented, leading to a broken
auto-link that referred to it.

Pick-to: 6.8
Change-Id: Ibf3704da8b3f16e56589bd649ce1e63a7cbd3739
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f9334be98e4deb9e9a4a30f5f22e92b571670938)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-14 20:54:38 +00:00
David Boddie
8014b45a7a doc: Change links from begin() and end() to constBegin() and constEnd()
It appears that there are no longer relevant begin() and end() functions
to link to. constBegin() and constEnd() are the relevant alternatives.

Pick-to: 6.8
Change-Id: If6fc421ee08364de9a879fb704a7989046b9b43a
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit c8e59d682cc2c6a5cbe124575bb54316af55bed1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-14 20:54:38 +00:00
Laszlo Agocs
80dee1a9f9 rhi: vulkan: Don't assert in VMA when vk header is older than runtime
Building Qt with e.g. a version 1.2.x Vulkan SDK and then running
on an implementation providing 1.3 or 1.4, one will likely get an
assert in debug builds upon initializing the memory allocator.

Work it around by restricting the apiVersion passed in based on the
preprocessor macros.

Pick-to: 6.8
Change-Id: Ia689ffc29d5675b84b6683e289d0725d7e47220b
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit b6d4c1368d38242a8c677efc3144c10cfe363179)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-14 15:12:05 +00:00
Volker Hilsheimer
afc5747e9b JNI: generate QtJniTypes forwarding header for the namespace
The documentation claims that this is where the namespace and the macro
definitions live, and it's convention to have a Qt<Namespace> header for
Qt namespaces.

Pick-to: 6.8
Change-Id: Ia49001d61f0967df84344779909860cf65c3623c
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 6c61d7b0f804ae5c048af95abef4d41ecc8862df)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-14 14:44:26 +00:00
Cristian Le
cedaf89b0f Simplify genex expressions
Simplifications:
- `COMPILE_LANGUAGE` accepts comma-separated list since 3.15

Pick-to: 6.8
Change-Id: I4af316a463b5771bf5b37a6b4d77e41adba60977
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 51dc4cdd42cc57072b4e9da3aa02029597d4676c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-14 11:25:09 +00:00
Rami Potinkara
7918d0699c Android: update Android 15 SDK 35 to docs
This patch updates the macros for Android
maxApiVer, AndroidMaxVer, AndroidPlatformVer,
AndroidBuildToolsVer variables to reflect
Android 15

Task-number: QTBUG-129462
Pick-to: 6.8 6.5
Change-Id: Ia6edfa7811dd8c98a0a99c10d8781aa09384bdfa
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
(cherry picked from commit 9b475eadfcf04194a094454f65295c3a456000a4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-14 10:09:33 +00:00
Tor Arne Vestbø
1b993a787d iOS: Pause display link when app moves out of active state
The applicationWillResignActive documentation describes that the app
should "use this method to pause ongoing tasks, disable timers, and
throttle down OpenGL ES frame rates". Similarly, the more modern
sceneWillResignActive describes that the app should "use this method
to quiet your interface and prepare it to stop interacting with the
user. Specifically, pause ongoing tasks, disable timers, and decrease
frame rates or stop updating your interface altogether."

In practice the application enters the inactive (as opposed to the
backgrounded) state when the user brings up the app switcher, or
enters split-view mode, as described by the "Adopting Multitasking
Enhancements on iPad" documentation.

We do propagate the inactive state as Qt::ApplicationInactive, but
it was up to the application itself to react to the state.

To adhere to the documented behavior, we now skip update request
delivery if the app is not active. Once it becomes active again
we re-try the update request delivery.

Relying on the exposed state of window was not an option, as the
window is still technically exposed, even if the app itself is
inactive.

This hopefully fixes a GPU crash observed (only) on A10 iPads
(iPad 7) with iOS 18, when the user entered split-view mode,
possibly due to changes in the system Metal-based OpenGL driver:

  void IOGPUScheduler::signalHardwareError(eRestartRequest, int32_t)
  void IOGPUScheduler::hardware_error_interrupt(IOInterruptEventSource *, int)
  void IOGPUCommandQueue::retireCommandBuffer(IOGPUEventFence *)
      Deny submissions/ignore app[openglwindow] with 2 GPURestarts in 31 submissions.
  Execution of the command buffer was aborted due to an error during execution
      Caused GPU Timeout Error (00000002:kIOGPUCommandBufferCallbackErrorTimeout)
  GLDRendererMetal command buffer completion error
      Error Domain=MTLCommandBufferErrorDomain Code=2
  Execution of the command buffer was aborted due to an error during execution
      Ignored (for causing prior/excessive GPU errors)
  Terminating due to blacklisting by kernel driver

The back-trace always pointed to the display-link callback,
so the assumption is that the crash was triggered by the app
rendering when it shouldn't, during the split-view transition.

Fixes: QTBUG-132314
Pick-to: 6.8 6.5 5.15
Change-Id: Idf1f692daa9d437ee69f9436706777b220fbfbf4
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit c812190a921660c748be3324c3a34245b24354e9)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2025-02-13 21:56:31 +00:00
Marc Mutz
4ed56eaafc QLayoutPolicy: use qCountTrailingZeroBits() in setControlType()
This is more efficient, because it maps to a single assembler
instruction on most ISAs, and also avoids a Coverity warning about the
loop not terminating and thus 1 << i overflowing, if type == {}.

The clone class, QSizePolicy, is not affected, since it already uses
qCountTrailingZeroBits().

Amends 6c322a917ad57d57f0ee76825eab3e2e008c5bd4.

Coverity-Id: 474336
Pick-to: 6.8 6.5
Change-Id: Idf62d045d8ac3f0cb15196dd8664ac37d92a9cc2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d71379d447e87843c5a5d91857c4ff253ad4b847)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-13 14:15:43 +00:00
Aurélien Brooke
21a0818903 Qt Concurrent documentation: fix Forward Iterator example container
std::slist doesn't seem to even exist on Google, while std::forward_list
exists in the standard since C++11.

Pick-to: 6.8
Change-Id: I9869c716fb631bc743e656a3b8bbb8ca35c9a1ed
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 9e5dae9b8c3d43cfd86719e429f35b032d14c66c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-13 14:15:41 +00:00
Thiago Macieira
904023e2de Fix use of #warning in compilers that don't support them
That becomes an error. So only allow them in GCC-compatible compilers.

Fixes: QTBUG-133376
Change-Id: Idd04be795dd9fd2b43affffd08cd7b8a444bbc43
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 5da95322bd0ed7bfb94028582a82689124646dbd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-13 14:15:39 +00:00
Shawn Rutledge
a4d4ef9df5 doc: Explain the use of QContextMenuEvent cross-platform
...and across Qt Quick and Widgets, and somewhat from a usability
perspective.

Task-number: QTBUG-67331
Task-number: QTBUG-93486
Change-Id: I75085f3a7a8e76c3e67ff5864600324faf262a76
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 6e089a66a4d08a5d788c194560fccdec793e6337)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-13 11:41:28 +00:00
Alexey Edelev
9fcce29068 Remove dead code
Remove unused variables and property get call.

Pick-to: 6.8
Change-Id: I0da26fae813fd201f7fbb24d2b779e62a78250e2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 3db7fd6a3f43500319250083a2a59812b5925c1d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-12 18:02:46 +00:00
Allan Sandfeld Jensen
a69fdf6410 Update defaults for QPaintDevice
A few values have meaningful defaults, for the rest only warn about
implemented metric.

Pick-to: 6.8
Change-Id: I80c6c8dba6c8d2715daac0463a411bc5117f0bc0
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit da1fbf6053c07df76a4d2518103bdfc40d59cfa8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-12 12:44:20 +00:00
Jerome Pasion
89ee514a27 Qt D-Bus Viewer: Update documentation
-Added information about the location of qdbusviewer
-Fix name to "Qt D-Bus Viewer"

Fixes: QTBUG-118997
Pick-to: 6.8
Change-Id: I90f1e75a04a959d9c739e33779d978b607a8181c
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit 1a8ae82bb02120c6128eb720072daf8acda5bd2b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-12 12:44:18 +00:00
Thiago Macieira
3d43223448 QLibraryInfo: use fewer QFileInfo in finding qt.conf
This is hot code, run early in the application's life, usually as a
result of the first qDebug() because QLoggingRegistry wants to find
qtlogging.ini. So let's not use QFileInfo, which allocates memory, just
to do string manipulation. These are always filesystem paths.

See commit d59e640c868f3db2d661970f3d34a22013d49053 for a similar change
in findConfiguration().

Pick-to: 6.8
Change-Id: I012daf4a3aa2ebc2c5abfffd2ef7ceac1df2626d
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit c74cba1117355a6312b1f0cc815efa4cdea4bbfa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-12 02:20:32 +00:00
Marc Mutz
6dd6836227 QJsonValueConstRef: remove duplicate Q_ASSERT in objectKey()
Amends 14d1108d3562f6e409505ba49b7bce82d70bd64f.

Pick-to: 6.8
Change-Id: I9fcfb864254d040cd1de8aa0dc818ccd9104487b
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 6aaa874d79805dc6407a68e56f8d9ee128ad37bc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-11 23:45:24 +00:00
Bartlomiej Moskal
bc533b0fb2 AndroidTestRunner: allow to call additional/extra adb call
This commit adds a new parameter (--pre-test-adb-command) to
AndroidTestRunner. The new parameter allows to pass an extra adb command
which will be called by AndroidTestRunner after installation and before
running the test.

To set the mentioned argument the new parameter for qt_internal_add_test
was proposed: ANDROID_TESTRUNNER_PRE_TEST_ADB_COMMANDS.

The new parameter is needed especially for multimedia screen capture
tests. ScreenCapture feature needs an acceptation of Security Popup. It
can be automatically accepted with additional adb command.

Fixes: QTBUG-132249
Pick-to: 6.8
Change-Id: Ib70cd05d60d4594961ca68b554c7aae11cf42240
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit b4c82eba03388aa4f9e5b56f633e0e679a3b0123)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-11 21:04:09 +00:00
David Faure
05016926ae QToolButton: allow opening a menu after it first failed because empty
Commit 353ce5344fbde5a6cecbdd2c131e1cf0f4b7f383 made QMenu::exec()
return immediately (without showing the menu), which meant it never
emitted aboutToHide() and QToolButton didn't reset mouseButtonDown.
Therefore, on the next click on the toolbutton (maybe by then the
menu has actions), it won't even try to show it (because mouseButtonDown
is still true).

Pick-to: 6.8
Task-number: QTBUG-129108
Change-Id: I3f84b9a35eb444fc33d8516c4be130293c04017d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f0508b7ff3d2393521f49dcb1a9e880bf7665a87)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-11 20:24:40 +00:00
Marc Mutz
7fc08a8a68 BenchmarkQtJson: print errorString() on QFile::open() failure
Amends 1c3ee86f183d46709c070ccd44970e05dc70f83d.

Pick-to: 6.8 6.5
Change-Id: Iaffdbd43fc182a46e1280bc7e023083bbea4a285
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5b52814d643e2a38581850293610acc2d0ee4c69)
2025-02-11 18:21:14 +01:00
Alexandru Croitor
b91da6c943 CMake: Simplify and fix target dependency handling in SBOMs
Previously we had complicated logic trying to differentiate between Qt
targets, system libraries, vendored libraries, custom sbom targets,
whether they are in external documents or not, when generating SBOM
dependencies for a target.

We also lacked the ability to handle regular non-Qt non-system
libraries. This was discovered while creating the SBOM for Qt Creator,
where the code treated all Creator helper libraries as system
libraries rather than just regular dependencies.

Simplify the code by unifying most of the code branches, removing
nested ifs, and removing special handling of some targets when
checking whether they are in external documents.

Now system libraries are marked at qt_find_package time by setting the
_qt_internal_sbom_is_system_library property on the target, rather
than trying to infer it base on the target name and other markers.

Now the logic goes as follows:
- check if system library based on the presence of the
  _qt_internal_sbom_is_system_library property
- check if it's a vendored lib based on walking its libs and checking
  if the _qt_module_is_3rdparty_library property is set
- mark system libraries as consumed
- if not a system library, handle it as a regular dependency, taking
  into account if it's external or not

Also add some debug messages to help keep track of system libraries.
And remove some of the unnecessary code in
in _qt_internal_sbom_is_external_target_dependency and
_qt_internal_sbom_add_external_target_dependency.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: Ic43fe53446b74badee2cde6d18146e952587c292
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 66261ac0f1f2807916c80b2050536d52b8fe6d3a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-11 17:21:14 +00:00
Ivan Solovev
08ef73f94f tst_qfuture: silence all continuation overwrite warnings
Introduce a helper function to silence this lengthy warning, and use
it consistently in all places where the warning was triggered.

Amends 502a7706b94380d4957a7e594fc7c4c4db8ae81b which introduced the
warning.

Pick-to: 6.8 6.5
Change-Id: Ifa5c7e0182a12885af4db42ef5d68b1f27a0c6bc
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit a30289ee0be41e8311aef6d8737885b354a9f047)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-11 17:21:13 +00:00
Alexandru Croitor
59a571c75d CMake: Decouple Qt specific handling from SBOM implementation
The SBOM functions so far had a lot of Qt-specific logic inside them.

Decouple this logic into separate Qt-specific functions or explicitly
guard the code with Qt-specific handling options, to prepare for a
cleaner SBOM public API.

The generic functions then call the Qt-specific ones if various
internal options are set.
This approach is used, rather than directly passing values to the
generic functions because:
- we have cases where we need to recursively pass the values all the
  way down to all recursively created attribution targets
- some of the logic needs to know about values before and after qt
  processing, and this could be achieved with something like lambdas
  but it's not worth the complexity

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I4399c41f4d976f20b16a0bb0c674d4f07ee1ccd4
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit f1ac316191c010b1389f6f3549c9f0b4424b9936)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-11 17:21:13 +00:00
David Faure
bbc46bbc7a QMenu: improve test for "empty menu" to be style-independent
This amends commit 353ce5344fbde5a6cecbdd2c131e1cf0f4b7f383 so that
the behavior doesn't depend on the widget style.
If QStyle::PM_MenuPanelWidth returns 2, then size will be (2x2),
which is hardly a valid menu to show - don't show that either.

Pick-to: 6.8
Task-number: QTBUG-129108
Change-Id: I2daa05932ea00971880747daeffdfa20a8be3f22
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9dfd8410b07b0c484443ad6355004ace5f9b2b8b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-11 17:21:13 +00:00
Ivan Solovev
5b55e8d1f0 QFuture: prevent the continuations from being executed twice
On some very rare cases the continuation could be executed twice in a
multithreaded scenario. Consider the following example:

  auto f = QtConcurrent::run(someFunction);
  f.then(someOtherFunction);

Assuming that QtConcurrent::run() is executed on Thread B, and the
continuation is attached in Thread A, the following call stack is
possible:
1. Thread B: someFunction() is finished
2. Thread B: QFutureInterface::reportFinished() is called
3. Thread B: QFutureInterfaceBase::reportFinished() is called and
             finished.
4. Thread A: then() is called. It checks that the future is already
             finished, so the attached continuation is executed
             immediately.
5. Thread B: QFutureInterfaceBase::runContinuation() is executed.
             At this point it sees that a continuation exists, and
             executes it again.

Step 5 will lead to a crash, because we'll try to access a moved-from
QPromise.

To fix the issue, introduce a flag that is explicitly used to test if
the continuation was already executed or not.

The pre-existing code already uses a concept of a continuation state,
but it cannot be easily extended without convering it from an enum
to flags, because the canceled continuation should still be called
in order to actually execute the onCanceled() handler.

Wrapping QFIBP::ContinuationState into QFlags would increase its size
from 1 to 4 bytes, and manually treating the enum as flags will result
in a more complicated code. So, I simply picked the approach of adding
an explicit flag for this case.

Writing a unit-test is not really possible, but I verified that the
reproducer from the linked Jira ticket does not crash anymore.

Amends dfaca09e85a49d2983bb89893bfbe1ba4c19eab4 that introduced the
continuations, so picking to all active Qt 6 branches.

Fixes: QTBUG-118032
Pick-to: 6.8 6.5
Change-Id: I3e07722495e38367e8e4be2eded34140e22b0053
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 04b5d2b94f96c73a13973f6a57cefbf07d2e850b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-11 17:21:13 +00:00
Alexandru Croitor
90b128e4cc CMake: Fix location of build time sboms in no-prefix builds
For build time sboms to be found in a no-prefix qt build of a repo,
specifically when finding external sbom documents, the build time
sboms have to be in the same location.

Previously they were in each repo's build dir.
Align the location to be in the qtbase build dir, just like for super
builds.
Also check for QT_BUILDING_QT because we don't want to apply the logic
for QT_WILL_INSTALL not being set in user projects.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I04a066fc0efc91a4f2ee938c190b8632c8c946aa
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 3a5c62d4af9cb07fba065de8a2d1b97531b6fd30)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-11 17:21:13 +00:00
Alexandru Croitor
81b3e80840 CMake: doctools: Avoid blocking integrations due to version mismatch
It can happen that qt repo version bumps are direct pushed, and not
merged in DAG-dependency order. This can cause a mismatch between the
qttools package version and any of its dependencies, which would block
integrations. To avoid this, we disable the warning about incompatible
package versions when building the doc tools. The version check in
that case doesn't make sense, so it's safe to do.

Amends f7f02c791bcbee44597f1fe24570ebdf352ec648

Pick-to: 6.8
Task-number: QTBUG-128730
Change-Id: I6180ecb09c6a3dee415ae73c11549ee0f709f240
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Toni Saario <toni.saario@qt.io>
(cherry picked from commit a8f55f4729918700b9597843c98f9f2505ff0d23)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-11 17:21:13 +00:00
Frédéric Lefebvre
829b67074e tst_QGestureRecognizer::swipeGesture set FramelessWindowHint
tst_QGestureRecognizer::swipeGesture() is flaky as sometimes the
gesture event is being sent before the widget's position has
been updated.

The gesture starts in the window frame.

Set flag Qt::FramelessWindowFrame to prevent this from
happening.

Fix flakiness on Opensuse 15

Pick-to: 6.8
Change-Id: I794b022b5a51146ddfa7d6029509c6fa43b9aad6
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 6dc0e593939cbeaeb45392d8daf7fcd90e8cb0f8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-11 14:34:57 +00:00
Volker Hilsheimer
288ef3479e Fix warnings in benchmarks from QFile::open being [[nodiscard]]
Pick-to: 6.8 6.5
Change-Id: I8a80af3614a92645be2d64d02ce81e9d263468c8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 1c3ee86f183d46709c070ccd44970e05dc70f83d)
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2025-02-11 09:36:20 +00:00
Volker Hilsheimer
8b2f1b4d1a Fix warning from ignored return value of [[nodiscard]] function
Pick-to: 6.8 6.5
Change-Id: I1e293773d70cda1c58c4f3dc798ce2f65224ed9d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
(cherry picked from commit 823c2bfc13feb13cabc89638423274f560239087)
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2025-02-11 09:36:13 +00:00
Volker Hilsheimer
2a67dcda5e Fix warnings in tests from QFile::open being [[nodiscard]]
QVERIFY the result, with filename printed if useful.

Pick-to: 6.8 6.5
Change-Id: I1b21e213856458b7bc36682dd3671bd29c437b99
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 8563ed54053024a4673e2bff9fce506fd648a312)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2025-02-11 09:35:50 +00:00
Marc Mutz
76c50ca167 qhighdpiscaling: pass QStringView by value
QStringViews should be passed by value, not cref, so sane ABIs pass it
in registers instead of forcing the variable to the stack.

As a drive-by, s/QVector/QList/ in the return type.

Amends 51e2a64ed9360c8e889726c3fbaf649a4d260e0d.

Pick-to: 6.8 6.5
Change-Id: I6b51dfda87643f6c7ec219ac4a8970537bb6b2ed
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8113a50d71cb9ea320e69c2b10452972e3310f4d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-11 00:51:30 +00:00
Alexey Edelev
ee3c82a234 [vcpkg] Fix the chainloading of the platform specific toolchain files
QT_CHAINLOAD_TOOLCHAIN_FILE might not be set, but
__qt_chainload_toolchain_file falls back to the value initially set
when building qtbase in per-module build scenario. Use the correct
variable(__qt_chainload_toolchain_file) when specifying
VCPKG_CHAINLOAD_TOOLCHAIN_FILE.

Pick-to: 6.8
Change-Id: I331c305a17172a1cc67a6ed8b43b2baa380abc0b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit c65d6319f9379a724ddb4c0757245fe51c93fac5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-11 00:49:15 +00:00
Matthias Rauter
df96b6a707 Unifty logic in QDomNodeListPrivate::forEachNode
All iterations through QDomNodeListPrivate were going through the
forEachNode function with its own internal logic. The newly introduced
iterator works with the similar logic but is written a bit more compact.

Thus it makes sense to replace the forEachNode logic with internal
functions of the iterator.

Change-Id: I22b7ae7a49e2bfaf84bede2fe0b45530a32f8d55
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit b1c32afb914a8dda0b1b38bf9d85c1c316b27cf1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-10 21:26:23 +00:00
Thiago Macieira
00caa645ff QLoggingCategory: remove #ifndef QT_BOOTSTRAPPED
Amends commit 670810787318df8a80b2197b49448c18a78bb7ed from 6.8, which
removed qloggingregistry.cpp from the bootstrap library build.

Pick-to: 6.8
Change-Id: I3bb5609707478df771b8fffd3e71eb889eaac53f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 696e11ec729452d246e736e54790411b408f9c3c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-10 21:26:22 +00:00
Friedemann Kleint
20646e132c uic: Add #ifdef depending on Qt version for QPalette::Accent
Complements 17c589df94a2245ee92d45839c2cba73566d7310.

Pick-to: 6.8
Fixes: QTBUG-133651
Change-Id: Ieb57df30863f8493cd170d80220ae09177842ede
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
(cherry picked from commit 1832ac4d25dd5c32963c47ad38836a0ea2ebd793)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-10 21:26:22 +00:00
David Faure
3af7624967 QConcatenateTablesProxyModel: implement roleNames()
Change-Id: Id74b45f58678df15285c8b9631db1c59a5d62a2a
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
(cherry picked from commit 5ffb9d7ae6d60fb370b79f8222dab7d7e628fa4f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-10 21:26:22 +00:00
Marc Mutz
18b56bbae2 tst_QAnyStringView: test which chars magically convert
QAnyStringView is designed to replace overload sets containing QString
and QChar, among others, so it needs to accept types that merely
implicitly convert to QString and QChar. It achieves this by
maintaining a hidden container to hold the converted QString or QChar
for the duration of the full-expression, much like the compiler would
do if the function took QString/QChar.

This patch adds a check for the single-char ctors to determine whether
they convert or not, by comparing QASV::data() to the address of the
QASV's argument. While it would be interesting to have the same test
for QString, that is outside the scope of this patch.

Task-number: QTBUG-126054
Pick-to: 6.8 6.5 6.2
Change-Id: I30ac2d1199da5a03fe6fee4c9d5ea2a209a003d6
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit f31c37a1312fc4e21a58906e2b883099629fb9e1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-10 21:26:21 +00:00
David Faure
f8b100c136 Doc: document RemoveAuthority and RemoveFragment in QUrl
Change-Id: I5ff4898853f1655a902523e7f22344deb5624cc1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit eda83d41f6dbc00403447a9b6b6ed730e6706554)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-10 21:26:21 +00:00
David Boddie
1b245a8a46 doc: Remove invalid link and tone down language
QLatin1StringView::split() appears to be invalid.

Pick-to: 6.8
Change-Id: I11066b8224cce0a6091c758367f602a63c6136a0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 4aff3488b8262ef23f1230b7f530c46ca2d61ac1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-10 21:26:21 +00:00
David Boddie
6de04b08c4 doc: Fix broken links, including auto-links
Pick-to: 6.8
Change-Id: I967304c24e1a593b1b555998a718d0a015e12900
Reviewed-by: Jerome Pasion <jerome.pasion@qt.io>
(cherry picked from commit bddfded80e225cbc112b79ccf5ada20a01e62fcf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-10 21:26:21 +00:00
Mårten Nordheim
5985c90d37 Update UCD to Unicode 16.0.0
They added some new scripts.

There were a few changes to the line break algorithm,
most notably there is more rules that require more context than before.
While not major, there was some shuffling and additions to our
implementation to match the new rules.

IDNA test data now disallows the trailing dot/empty root label,
technically to be toggled off by an option that controls a few things,
but we don't have options. For test-data they changed the format a
little - "" is used to mean empty string, while a blank segment is
null/no string, update the parser to read this.

[ChangeLog][Third-Party Code] Updated the Unicode Character Database to
UCD revision 34/Unicode 16.

Fixes: QTBUG-132902
Task-number: QTBUG-132851
Pick-to: 6.8 6.5
Change-Id: I4569703659f6fd0f20943110a03301c1cf8cc1ed
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 85899ff181984a1310cd1ad10cdb0824f1ca5118)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-10 21:26:21 +00:00
Tor Arne Vestbø
260276642e macOS: Update window flags when updating content border thickness
The titlebarAppearsTransparent property of NSWindow depends on whether
the window has a NSWindowStyleMaskTexturedBackground, so we need to
re-apply the window flags after updating the style mask to ensure we
pick up the updated value for titlebarAppearsTransparent.

Amends a1e6fed44964a3eb14045bf819d232d6cbad9f59.

Fixes: QTBUG-133525
Change-Id: Ifff594f54569ac43ad27917e5f4b2f8a3bae5901
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit bddc0198297828ba29e5cf4b39e07412a506a551)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-10 21:26:20 +00:00
Frédéric Lefebvre
ea55328741 Tst_QGestureRecognizer::panGesture set FramelessWindowHint
tst_QGestureRecognizer::panGesture() is flaky as sometimes the gesture
event is being sent before the frame and position has had time to
update. The event then starts in the frame and is not received by the
widget.

Set FramelessWindowHint flag to the widget, to remove the need of
updating its frame position and position.

Fix flakiness on Opensuse 15

Pick-to: 6.8 6.5
Change-Id: Id88510a91e3ed0d5ff92fdc31422503744448b3e
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit fc0e788d029beac251fda40650154fc6865e1649)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-10 13:59:52 +00:00
Edward Welbourne
c38718c846 Add terminal rows to various QtTimeZoneLocale tables
This fixes some read-past-end issues in assertions that verify the
next row of a table after the last for a specific locale belong to a
later locale. Since those assertions happen without sight of the table
of which the locale's range is a part, they can't tell when the
range's end is in fact the table's end - so they shouldn't have been
reading from a row there. Fix by putting a row there, that belongs to
a nominal locale with index out of range.

Change-Id: Ib9d227ca4f86c372c13f963a08a8d637eae63ed0
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit b37c580169890d5ccacb5746eb4b99dd711efda4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-10 13:59:50 +00:00
Mårten Nordheim
1aef8b9057 QMultiHash: fix/update class description documentation
It no longer inherits QHash, so drop the references to this.

And remove an extra 'and'.

Pick-to: 6.8
Change-Id: I5c19f7793571fe04f93e0ede37d280d215d95dfc
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit dc8055c9149c0ceb42b4313fb7af0a5b78fe1c16)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-10 13:59:48 +00:00
David Boddie
a8fe95f0ea doc: Fix broken links and incorrect information
ReadOnly was used in places where ReadWrite was the correct value.

Pick-to: 6.8
Change-Id: I26a2f0de55665ac015fe269e8e5f0d23a2f00e5f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 4dcff4ed6d24e6aa061e145bb9de9ff93351a2b1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-10 13:20:27 +00:00
Allan Sandfeld Jensen
33b98002c2 Fix config summary CPU subarch line
Was likely broken by abc888c75bf145bb5da2680b7943f1ea3af83202

Change-Id: Ic9ed27255f105272ef60c3a91f3d934c70b91b8b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit a522a0595bc3e908efc7ec70c9d7120c4d5c599b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-10 11:41:13 +00:00
Bartlomiej Moskal
941434e81f Android: Fix cursorHandle and EditPopup positions
After the commit 28df9a49776a88cb1a8e69348ae19a59b16a5b7e, a regression
occurred in the positioning of cursorHandle and EditPopup.

Previously, these positions were calculated using QtEditText
coordinates, which worked correctly because the QtEditText size matched
the QtWindow size. However, after the mentioned commit, the QtEditText
size no longer reflects the window size. In this case, we need to use
the parent View for calculations.

This adjustment was already made for the single cursorHandle.

This commit also updates the positioning of selection handles and the EditPopup.

Fixes: QTBUG-132589
Pick-to: 6.8
Change-Id: I861292e363452d487284e3f603fe03a21a334aa4
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 5bd26fda7a3f0a509a64847b58b916830ebc2d0c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-10 11:41:11 +00:00
Matthias Rauter
6869341dce Make QDomNodeList::It bidirectional only
The new (6.9) iterator for QDomNodeList was implemented as random access
iterator. The underlying structure of QDomNodeList is similar to a
linked list and therefore it is better suited for bidirectional
iterator.

This patch changes the iterator to a bidirectional iterator. Further the
tests are expanded because the new implementation uses more custom code.

Fixes: QTBUG-132527
Change-Id: I796f445e0b883abc2aea613f1fed6f17c4d93dcd
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 8609982791928a30a6d836b25810143a064f8c6f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-10 10:13:56 +00:00
Even Oscar Andersen
43eb0dbd38 wasm: Truncate input field length to 1px, fix object selection
Having the input field length too wide causes the view to scroll
to contain it. Since it is not visible, setting it to 1px width and
height should work.

Further, input field contents where set on the showInputPanel
call. At this point in time we do not necessarily have an updated
focus object. Hence the input contents is now set on the
setFocusObject call.

Ignore input on showInputPanel/hideInputPanel. This reflects
the current design where showInputPanel do not act unless
inputMethodAccepted(), and hideInputPanel do not act if
m_focusObject.

Still hideInputPanel used to set m_usingTextInput to false,
this behavior is not kept.

Fixes: QTBUG-132057
Pick-to: 6.8
Change-Id: I2d7088def8060df267c5da9e045824decd913faa
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 7dd94d74e4497647ff62c85460643487baf372bc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-09 06:56:56 +00:00
Wladimir Leuschner
9f7437fb85 QWindows11Style: Add left margins to Radio/Checkbox indicator
On 150% DPI scaling, the Radio/Checkbox indicators were clipped. This
patch adds an extra margin to the left to avoid this clipping.

Fixes: QTBUG-133117
Pick-to: 6.8
Change-Id: I2e0186cbdad12481922de5ddf00f50daeb94bb37
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 3d45d22b536cd5fa074f6de4d02b1fd049e6b220)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 19:39:19 +00:00
Christian Strømme
5296136496 rhi: Always check and mark the extra buffers for reuse on metal
It's not just with tesselation we're using these buffers, but also for
multiview, which meant we'd continuously grow the pool until we run
out resources when multiview was enabled. Interesting observation
from this is that newBufferWithLength would 'hang' instead of
returning erroneously unable to acquire a new buffer.

Change-Id: Ie30ca44bc7b4b8f29c517fe6c88fafbe46be3d17
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 3c81c8907633fbc154ec4ae3a89e8d86c9ca0832)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 18:22:09 +00:00
Edward Welbourne
055b5a83b4 Modernise tst_QTextStream::manipulators() and add two new data rows
It was using int for two flag columns; we can pass the relevant flag
types now, and we get better type-checking by doing so. Expand the
integral numeric column from int to qlonglong, since that's the type
we actually end up with by the time we're asking QLocale to do our
formatting for us. Add test-cases for things we've lately noticed
aren't right, notably including the min-qlonglong test (which passes
because compilers handle the UB straightforwardly), that needed the
integral numeric column's expansion. Sign-handling for negative values
in hex fails; a later commit shall fix and remove the QEXPECT_FAIL().

Pick-to: 6.8 6.5 5.15
Task-number: QTBUG-133269
Change-Id: I39c5339b144b40a30886d8253fa464828ed87629
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 5a230596c8c1f63e662ce17e094e2ae187066d6d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 18:22:09 +00:00
Frédéric Lefebvre
69738c76b4 tst_QGestureRecognizer::touchReplay give fix position
tst_QGestureRecognizer::panGesture() is flaky as sometimes
the gesture event is being sent outside of the parent. It
is being sent in the window frame instead of in the widget.

Fix position of the parent and verify that it is correct.

Fix flakiness on Opensuse 15

Pick-to: 6.8
Change-Id: I00eacb80a7e2e658345d3bc56cdef0c0024d1a1d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 3766b9cb3cb49fdef626526181b6a7fe26870e29)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 18:22:09 +00:00
Tor Arne Vestbø
5127aef0bb cmake: Add option to pass additional arguments to _qt_internal_plist_buddy
Pick-to: 6.8 6.5
Change-Id: Icbbfcb7fffa97370c3cdf7440e801eea60de84f0
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit ab4aac7bf137083a401186029fe70ff00137f279)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 12:45:27 +00:00
Tor Arne Vestbø
8f837f6e6f cmake: Find Apple ID via IDEProvisioningTeamByIdentifier for Xcode 16.2
The format of the Xcode preferences has changed, so we need to account
for the new format when looking up the default development team.

Pick-to: 6.8 6.5
Change-Id: Ib34c2e5245c13db4d81218a5a2460417e4fc6347
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 469e4237cf32d27609661132727555490086750b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 12:45:25 +00:00
Tor Arne Vestbø
0ff3a84bc3 Document QSurfaceFormat::ColorSpace deprecation
Pick-to: 6.8 6.5
Change-Id: I894316d0b3df703e5fd07a1c18f579992215e621
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ca250a637297042d39c3e799a1e25ec3168d6f15)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 12:45:23 +00:00
Tor Arne Vestbø
761d516fd4 qmake: Find Apple ID via IDEProvisioningTeamByIdentifier for Xcode 16.2
The format of the Xcode preferences has changed, so we need to account
for the new format when looking up the default development team.

The account identifier (previously an email address) was not used by
any consumers of the provisioningTeams() function, so it was left out.

Pick-to: 6.8 6.5
Change-Id: I81a400000615594336e14c95db86ffa71a5c5ff9
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 380a9fdc872e14e537f3e148c7a1e72be5face2d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 12:45:21 +00:00
Tor Arne Vestbø
6a23dfba36 cmake: Rename _qt_internal_find_ios_development_team_id
As well as the _qt_internal_apple_development_team_id_computed
property.

It's used for macOS as well, so use `apple` infix instead of `ios`.

Pick-to: 6.8 6.5
Change-Id: I7932166d094a14ac32cce95e6c9fcbfa44bb97b4
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit d688c73e083cecc9b9478f09b202b66b92c87e4d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 12:45:19 +00:00
Alexei Cazacov
639f5bf5db Docs: fix minor issues with topic naming
Change-Id: Iaf8d12743a5f43c355f6960f1da0c6764e622bf8
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
(cherry picked from commit 32890793caae08c2dc05ce1f68e659f219536ed7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 12:45:17 +00:00
Ahmad Samir
db1ed43050 QString: add {setUtf16,setUnicode}(const char16_t*) overloads
This is a first step for adding QT_NO_INTEGRAL_STRINGS in the next
commit.

Mark setUtf16(const ushort *) as obsolete.

Use the weak overload workaround, so that the call isn't ambiguous if
it's called on a nullptr.

[ChangeLog][QtCore][QString] Added setUtf16(const char16_t *) and
setUnicode(const char16_t *) overloads.

Task-number: QTBUG-125871
Change-Id: I25d12c19876466c235c0d9928aae6fd332836bf5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit be3bf632e1cf80b16475f8353e4753b38317626b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 12:45:16 +00:00
David Boddie
ae6b9c0c63 Fix or remove broken and outdated external links in qtbase documentation
Change-Id: Ia78b3b16b89ab3f80d990b6e338b4a0f294ab1ed
Pick-to: 6.8
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit 787d1db34745fec2e89cd99f62767079213bb8fa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 12:40:43 +00:00
Topi Reinio
f490b4de05 Doc: Clean up output for tabbed content macro
Insert line breaks in the content the \tab macro expands to. This
produces nicer-looking html and also fixes an issue related to
the post-processing done to the generated files.

Fixes: QTWEBSITE-1202
Pick-to: 6.8
Change-Id: If4e7f7242f8687ef84ad715744653c4167cf907f
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
(cherry picked from commit 88e4e952d73db9bc442593a96c88ca22ba7ab673)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 08:08:41 +00:00
Liang Qi
4be258fd13 ibus: use logging category for im debug
Pick-to: 6.8 6.5
Change-Id: I5397f1fb14273b77833979d3e66056a7110fd2b0
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Inho Lee <inho.lee@qt.io>
(cherry picked from commit 5c9fd486ae82056614bdb9e685c825b586bb9809)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 03:14:36 +00:00
Pavel Dubsky
775d56f01d Move UUID definitions out of Qt namespace
When UUID definitions are placed within Qt namespace MinGW build fails because specializations of struct __mingw_uuidof_s are now defined in a different namespace.

Fixes: QTBUG-133516
Pick-to: 6.8 6.5
Change-Id: I49270aa2a892d407675dab7b90d3929d120c5224
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
(cherry picked from commit 84b7cef13913139b2ed7e506ace0fa6b97269829)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 02:34:30 +00:00
Matthias Rauter
1d067db128 Extend testing of QDomListIterator
In preparation of changing the random access iterator to a
bidirectional iterator, the tests are extended to ensure complete
test coverage.

Task-number: QTBUG-132527
Change-Id: I8caf93417282631f7982cb12a82b39c00d67c913
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit e4bcd9f1cb0e787c9353589ea48dca6823592d41)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 02:34:30 +00:00
Laszlo Agocs
6446d865be rhi: d3d12: Fix finish() when called outside a frame
Pick-to: 6.8
Fixes: QTBUG-133454
Change-Id: I447610917966a9dcd4b80dc8b84156ce985f9ca9
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 01308ff18e74860dd32472bbff31ca1fabd8339f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 02:34:29 +00:00
Laszlo Agocs
987ff07a85 rhi: d3d12: Fix crash in readbacks
Amends 73405890b8911dd1a58120665ce63a38281c6ce4. The patch here
does the same for D3D12 as that previous one did for the Vulkan
backend.

Others, like D3D11, are not effected because the loop logic there
does not branch.

Pick-to: 6.8
Fixes: QTBUG-133405
Change-Id: I88ac7c841dc0c28fc3f6b37c3402315b52de0a66
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 68e48ac60a9681887999e31f6dff622eb81bdb7d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 02:34:29 +00:00
Thiago Macieira
01010851cb QProcess/Unix: don't close the childStartedPipe too soon
We were accidentally closing it along with all the other file
descriptors if the CloseFileDescriptors flag was active. That meant we
were unable to report start problems back to the parent process.

So instead of closing everything immediately, we simply mark everything
as FD_CLOEXEC so they'll be closed by execve()'s success. Because we're
using CLOSE_RANGE_CLOEXEC now to detect the system call, we don't need
the configure-time test.

[ChangeLog][QtCore][QProcess] Fixed a bug that caused QProcess not to
report start failures if the UnixProcessFlag::CloseFileDescriptors flag
was active.

Pick-to: 6.8
Change-Id: I4d81d763281354e886d9fffd56ef6ab8b6115715
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
(cherry picked from commit 3d007ff2e9caf328f92d65f71a94fd869552b1b6)
2025-02-07 15:27:41 -08:00
Christian Ehrlicher
b2191e4450 SQLite: Update SQLite to v3.49.0
[ChangeLog][Third-Party Code] Updated SQLite to v3.49.0

Pick-to: 6.8 6.5 5.15
Task-number: QTBUG-132862
Change-Id: I0978f2d3bd6aab71cded77668912dec4cb569a68
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit eb03784510c037a377c576b298b9b2fccd16759f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-07 20:39:06 +00:00
Jan Arve Sæther
df1786d777 doc: QKeySequence cannot be cast to a QString any longer
bf805455d40b4445f61321439d529cd85cb6bc65 deprecated the QString()
operator in Qt5. Later dccf28b7c344822b7459635099ebe3abdf5fd107 and
2eee9e6fcf9b70681c5d9202d1509d176e48fc31 attempted to remove it
entirely, but a reference to it still remained.

This change also removes the detailed documentation for toString() in
the same paragraph, which previously stated that it generates strings
for use in menus. However, this is not always the case due to
toString(QKeySequence::PortableText). The differences between the two
serialization methods are already well-documented in the toString()
documentation.

Change-Id: I42dbb353bc56354f37b8fc22170f8e588eb97176
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit f06dd091696fed5b47a1bb071a8d5c28abb5c8a2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-07 20:38:59 +00:00
Eskil Abrahamsen Blomfeldt
e593626788 Improve hinted rendering quality on Windows
When rendering hinted text on Windows with DirectWrite, the goal was
to keep the rendering and metrics as close to GDI as possible,
minimizing the impact of changing the default font backend.

Therefore, the DWRITE_RENDERING_MODE_GDI_CLASSIC was always preferred
when hinting was on.

However, DWRITE_RENDERING_MODE_GDI_CLASSIC only applies antialiasing
in the horizontal direction, but GDI applies vertical antialiasing
as well. The result is that text will look more aliased with
DirectWrite than it did with GDI, which arguably looks ugly
especially at large sizes and can be perceived as a regression.

Microsoft documentation recommends using symmetric antialiasing
when the pixel size exceeds 16, so this patch enables
DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC for fonts larger than
16px regardless of whether hinting is on.

It's worth noting that for fonts with heavy hinting, such as
Times New Roman, the rendering using
DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC is different from
GDI, although more similar to Freetype. However, the impact
of not having vertical antialiasing is worse and as native apps
are moving towards using DirectWrite, the GDI rendering is not
going to be the definition of a "native" look anymore.

A second thing to note in this patch is that we always pass in false
for the useGdiNatural argument in GetGdiCompatibleGlyphMetrics().
According to the documentation, we should be passing in true for text
rendered with CLEARTYPE_NATURAL_QUALITY. However, doing this causes
wider kerning in certain cases. Since the tighter kerning matches
the layouts we get in native apps, as well as when using Freetype,
I've chosen to pass false for now, to be consistent.

This change also adds a manual test which can be used to switch
between DirectWrite, GDI and Freetype rendering on Windows, so
that it's easy to compare.

[ChangeLog][Windows] Improved hinted text rendering at font sizes
larger than 16px.

Pick-to: 6.8
Fixes: QTBUG-131946
Change-Id: Iebbe5c7affe7df6266ade6b161c31bde3d2caa84
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 407a98d94fb05780f30e77463fb2bd535041a044)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-07 20:37:02 +00:00
Marc Mutz
0e5e850691 QStringBuilder: remove an unneeded cast
memcpy() takes void*, not char*, so the cast from QChar* to char* is
not necessary (and potentially harmful).

Amends the start of the public history.

Pick-to: 6.8 6.5
Change-Id: I7b7178290bd30d93ed9e64b6b84294d0f7576c80
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 7206f6a39d298ed9c94bccf7bdc57498fa73ac36)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-07 20:37:02 +00:00
Marc Mutz
267acbc534 tst_QTextStream::stillOpenWhenAtEnd(): use QTRY_VERIFY()
The test is flaky every now and then on the CI, so increase the timeout from
5s to 20s (a previous TRY_VERIFY precheck reported just shy of 10s waiting
time, doubling should be™ sufficient).

Amends the start of the public history.

Pick-to: 6.8 6.5 6.2 5.15
Change-Id: I8e64bf8ac1576c0ac71790a03936635016b3b2b7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 40e65f029341a01e16dc88871eb7b24979aea9bf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-07 17:01:04 +00:00
Mitch Curtis
56c39a2622 iOS: send context menu event rather than instantly showing edit menu
This allows Qt Quick items to react to the QContextMenuEvent, rather
than immediately showing a native edit menu.

Task-number: QTBUG-35598
Change-Id: Id8f492b549431a42aa26f2d72b418301d2cab3dd
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit e426737d73bdda1b936e52179b08108250907e03)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-06 01:21:07 +00:00
Giuseppe D'Angelo
ef42c65ab1 Fix typo in QT_DECLARE_RO5_SMF_AS_DEFAULTED docs
Change-Id: I1f2acc02939171464e05671afcaf3df7ca2b3b8a
Pick-to: 6.8 6.5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 828cfd5d23b3024b0000cab7d2d20eb54971b858)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-06 01:15:30 +00:00
Marc Mutz
97a1b5ffa4 QFlags: make base class SMFs protected
This is from one of the 90s books on C++ Coding Style:

  Destructors of (public) base classes should be either public and
  virtual or else protected and non-virtual.

The dtors of the various QFlags helper classes were public and
non-virtual, allowing slicing and use outside of QFlags.

Fix both following the rule and making the dtors protected.

Previously, this would have been enough, but Clang started to warn
about undeclared copy- and move-SMFs in the presence of a user-declared
dtor, so need to declare all five.

Found in API-review.

Change-Id: I70d1163f7bb42d981bf550418d2775a784bd416e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f080f161237e3310fca0955742218276069e4868)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-06 00:52:52 +00:00
Ivan Solovev
c0d39fd2ed Move qtformat_impl.h into corelib/text
... because it is not really related to IO.
We were choosing between serialization and text, and ended up with
text, because that's where the standard itself puts format [0].

[0]: https://eel.is/c++draft/format.functions

Amends ffac33964d51971a1c1f61308b6f0a60a4133296.

Found in Qt 6.9 API review.

Change-Id: I827322175da81bc027a9e136098b7e84677f43f7
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 584ac8185255da9b15360bf0ca50677cba46ac9f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-06 00:52:50 +00:00
Marc Mutz
51bbe63d05 Port qcompare.h to qstdlibdetection.h's Q_STL_ macros
... and add more specific #errors.

There are two distinct error cases here:

- First, someone could add more Q_STL_ macros to qstdlibdetection.h,
  so like a switch with -Wswitch, list them all here and #error out if
  there's a Q_STL_ we haven't yet seen. The audience here is Qt
  developers, via the CI.

- Second, one of the "non-major" libraries (ie. not libc++, libstdc++
  or MS-STL) add support for C++20, specifically the std::ordering
  types as announced by __cpp_lib_three_way_comparison, in which case
  we need to retroactively add the correct unordered value here. The
  audience here is both Qt developers, via CI, but also Qt users.

So separate the two error conditions.

Also, for platforms where we don't know the numeric value of
std::partial_ordering::unordered, use Qt's legacy value, for
potentially faster conversions to/from QPartialOrdering. There's no
point in guessing which value _might_ be used by a future STL, and
swapping STLs is _always_ BiC, so we don't need to guess which STL
will follow the Dinkumware ones on QNX and VxWorks.

Amends 0231f33ad121a85368bb3f43273973b9632735dc.

Change-Id: I1d06a18ca5bb26aceb7c76a0f035ecd8d4673547
Reviewed-by: Michał Łoś <michal.los@siili.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 1a74f77f57fff52e0166dd895a8c6d9e09b388a4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-06 00:02:44 +00:00
Andrew Forrest
65e9eca63b Android: Fix mouse button processing
Fixes clicking UI elements with a mouse on Android.

8d8cbe87e21f05b7d611ed4be47299977288b267 introduced changes to support
mouse buttons other than Qt::LeftButton, but the release always looked
like no buttons changed, nor were they tracked (m_buttons is always
Qt::NoButton). Qt was not notified of mouse up, so nothing was clickable.

Now all mouse events go through sendMouseButtonEvents, and the last seen
button state is tracked for every event. If a mouse up with no buttons
occurs, the last seen set of buttons is used instead, so Qt correctly
handles the event. Also adds the mouse button state information to
mouse move events from Android, so the workaround for delivering
Qt::LeftButton when a window is tracking a move while a button is
pressed has been removed.

Tested on a Samsung A1 with a Bluetooth mouse.

Fixes: QTBUG-132700
Fixes: QTBUG-130297
Pick-to: 6.8
Change-Id: I241282c2915d7e6cf99db7f0bc1ad2d541349077
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit d908e043984dcfed3aa80e30cd1cafacd13b644d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 18:29:25 +00:00
David Redondo
281c45452b QScreen: Add a note to use QWindow::devicePixelRatio if possible
Like QGuiApplication does as well. Also add a note that screen and
window DPR can be different.

Pick-to: 6.8
Change-Id: I1a24cf7f11e945187da9dce4421039350e811997
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 97049278443860d3dd1b1efd20d1f7dabaf72a35)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 17:14:06 +00:00
Giuseppe D'Angelo
5ca7ad268a QVLA*: honor the RO5
The various base classes that abstract away template-independent parts
of QVLA have protected destructors to prevent slicing. Re-add the
special 5 (using the macro) and a defaulted default constructor.

Pick-to: 6.8 6.5
Change-Id: I60f036eafc808862a1abee72fd53023dd99b4cc3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c10072895d1061e258d23f3cc2a9050de5236a46)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 15:57:31 +00:00
Ivan Solovev
624784a729 [docs] Add three-way comparison overview
Task-number: QTBUG-128837
Pick-to: 6.8
Change-Id: I64ae12994f8a48ee5f4e48ca6ed7f5980476f2aa
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 737c87b2b21e30abf5e51126fd8ff4e45521144e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 15:57:31 +00:00
David Faure
7328f90e64 Linux: autodetect gdb (to add -nograb) even in release mode
Application developers using Qt from their distribution, or from the
official installer, get a release-mode Qt build, where QT_DEBUG wasn't
defined. That's no reason to hit the issue that a breakpoint in
code that gets hit when opening a popup menu should lead to a complete
desktop freeze due to the mouse/keyboard grab.

Change-Id: Idf0df03ce5afb792261b62cabb06fab17b5e2952
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit a176f87a6451412a632866fda1fd79290b9d7520)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 15:57:30 +00:00
Giuseppe D'Angelo
711b86fa24 QtGlobal: introduce a helper macro for declaring the RO5 SMFs as defaulted
If a class honors the RO0 we usually just leave a comment in the class'
body, and don't explicitly redeclare any of the RO5 special member
functions.

In some cases we may need to redeclare (some of) them. The main use-case
so far is to declare a protected destructor for a base class that is
not polymorphic, in order to prevent slicing; the compiler-provided
destructor is always public.

We can easily declare and default such a protected destructor, but that
comes with the problem that now we're violating the RO5 (as far as C++
is concerned, declaring a SMF counts towards the RO5, even if it's
immediately defaulted).

Specifically: by declaring the destructor, the class loses the
compiler-generated move operations, and the copy operations are
generated but deprecated. Clang >= 18 warns about this.

In such a scenario we *must* redeclare all five SMFs... and default them
all. This is boilerplate, therefore I'm adding a macro to streamline it.

Apply the new macro to a couple of cases were manual refactoring has
already been done.

Pick-to: 6.8 6.5
Change-Id: I5dc0ff9770621fbec0b1057c164d0623f901e3e9
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit fcb57391f73d36914e10ba964dbd9b01fe6f3af2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 15:57:30 +00:00
David Boddie
40dc33a9d3 Fix broken auto-links in QAtomic docs
- There is no load() in Q*Atomic (unlike std::atomic), so link to
  loadAcquire()/loadRelaxed(), depending on context.

- Also remove the template argument, <T>, which prevents qdoc linking.

Amends b62c3a85452aecf4f6c863645db34857b05d5ebf and
329e09a3c303fad1ab001de74924288aae1e7a9d.

Pick-to: 6.8 6.5 6.2 5.15
Change-Id: I8c58674ffc7e779fee982555edcd45ed40d4c17d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 9854482835071993968a524878b601c1d9327f1e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 12:08:40 +00:00
Marc Mutz
eb13efc4a6 Unbreak QSet::intersect()
The selection of which set to iterate over and which one to remove
from based on their relative size violates the function's
documentation, which clearly states that items are removed from *this,
and not from `other`, so the result must never contain any elements
from `other`.

Amends 4f2c96eaa8bfa4d8a6dfb92096e4e4030d0cdea7. Instead of reverting
to the gruesome old code with the forced detach-just-to-remove copies,
distinguish four cases:

- if the two sets are shallow copies of each other, then their
  intersection is *this

- otherwise, if either set is empty, clear() *this. This is required
  for one of the tests that 29017f1395b1bc52e60760fa58c92f6fa4ee4f60
  added to succeed.

- otherwise, if *this is detached, perform the operation in-place,
  using removeIf()

- otherwise, create a new set and move-assign to *this to avoid
  detaching just to remove something again. In this case, we can
  continue to iterate over the smaller set, but we need to keep
  picking elements from LHS into the result.

[ChangeLog][QtCore][QSet] Fixed a regression (introduced for Qt 5.2)
in intersect() that caused equivalent elements of `*this` to be
overwritten by elements of `other` if `other.size()` was larger than
`this->size()`.

Not picking to 5.15, as users will have likely adjusted their code to
the buggy behavior, and because removeIf() isn't available there.

Pick-to: 6.8 6.5
Fixes: QTBUG-132536
Task-number: QTBUG-106179
Change-Id: Idfa17c3b3589c4eacec27259fc01df6aeaa6c45f
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 162015e9c6f469951d9212ef655cff16dcace071)
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2025-02-05 13:08:40 +01:00
Marc Mutz
3dff1a3f7b Revert "Optimize QSet::unite"
This reverts commit 92acc94fa98d19929d28feb5d543acf8c50c2290.

The change broke QSet ordering guarantees: The documentation clearly
states that each item from `other` that isn't already in `*this` is
inserted ("STL insertion behavior"). Swapping *this and other breaks
this.

Independent of STL vs. Qt insertion behavior, making the picking of
elements from containers "random" in the sense that the size of the
container is now important, and not merely LHS vs. RHS, is a bad idea.

[ChangeLog][QtCore][QSet] Fixed a regression in unite() that caused
equivalent elements of `*this` to be overwritten by elements of
`other` if `other.size()` was larger than `this->size()`.

Pick-to: 6.8
Fixes: QTBUG-132500
Change-Id: Ia636b62325139d618b5467a643ff710716324296
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 2d1b3028673493cb144060cbec49b1b95f4188d2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 12:08:40 +00:00
Marc Mutz
12f39bb2ab QSet: check that unite() and intersect() prefer elements from *this
In Qt versions 5.0..6.7, at least, this used to be the implemented
behavior for unite(). For intersect(), it was implemented up to and
excl. 5.2. Even the documentation states as much:

intersect(): Removes all items from _this set_ that are not
             contained in the other set.

unite(): Each item in the other set that isn't already in this set
         is inserted into this set.

Add checks that the functions behave as documented (hint: they no
longer do, since 6.8 (unite()) and 5.2 (intersect()), resp.), this
being the only correct way to implement these functions (items in
sets may be equivalent, but not identical; it is important that the
set operations work in a manner consistent with insert(), to meet
user's expectation of how these functions work (unite() just
inserts() the rhs, intersect() removes if !rhs.contains). Note that
QSet, unlike other Qt associative containers, actually has STL-style
insertion behavior (insert() doesn't overwrite).

subtract() is the only one that's still true to its docs. A test for
this function will be added in a follow-up commit - eventually.

In anticipation of adding rvalue-other overloads of at least
unite(), add a test with that, too.

Pick-to: 6.8 6.5 6.2 5.15
Task-number: QTBUG-132500
Task-number: QTBUG-132536
Change-Id: Id309ab5192e6d1c9bbeef496cbd7116d306eaae8
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 0d4fd5c545b47966c56ed0b9eb9b5c0a8f75c02a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 12:08:40 +00:00
Kai Uwe Broulik
0048e8de0e doc: Fix typo in Qt Style Sheets Reference
It's QAbs*t*ractScrollArea.

Pick-to: 6.8 6.5
Change-Id: I94a8d35c40445883a232a8671e56780afffb2e01
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 46809abbb7cd525e287360455a7fa074eeb800d9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 12:08:40 +00:00
Ivan Solovev
bec66636c8 QProcess/Unix: add an actual check of DisableCoreDumps flag
The original patch that added this feature was disabling the core dumps
unconditionally. I guess the check was simply forgotten.

Amends 9df6e8ad3b3a7a57af87e6a3fef2ef793610cb3d.

Found in Qt 6.9 API review.

Change-Id: If3f9cb35d11a0262241a465626a25f6d7d2bbdb4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9860f6522919d154dd4f95ff6f6ae58d3e4c435e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 08:32:42 +00:00
Allan Sandfeld Jensen
11599cb379 Make -platform linux-clang-libc++ work with icecc
It usage of libc++ was never detected if the compiler was explicitly set
to a specific clang binary and clang wrapper.

Change-Id: I5fd3c84223cafedf06b34afe91d975e71c199e24
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 982fe396e5908a6f1089ba577ed6220d90eaaa95)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:21 +00:00
Mårten Nordheim
2ce7e21766 Unicode tool: handle required QFile::open return
Fixing warnings/errors about QFile::open() return value not being
checked, and print the name of the file and the error message that
occurred.

Task-number: QTBUG-132902
Change-Id: I099b300b5fd4563334fa547ffa365ec3f68e08cf
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit e99d5c6268862e5773056a008c273e18bf5b4ef7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:21 +00:00
Mårten Nordheim
00ddc174b4 QUrl: sort idn whitelist
We look it up with a binary search, so it needs to be sorted.

Pick-to: 6.8 6.5
Change-Id: I0aa25e6ff9722372c0a09f2dce9f9c839fedf00e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 382a7d006b52faa08b84e56d97cc6c216925a43e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:21 +00:00
Mårten Nordheim
67500054d2 Unicode tool: print values using portable types
ssize_t is not universal; fails to compile in Windows.

Task-number: QTBUG-132902
Change-Id: I4b8f45cba32202329ac085c7caa0a8c19a11c621
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f7d0366207709ec0dc33f5d10d21b8f3c9d6534f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:21 +00:00
Mårten Nordheim
09b06a740d Unicode tool: use unsigned values for the bitfields
On MSVC the values stored end up as negative.

Task-number: QTBUG-132902
Pick-to: 6.8 6.5
Change-Id: I963c57c34479041911c1364a1100d04998bdfaed
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 62685375a2d71fa34015faac76f03e709e4217c7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:21 +00:00
Christian Ehrlicher
2a3c016894 Windows11Style: don't create a QPen when not needed
Use QPainter::setPen(QColor) and QPainter::setBrush(QColor) overload
instead creating a temporary QPen/QBrush to gain advantaged of the newly
introduced QPen and QBrush assignment functions from
ab53500cfa11b988e7e4234583fa6eb5027b4c08

Change-Id: I3b8c4f7d669a08558cf6abcc77c23a4fdda99c02
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 82a5e8bdb788179d1323e76b725d57efaab0b217)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:21 +00:00
Assam Boudjelthia
d31a94a70a Android: fix Q_JNI_NATIVE_METHOD() with namespace builds
Prepend the Qt namespace to the JNI method under Q_JNI_NATIVE_METHOD.

Pick-to: 6.8
Fixes: QTBUG-132490
Change-Id: I73bb8119a0d760e8f7ce82e70ced2684bec76eb0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d1694476271346d13ac8ca3138328d295bf403b4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:20 +00:00
Thiago Macieira
8c5736e68f QUrl: avoid going up from the drive path on Windows file URLs
On Windows, using a URL of "file:///c:/" as a base to be resolved with
"../" should not result in the Windows drive being removed.

[ChangeLog][QtCore][QUrl] Fixed a bug (regression from 6.7) where
resolving a base URL of an absolute file path containing a Windows drive
could result in said drive being removed (e.g., resolving "file:///c:/"
with "../" would result in "file:///").

Fixes: QTBUG-133402
Pick-to: 6.8
Change-Id: I58286b9c5e5d02363f0efffdb06f983b560340df
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 340c9d88ab353e201f117d64609fa5f7d2fa2b21)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:20 +00:00
Thiago Macieira
86597d2891 QUrl: set the host to empty but present for "file" URLs
We set it when manipulating full URLs. If you're creating them from
parts, you may end up with one without a host. We will still fix that up
in QUrl::toString() ("manipulates full URL").

This allows the path normalization code to avoid accidentally creating a
URL with no host/authority and with a path that starts with double
slash.

[ChangeLog][QtCore][QUrl] Fixed a bug (regression from 6.7) where
QUrl::resolved() could create invalid URLs when the relative URI being
resolved contained a path with double slashes (e.g., combining
"scheme:a" with "..//b.txt")

Pick-to: 6.8
Fixes: QTBUG-133403
Change-Id: I3fe9d5fbd2efcaa66d66fffdc010e5a84066b641
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 7d05f5ed7d3472028e28a09eeda175bb1b1eeb00)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:20 +00:00
Thiago Macieira
d37960b35a QTypeInfo: work around MSVC 2022 bug "isRelocatable: undeclared identifier"
Definitely a compiler bug because it passes for everything we threw at
the compiler in the CI but fails for a user. At least the workaround is
simple.

Fixes: QTBUG-133032
Pick-to: 6.8
Change-Id: Ie84590c466cf1d6f01bbfffd3ca1d6c262d77200
Reviewed-by: Irfan Omair <irfan.omair@gmail.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 0a5b37b706ee72c7d9042efcde244aa93a5ce9a5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:20 +00:00
Vladimir Belyavsky
d35a1eb1ac CoreText: prevent colored glyphs (like emoji) to be clipped
To prevent colored glyphs (like emoji) from being cut off at the edges,
we can simply apply the solution from bbba71748438dc05d344bb9727f10b7f55a5d229
to colored glyphs as well (i.e. to glyphs with QFontEngine::Format_ARGB format).

Fixes: QTBUG-133297
Pick-to: 6.8
Change-Id: I5578e2d12f956d0635b662b3ecf714aa63474945
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 7cc0ea0b5a1dc1d9e1a9a8cc8639958e42adba3a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:19 +00:00
Jaishree Vyas
d7ff69741b Doc: Make C++20 overview visible to the new sidebar
Added the link to the qtcore-toc.

Task-number: QTBUG-130085
Change-Id: I765e01aeda0bce694157bf15ff5a036f239168f5
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 43cb7f93a4da2d57513acb3c4cbdd56c1eaf188f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:19 +00:00
Marc Mutz
7197992341 Long live qstdlibdetection.h!
I've been meaning to add this since at least 2012 (cf. commit message
of 9180d9aa8bfb9e9f66fad13f194398a98698eb77), this is as good a time
as any.

Detection taken from qcompare.h, except for
- libstdc++: using version macro instead of date one
- Dinkumware, which is taken from the above-mentioned commit (adjusted
  for the LIBCPP->CPPLIB typo),
- STLport/SGI, which are taken from stlport's _stlport_version.h,
- RogueWave, which is taken from Apache stdcxx's rw/_config.h, a fork
  of RogueWave, contributed to Apache by RogueWave themselves.

It looks like not all STLs provide a version macro, and those that do
vary a lot in granularity, so for the time being, just define these
macros to nothing and not to some form of version.

[ChangeLog][QtCore] Added Q_STL_ macros for stdlib detection (libc++,
libstdc++, MSSTL, Dinkumware, STLport, SGI, RogueWave). If your STL is
lacking, please file a bug report. Note that these macros are not
considered public API just yet.

Picking to all active branches, since not picking is more risky (code
that assumed these macros existed in older branches could silently
change behavior if they don't).

Fixes: QTBUG-132908
Fixes: QTBUG-132909
Pick-to: 6.8 6.5 6.2 5.15
Change-Id: I8f956d131292483b7727f11f69b460b12a06b583
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b6f825a857d0d2266ea89879f26703f86ddf669a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:19 +00:00
Ivan Solovev
69fa60518c Bump the deprecation version for WindowType::MaximizeUsingFullscreenGeometryHint
The replacement is new in 6.9, so the deprecation should be done in a
later Qt release.

Amends 90fe9874d22f0c4b809a3e493766ef852c72cc39.

Found in Qt 6.9 API review.

Change-Id: If68685f98928015163cd4aa0e65fed2c6578e429
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit b0364bc2633f322630028a13fe1143e222015cd1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:19 +00:00
Allan Sandfeld Jensen
f20166d2de Fix AVX512-FP16 build
Was missing explicit conversion from float to FastType when
FastType isn't float.

Pick-to: 6.8
Fixes: QTBUG-133430
Change-Id: I227558f6ecc1018158c88514dbb23bfe095ef77f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit d076420bb0740e0410a886fc2feb5fcf8b729f4d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:18 +00:00
Thiago Macieira
d07a849e98 Fix detection of -fPIE code for QT_CONFIG(reduce_relocations)
Amends commit 19b7f854a274812d9c95fc7aaf134a12530c105f, which removed
the __PIE__ check because of the GCC version check that was alongside.
GCC and Clang define both __PIE__ and __PIC__ for -fPIE, so checking for
__PIC__'s presence isn't enough.

Drive-by amend the no-PIC #error message to also suggest
-DFEATURE_no_direct_extern_access=ON, which is more modern and produces
better code for executables too. Because of that, I've also changed the
reduce_relocations option to the CMake one, as there is no configure-
style equivalent for the modern option.

Pick-to: 6.8 6.5
Fixes: QTBUG-133101
Change-Id: I957b264eaee360fd964afffd60617964b26fe934
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 014e77801fa4b99cdb03330ccce1e212ac13a0af)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:18 +00:00
Liang Qi
b33813534e xcb: call qGuiApp->exit() on xcb connection error
Fixes: QTBUG-130741
Pick-to: 6.8 6.5
Change-Id: I67eff8e58d4a4a8d18fb49699111f72ed9100480
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit facf2c17707ac4827e624fb6e9546278aef0c38d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-04 21:47:34 +00:00
Rym Bouabid
7a2b93fc78 ibus: Make address a QByteArray instead of a view in createConnection()
When "address" is a QBAV, it points to line(QBAV) which points to
lineArray(QBA), so its data will be overwitten after every read:
      while(file.readLineInto(&lineArray))

This amends f0aa391ef89a393221d77d5ad3c1616a4727f11a .

Fixes: QTBUG-133445
Change-Id: Id23e726327529c44e205c4c0720af0dad42c175b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 07eeb45d881bb0240e472167217912b08be44371)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-04 11:51:24 +00:00
Tor Arne Vestbø
c04a7aa2c6 macOS: Emit font dialog change when dialog is not active window
The NSFontPanel emits changeFont even when not the active window, and
applications are expected to update their views accordingly.

As the changeFont action message is sent through the responder chain we
were only picking up the changes when the font panel was active, thanks
to the NSWindow delegate we were installing on the panel.

But when the active window is one of our other windows, we were failing
to process the changeFont message in our QNSView.

We now handle the message by forwarding it to the font dialog delegate,
so that we enter the same code path as before, and emit the right
signals for QFontDialog and friends.

Pick-to: 6.8
Change-Id: I97427c73fe46f129ca11afa6b2c222bf0f0fb0af
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 3d42f31243ce52e517e09843b93f40b79925652f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-04 11:51:24 +00:00
Giuseppe D'Angelo
97880102dc QSqlQuery: complete the deprecation/removal of its copies
QSqlQuery has been made movable in Qt 6.2
(14f9f00fdb2dc428610c08e3d9d03e38e9602166). The pre-existing copy
operations have been deprecated, but not removed, in order to preserve
SC/BC.

This left us with two issues:

1) Whether or not to keep the deprecated copies in Qt 7. The answer is
no: the copy operations are impossible to implement in a way consistent
with value semantics (the state of the DB driver can't be copied in
general). Therefore, mark the related APIs as to-be-removed, and not
just deprecated.

2) While we no longer copy QSqlQuery from Qt code directly, QMetaType
still detects the presence of the copy constructor and extracts it,
triggering the deprecation warning.

Rather than unconditionally suppressing the warning (which will hide any
similar issue we might have in the future), add a local workaround that
raises a runtime warning if QSqlQuery is copied through QMetaType, while
not raising the deprecation warning when building Qt itself.

[ChangeLog][QtSql][QSqlQuery] Copying a QSqlQuery object via QMetaType
now raises a runtime warning. Note that copy operations for QSqlQuery
objects have already been deprecated since Qt 6.2, and are planned to be
removed in Qt 7.

Fixes: QTBUG-132752
Task-number: QTBUG-91766
Change-Id: I48714ad53ec706a5e4e055c45a1c05f372382940
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit f744cef06cf3a56591782f487c545b55b2a673fb)
2025-02-04 08:42:49 +00:00
Marc Mutz
4e475b5cc2 XCB: replace header guards with #pragma once
Following qtbase/1c8884fc277c5916a420a3c14de68547a391f9fc's making
syncqt error out when an installable header contains #pragma once, we
can now flip the coin and use #pragma once as a static assertion that
the given header is not going to be installed, making it easier to
understand which headers are "public", which ones are "private" and
which ones are "neither, since never installed".

Do this for the XCB platform support files.

In qxcbglintegration.h, the header guard was actually broken (had only
#ifndef and #endif, was missing the actual #define).

As a drive-by, normalize vertical whitespace.

Pick-to: 6.8 6.5
Change-Id: Iede0605c38cda7606edfc7155bd8bfc95990c5bc
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 91f9ba2993a2652bcb349ce639aff67b5bfc8938)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-04 05:19:37 +00:00
Thiago Macieira
ae2502b4ad QLibraryInfo: speed up checking if ":/qt/etc/qt.conf" resource exists
Go straight for QResource, because this is run very early in Qt's
initialization, usually as a result of some debug message, via
QLoggingRegistry::initializeRules(). This bypasses the need to create
QResourceFileEnginePrivate, QResourceFileEngine, QFileInfoPrivate, and
QFileInfo, all of which would end up in this .isValid() call.

Additionally, I'm making it query in the C locale, which will also avoid
initializing the system & default QLocales. If a resource exists in any
language, the C locale query will find it.

Pick-to: 6.8
Task-number: QTBUG-133206
Change-Id: I434b498903d793c12d35fffd3e297bfdbdc1b6fe
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d59e640c868f3db2d661970f3d34a22013d49053)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-04 03:01:59 +00:00
Ahmad Samir
0ca8024da2 QDirListing: clarify the ExcludeSpecial flag API docs
Amends e583c3d5163a5512abac85e32359652e28a053f7.

Pick-to: 6.8
Change-Id: I2ed231990778d03384045bc417efc58a6019fc14
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit e5fbe88708103781ee8d60f5280ea1ad4bed21f5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-04 02:47:39 +00:00
Christian Ehrlicher
c7f914c68c Widgets/styles: don't create a QPen when not needed
Use QPainter::setPen(QColor) overload instead creating a temporary QPen
to gain advantaged of the newly introduced QPen operator=(QColor)
function from ab53500cfa11b988e7e4234583fa6eb5027b4c08

Change-Id: Ib29a932a183b629f2c5f3ce32f4e00bd7ab24a03
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 678564291d8faa7689b4a65376b2c60118fc9936)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-03 05:13:25 +00:00
Eskil Abrahamsen Blomfeldt
b6557e4be8 Fix compilation with unofficial DirectWrite headers
Reportedly, some unofficial DirectWrite ports are missing the
default values to the arguments for IDWritePaintReader's
MoveToFirstChild() and MoveToNextSibling(), so we make this
explicit to work around the problem.

Fixes: QTBUG-133336
Change-Id: Ia9a01e371e7424508db0d5ad3c75037caaf16854
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit cbce69ebd643bb4841de20f34c5b23bddbcde0c6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-01 09:53:16 +00:00
Alexandru Croitor
9ffc3b0705 CMake: Wrap path in quotes to avoid issues with spaces in paths
Otherwise running the deployment script fails on macOS with something
like

CMake Error at
 .qt/deploy_qml_app_texteditorexample_32987d3e6e.cmake:1 (include):
  include called with invalid argument:
   2/build/.qt/QtDeploySupport.cmake

due to the following generated content:
  include(build/texteditor space 2/build/.qt/QtDeploySupport.cmake)

Pick-to: 6.8
Task-number: QTBUG-126827
Change-Id: I8f9923db8dc670a6efbd6f75c48da5dfd1af687d
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 65f08c09713b6d167638c4e19ebafcac045fc1c5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-01 09:53:05 +00:00
Robert Löhning
01b90c38e7 libinput: Fix developer build without xkbcommon
Before this fix, the build failed with:
error: unused variable 'REPEAT_DELAY' [-Werror,-Wunused-const-variable]
error: unused variable 'REPEAT_RATE' [-Werror,-Wunused-const-variable]

Pick-to: 6.8
Change-Id: I44a76e2270c1f5d8af6bd018869db5e30e40ecbb
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 42ea8c31fe459ac252144f89986891b241c3e9d0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-01 09:52:51 +00:00
Cristian Le
9601b5fa5b Check for misspelled FEATURE_* variable
The feature names are normalized using `qt_feature_normalize_name`, but
a user might read `qt_feature` usage and not realize that they should
normalize the name in the `FEATURE_*` variable.

This change emits an error if it detects such invalid names.

Fixes: QTBUG-132464
Pick-to: 6.8
Change-Id: I33c7ab9f589c92e11e16d376660e8b6152339d12
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit b71647d06970b2cc3b63b93c020eca8caf0a519f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-01 09:52:36 +00:00
Ivan Solovev
7e80af2bc2 QSharedPointer: document rvalue overloads of various cast methods
The patch provides two documentation snippets: for an arbitrary arg
and for \c {*this}. That is because qdoc does not support passing
a command (e.g. \c) as a part of the snippet's parameter.

Amends e95fb04202b3f786037c10942fd4e912644fd7d2.

Found in Qt 6.9 API review.

Change-Id: I4eed234d18e39f2fc0c30a647a423f3240e31d40
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 8511149d886e5aef2a065efffc336c7b25e6540e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-01 09:52:27 +00:00
Andreas Eliasson
c965151d4d Doc: Fix typo in in scope resolution operator
Fixes: QTBUG-132911
Pick-to: 6.8 6.7 6.5
Change-Id: Iaa7c4830abd273ccfe558e089da5072a83607f26
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
(cherry picked from commit bc733ea787ad6993e945146a9d297d14cb6175ac)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-01 09:51:43 +00:00
Liang Qi
98065efdfa Fix dangling references - GCC 15
This amends 8a6750475410629741de0417c28f574c25c65338 and
18def77d27f88ce26b6af29fe56a80429fed555d.

Pick-to: 6.8
Change-Id: I31068527458da3d25211743fb64e2624039bd78b
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9379b95b533216593d4d37c0cbf70f91d1ce037a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-01 09:26:07 +00:00
Marc Mutz
0ce4cdddb4 util/update_public_suffix_list.sh: use commit date, not wall clock
This is both more accurate and also more stable: The suffix-list
update usually takes several days to go through all branches; using
the commit date avoids using newer fetch dates in older branches.

Pick-to: 6.8 6.5 6.2 5.15
Change-Id: Ifefd7158e4104c7bbdfe6a2d8a505d8acf7275b4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit cbea57f80b43a969d2e15d53b759abb9924d52c1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-01 00:09:42 +00:00
Christian Ehrlicher
7a9f724735 QMenu: Ignore disabled hotkey during hotkey search
When two actions in one menu have the same hotkey and the first action
is not enabled, the action search was selecting the first, disabled
action despite the fact that it could not be selected later on.

Pick-to: 6.8
Fixes: QTBUG-56952
Change-Id: I894ee09d9ccc7154ca506ef907924cd150ac6ed2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 13636f848da6932f9864bf9335d19b439b8387cd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-31 23:06:46 +00:00
Assam Boudjelthia
44b706457e Android:CMake: add \cmakepropertysince to packaging type properties
QT_ANDROID_SYSTEM_LIBS_PREFIX and QT_ANDROID_NO_DEPLOY_QT_LIBS were
added in Qt 6.4, but they were missing \cmakepropertysince 6.4.

Pick-to: 6.8
Change-Id: Ife0f68e79d331f4923d1015431f5af65d80dca36
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 51474d795a4c801933f9444b73d536fb1c407e72)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-31 22:03:12 +00:00
Assam Boudjelthia
6f6c291beb Android:CMake: remove \preliminarycmakeproperty for non-preliminary cases
Those Android CMake properties have been carrying the documentation tag
of \preliminarycmakeproperty by mistake.

Pick-to: 6.8
Change-Id: I739fee2f078300427557a29b25e1898d57cf04d7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 2abc4594791823f1e56d692df38ede69f83e45cf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-31 22:03:05 +00:00
Marc Mutz
7dca077bb6 QObjectData: Return const QMetaObject* from dynamicMetaObject() already now
It's semi-private API (ie. undocumented) and for most platforms¹, the
change is a no-op, which is why the approach here is a bit different
than your usual REMOVED_SINCE:

Normally, when only the return value changes, we mark the new overload
as QT6_*_NEW_OVERLOAD to allow the two function to coexist and the old
function to call the new one.

But the extra argument backing QT6_*_NEW_OVERLOAD would change the
mangling of the function even on platforms that don't mangle the
return type (the majority), and we'd have to decorate all calls that
could possibly be seen by QtCore's removed_api.cpp TU with
QT6_CALL_NEW_OVERLOAD. The main user of the API is moc-generated code,
though, and so I didn't want to have to change moc's output, even
though, currently, nothing in removed_api.cpp includes moc-generated
code. But it may, at some point in time.

This means I needed to grasp the nettle and duplicate the (granted,
trivial) implementation. Even a private helper function would mean
(maintenance and runtime) overhead for "normal"¹ platforms, so I opted
not to go there, either.

¹ those that (rightfully) don't mangle the return type, ie. all except
  ... MSVC.

As a benefit, we catch the mistake of modifying the dynamic
QMetaObject under the object's radar already now.

[ChangeLog][Potentially Source-Incompatible Changes][QtCore][QObjectData] This
(undocumented) class' dynamicMetaObject() function now returns a const
QMetaObject* (was: non-const). The backwards-compatible fix is to
receive the result in a const QMetaObject* variable (or to use auto),
and applying a manual const_cast, if a non-const object pointer was
actually required. Modifying the meta object that was returned by this
function was never supported and may lead to problems elsewhere.

Amends 0b044e8b055f9c1d93b278ed69aba76f7c886cb1.

Change-Id: I4ebc43018a2a87433ab7a97554196842b97cf1ba
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 2c212e15f8b9dc2578d93ac69a0f5826ea9de18f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-31 10:16:43 +00:00
Marc Mutz
d2c4f6df21 QDuplicateTracker: shed memory_resource on clear()
The pmr::monotonic_buffer_resource ("pmr::mbr") strategy can only
allocate buffers; deallocation is a no-op. I chose it for
QDuplicateTracker because the tool was only used one-off: build it,
then destroy it. There were no other operations.

That changed when 090c7e3262dce93df83c73a4a822761e5d9b4650 added
clear().

Calling pmr::unordered_set::clear() will deallocate the nodes (but not
the bucket array), but due to pmr::mbr, nothing is actually
deallocated, so memory that was freed by the container isn't actually
reused by it, later. IOW: repeated grow-clear-grow-clear cycles would
forever grow the monotonic_muffer_resource, using more and more memory
and thus appear to be leaking it.

This isn't exactly optimal behavior, so try to shed the pmr::mbr's
extra memory with a call to mbr::release().

Unfortunately, C++17 originally failed to nail down the semantics of
pmr::mbr::release(), prompting LWG 3120 in response to observed
implementation divergence. In particular, MSSTL, at the time of LWG
3120 filing, didn't appear to allow to allocate() after release(). In
our tests, it does allow it, it just never falls back to the original
(stack) buffer, and, looking at the implementation, it doesn't look
like it can do so anytime soon (it doesn't remember the buffer, and
everything is inline, so they would seem to need a BC break to fix it.

We tried to work-around the problem by hard-resetting 'res' by going
through a destroy-recreate cycle. pmr::mbr is neither copy- nor
move-constructible, so that blunt instrument is, unfortunately,
necessary (std::optional would be an alternative, but has overhead
that affects all platforms). This crashed, though, so just call
release() and handle MSSTL's failure to reuse the initial buffer as a
QoI issue.

For all platforms, before release(), we also need to make sure that
`set` no longer holds any references into it, and, since clear()
doesn't shed capacity, we need to use the C++11 version of the
swap-trick (swap is actually UB here, because the allocators differ):
move-assign a default-constructed set.

Amends 090c7e3262dce93df83c73a4a822761e5d9b4650.

Fixes: QTBUG-132945
Pick-to: 6.8 6.5 6.2
Change-Id: I4796806e427602255439dcb1518aa9b661c7933e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9f4325e67354ce6c4c98e7a206f17729b378dc04)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-31 10:16:43 +00:00
Marc Mutz
605a20b262 QSet: don't detach in remove()/removeIf() if nothing is being removed
QSet::remove() calls QHash::remove(), which unconditionally detaches,
so fixing the detach there, by pulling the isUnused() check to before
detach(), fixes it for both.

For removeIf(), the old code used begin()/end() for iteration,
detaching unconditionally, even if nothing was removed in the end.

In this case, fix by using cbegin()/cend(). That delays the detach()
until the first erase(), where it belongs. The end() iterator of QHash
(and therefore QSet) are stateless sentinels in all but name, so we can
continue to cache end(). Add a code comment to that effect.

Amends 62dad9be9e172597c56a970202299563aa04918e (for removeIf()) and
5b7c3e31b538376f2b4733bd868b5875b504cdb3 (for remove()).

[ChangeLog][QtCore][QSet] remove() and removeIf() no longer
unconditionally detach, but only if something is actually being
removed.

[ChangeLog][QtCore][QHash] remove() no longer unconditionally
detaches, but only if something is actually being removed.

Pick-to: 6.8 6.5
Task-number: QTBUG-106179
Fixes: QTBUG-132831
Change-Id: I807577eafa1be478b0a2da45cf8c44936d5e48ed
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 3a284dc19d1c77692f2faddedc674cc293d51a00)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-31 10:16:43 +00:00
Liang Qi
dd927a4f3c tests: Skip tst_QClipboard for Ubuntu 24.04 GNOME/X11
Sometimes test causes kernel crash. Test is skipped until
gnome-shell 46.1 or newer is backported to Ubuntu 24.04 LTS.

See also https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/2095396

Task-number: QTBUG-132070
Pick-to: 6.8
Change-Id: Ia1c7f1737e225189b86cb2b2d2ff68a7cc1e838c
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 1c0406ee17d5747f8e5b107db81949055aaa7f9e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-31 10:16:43 +00:00
Marc Mutz
aefd124efa q17::uninitialized_value_construct: use C++17/20 semantics of voidify
While LWG 3870 changed the const/static_cast'ing for C++23, this is
q17, so use the C++17/20 semantics of casting away const- and
volatile-ness.

Found in API-review.

Amends 364ac13a79a8fff0447a62e9af5588db397c0bfd.

Change-Id: Ie11589cbc96b8c3c36deaa6101a897f527d92a46
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c05982fda39bbfa9fa3641c7e5938f204a8b1bf5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-31 07:12:16 +00:00
Marc Mutz
398c576037 QPen/QBrush: de-inline compare helper functions
These functions expose implementation details of their respective
class, so, seeing as the classes are pimpl'ed and their op==s are
out-of-line, too, these functions ought to be out-of-line, too.

De-inline them, by calling a private out-of-line helper function. This
way, they can remain unexported and "real" hidden friends (= with an
inline definition).

As drive-by:

- in QBrush/QColor: check the properties in the order of cheapness
  (style(), color(), transform()), and don't copy QTransform just to
  check isIdentity() (access the member directly).

- in QPen/QColor: avoid the QBrush copy (access the member
  directly). This also retroactively endorses the noexcept on this
  function.

- in QPen/PenStyle: amend the comment that says it's allocating with a
  `// ### optimize`

Amends f0186862e16128343705abd0de5994e8ca05a909.

Found in API-review.

Change-Id: Ibfd43b1f2200ef030d6739dad1bf026cc190606b
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d769ca41fc11e1af81e4cdf7cacb3884f98b108c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-31 07:12:15 +00:00
Thiago Macieira
042e713cb7 QTest: fix bug dereferencing nullptr in toString<std::nullptr_t>()
Amends commit 0756cc1eae5fd8981983319fef1d084762a67b8d.

The generic instantiation of this function had a std::nullptr_t *
parameter, but callers had special code to pass a nullptr there because
we never needed a value of a nullptr (it's always a null pointer). For
example, in compare_ptr_helper():

        auto lhsFormatter = Internal::pointerToString<QObject>;
        auto rhsFormatter = Internal::genericToString<std::nullptr_t>;
        return compare_helper(t1 == nullptr, "Compared QObject pointers are not the same",
                              const_cast<const QObject *>(t1), nullptr,
                              lhsFormatter, rhsFormatter, actual, expected, file, line);

But in debug mode, some compilers did emit a load from this memory
location, causing a crash. So we just specialize this function to avoid
such.

We had a test for this... except it was never reached because the
earlier QCOMPARE() had already failed. For the test, this amends
commit ae021882330abc5f6fbaadca290e6e5670c89028.

Fixes: QTBUG-133330
Pick-to: 6.8
Change-Id: I2cd3bb475788431c6a0dfffd28e730e8b613e033
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit e19b633c468123526660b40ae110f46090682c76)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-30 23:57:18 +00:00
Assam Boudjelthia
f3c839ecc4 Android: add note about using qt_add_android_permission()
Change-Id: Ie8d48ce1460b6f7fe4023f204be8fd2511cabe4d
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 91d86e4f7a58cc2f3071234e42848928a4aea45c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-30 23:14:53 +00:00
Assam Boudjelthia
e48aac4ec6 Android: add note on using custom AndroidManifest.xml for permissions
Setting permissions manually require the user to point to the manually
managed AndroidManifest.xml file.

Pick-to: 6.8
Change-Id: Iae289ad32a12f869a5a0ec0261bc3e771d94a15d
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 40e18c7c7e3afd8dacf22879ec1bc442ecbd9877)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-30 23:14:46 +00:00
Alexandru Croitor
3f2698ce36 coin: Enable git cloning
Cloning the git sources will:
- allow embedding the git sha1 into the SBOM generated by the build
system
- ease development process in CI VMs when investigating issues.

This will slightly slow down the CI build phase by a minute or two.

Pick-to: 6.8
Task-number: QTBUG-122899
Task-number: QTQAINFRA-6520
Change-Id: If554ed0fedca26ff77d04752288ee8497bc4b9ce
Reviewed-by: Toni Saario <toni.saario@qt.io>
(cherry picked from commit 5717a4fd4a3fd2ba530a7eb4812ce2a5c34515cb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-30 21:32:52 +00:00
Edward Welbourne
8c93587612 Rework QLocale::uiLanguages()'s order
On back-porting commit 7f9ee43de783105d8de0a0b614751eec639131f8 to
6.8, I worked out how to move the maximal version of each locale ID to
the front, while keeping it after a shorter ID that can't be derived
from it. Forward-port a refactored (and more systematic) version of
those changes now to dev (and thus 6.9) so that we get reasonable
compatibility between versions (albeit with 6.8 still lacking
truncated forms, since its QTranslator takes care of those).

This, however, brought to light a problem in the subsequent addition
and insertion of truncations. Since non-equivalent truncations of the
maximal version may (and often do) use the same script, they match
equivalents that are now later than the maximal one, which caused all
truncations to be appended, where some should be inserted just after
the equivalents. Furthermore, had the truncations of the maximal one
been inserted, they'd have appeared just after it, before some of its
equivalents, where it should be after. Reworked the handling of
truncations to take account of the fact that entries come in blocks of
equivalent forms; any truncations inserted instead of appended should
be inserted after this block, not between its members.

Adapt tests to match. As a "drive-by", shuffle some Punjabi tests so
that the comment that applies to two of them is followed by those two.

Task-number: QTBUG-131894
Change-Id: I67ea21cf279e8a3b2e8413c27ac0fa5dfabdaca7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b6122866962880251fa8a82856d1fb9db43900d6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-30 21:23:48 +00:00
Marc Mutz
6067b27071 QPainterStateGuard: also check for nullptr painter in save(), restore()
The ctor refuses to be called with a nullptr painter, but a moved-from
QPainterStateGuard object _will_ have a nullptr painter. An assert
gives a slightly nicer error message than "nullptr deref".

Extract Method verifyPainter() to not litter the executable with
string literals for every one of the these functions (some compilers
don't use the leeway extended to them by the standard to fold duplicate
string literals).

Found in API-review.

Amends ec3a5f4994a2bafc65fa8e01fb0861219580f622.

Change-Id: I562e6a0ff5a4c8ce86418b998ed78c501441b61a
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
(cherry picked from commit 5c20f9aa5c31d30a2dccfc617e93c6d6ac0fc96c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-30 21:23:47 +00:00
Marc Mutz
a546662cd8 QtGuiTest: remove Q_NAMESPACE
There are no Q_ENUM/Q_FLAG/Q_INVOKABLEs defined in it, so drop
Q_NAMESPACE. We can always add it back in when something is added to
it that does require a meta object.

Found in API-review.

Amends 5ac4f04325a56d47812f528fe31ceb0d4932f664.

Change-Id: I8b197f2cd835d1fe4893f2e9608dcaf0ffd14cd9
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 530b2e1fc7d289c12507696137996a02bdbeb439)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-30 21:18:57 +00:00
Marc Mutz
9120bb9e03 tst_QSet: check whether QSet::removeIf() can modify elements
It can't, pfew. Was wondering for a moment, but of course, even the
QSet::iterator is really a const_iterator.

Pick-to: 6.8 6.5 6.2
Change-Id: I85caa64c1caca6d77569aa2ceb868a4aa0e5578d
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Magdalena Stojek <magdalena.stojek@qt.io>
Reviewed-by: Lena Biliaieva <lena.biliaieva@qt.io>
(cherry picked from commit a4fd95c51a4347482d6d0a815657d0b5bdaf06db)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-30 21:18:54 +00:00
Marc Mutz
ad014ed702 qpen_p.h: include what you need
In QtCreator, the file lit up like a Christmas tree from all the
undefined types :)

Amends the start of the public history.

Pick-to: 6.8 6.5 6.2 5.15
Change-Id: I558ad493a4848e6a28bd37a38f2432c5605e0f43
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 768ab2051765f3825903c449a2f0e2c07e665152)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-30 21:18:51 +00:00
Alexandru Croitor
004c87ced5 configure.bat: Use call when calling the helper cmake scripts
If an executable has a .bat or .cmd extension, and is executed without
a prepended 'call' command within a batch script, the parent batch
script execution will not continue once the child process has
finished.

Prepending call to the command ensures that the parent batch script
continues execution.

This changes ensures that configuration succeeds for the use case when
cmake is actually a batch script called cmake.bat or cmake.cmd.

We already use 'call' in qt-configure-module, so do it also in
configure.

Pick-to: 6.8
Change-Id: Ia42cb71787e88c850f1cbd1fcef5b6decbdeaabf
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 062a7dc4248904bed51dc87466ec29b407945950)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-30 21:18:49 +00:00
David Redondo
fb6b0e5c94 QDesktopUnixServices: Fix #endif comment
So it doesn't confuse me or anyone else again

Change-Id: I8ad5d4cb1b00e0edaffa90ed67e30246211e1a97
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 7fcfc3790512b6d467732119330ea886de2a72fb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-30 19:47:38 +00:00
Marc Mutz
6143ae4012 Don't export ~QESDP<QFontVariableAxisPrivate>
It's not needed, cf. QTBUG-128656 and
qtgraphs/6ae7164a5432bc49d7e9688dfd79c20515dd9333.

Found in API-review.

Amends cc128d802c6d9c87a1e00a8a88d5e6590a7195f4.

Change-Id: I3860ea5ac3d17590b1134af40927387f19dea640
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ac5ab8ce32c6bd4122ecc690d30eade5c4f4bf2a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-30 01:00:37 +00:00
Giuseppe D'Angelo
e4502f3dc1 QProgressBar: prevent integer overflow
If `value` is INT_MAX and `lastPaintedValue` is -1 (the default), the
subtraction will overflow. Extend the arguments to 64 bits. The result
is only used for a double comparison anyhow.

Change-Id: Id4a5396c61da81932ac626b3102e583a74264df4
Pick-to: 6.8
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 8e843ddba8de6b9dbe9851856fd4524af5d3c584)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-30 01:00:36 +00:00
Christian Ehrlicher
b5ff268a3b QMenu: Simplify check for SH_Menu_AllowActiveAndDisabled
The check for SH_Menu_AllowActiveAndDisabled is done in eight places.
Simplify it by added a helper function which checks if an action should
be considered (i.e. is not a separator, is enabled or
SH_Menu_AllowActiveAndDisabled is enabled).

Pick-to: 6.8
Task-number: QTBUG-56952
Change-Id: I65c6dc67b804dd4c5cf463767a525ec6f785bf1a
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit e0a44cd32ed3884fd665c112a9dfc2bc45a6597d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-30 01:00:36 +00:00
Giuseppe D'Angelo
df0d74dca4 QDateTime: prevent signed integer overflow
While the code checks for the possibility that leftMillis-rightMillis
may overflow, it fails to take into account that the result may be
minimal ("INT64_MIN", so to speak) and passes it to qAbs, triggering UB
in there. Since it's just a range check and we don't need the result to
be signed, use qUnsignedAbs.

Change-Id: I7f1a4bbc521fdc164ca20fedf0e995359a67ea4d
Pick-to: 6.8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 45e90b73c75b2c7997a0f8d750f9927f64e05a0e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-30 01:00:36 +00:00
Marc Mutz
6ba8e9875a QDuplicateTracker: don't value-initialize the stack buffer
The typical usage of a QDuplicateTracker should be to pass the
guesstimate for the number of entries as a constructor argument, or,
failing that, default-construct the object. In those cases, everything
is peachy:

   QDuplicateTracker<int> seen(n);
   QDuplicateTracker<int> seen;

But for users that subscribe to a AAA view and use

   auto seen = QDuplicateTracker<int>{};

or that emplace() a QDuplicateTracker in e.g. std::optional, we need
to make sure that value-initializing QDuplicateTracker doesn't
value-initialize the internal buffer (which can be several KiB in
size).

So don't = default the default ctor, but implement it as empty.

Amends f21a6d409ea0504c64cd72861fc16b6f3e080086.

Pick-to: 6.8 6.5 6.2 5.15
Change-Id: I930f40d2bb85b74d2216378d8b8ca854a53a49e4
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 15154fa4c5d216b1c943a3b37be24f5fb2e4fa73)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-29 18:51:22 +00:00
Edward Welbourne
9df9412335 Update testlib's copy of Linux's perf_event_p.h header
This isn't strictly necessary, as it doesn't affect anything we use
the header for, but it brings us back in sync so future updates don't
involve as many changes to review. Document why we amend the upstream
SPDX identifier (to a non-deprecated equivalent).

[ChangeLog][Third-Party Code][QtTest] The perf_event_p.h from Linux is
updated to match Linux kernel 6.13.

Pick-to: 6.8
Task-number: QTBUG-132871
Change-Id: I101734b743f6689ca64054008455b98e4f6b827c
Reviewed-by: Lucie Gerard <lucie.gerard@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 019d2e5974326cac1803bb860f280c1b8fd104c3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-29 18:51:22 +00:00
Edward Welbourne
8146816342 Skip zone naming with no CLDR data
In the git version of CLDR v46.1, Acre's metazone inherits a generic
long name. However, root provides no metazone data for it to inherit.
So we ended up with an empty entry for Acre in the QlocaleXML file.
Harmless, but easy to avoid, so avoid it.

Pick-to: 6.8
Task-number: QTBUG-132851
Change-Id: I392d0922bebff731632e729a4931caa02dc3a404
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit b60be8c14d9f39358d00ef06a8ea5562fba17d98)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-29 18:51:22 +00:00
Joni Poikelin
54ed658919 android: Fix file dialog name filter matching for extensions with numbers
Pick-to: 6.8 6.5
Task-number: QTBUG-114957
Change-Id: I8e9ff3b9c7ad3fe8442caa49f6ad0bb6449bb9e9
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit e445067507d8002b51d85e7c51a600525fead8b3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-29 18:51:21 +00:00
Tinja Paavoseppä
e0529535ca Android: Update Activity reference to C++ when set
There already exists a method to do this, but seems at some point
calling it has been dropped. Add a call to update the native
reference whenever the reference in Java gets updated.

Task-number: QTBUG-130614
Change-Id: If9654b504c88340feff2432973f8f9f2eaffa272
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit acd331cd15785dda444b1a34f343a42c6b3c89fe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-29 18:51:21 +00:00
Morten Sørvig
55148eb94d wasm: don't give native focus to non-focus windows
isActive() may return true if a (transient) parent window
is active (has focus).

Compare against QGuiApplication::focusWindow() instead.

Fixes: QTBUG-129233
Pick-to: 6.8
Change-Id: I834a5814a5db161bdea2ba3524d1010e0c0e3e6e
Reviewed-by: Even Oscar Andersen <even.oscar.andersen@qt.io>
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@qt.io>
(cherry picked from commit 31762e2e704673057a292ac59977b501919f2450)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-29 14:04:33 +00:00
Giuseppe D'Angelo
b50f026c55 QTextStream: fix UB calls to qAbs() with minimal arguments
QTextStream's operator<<(number) uses qAbs to extract the "absolute
value" of number, and passes that and the number's sign to an internal
formatting function. However qAbs is unsuitable for the task, because it
will fail if `number` is minimal, as it returns the same type of
its input.

Since we can afford to change the type of the result, call the private
qUnsignedAbs() function instead.

Change-Id: Ib813a199503f2d07c78bb76862ab2e15d68d0ec2
Pick-to: 6.8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8f762b546fe6b2254029c4804a32d9ae6bbf4495)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-29 12:59:21 +00:00
Joni Poikelin
0479ef1c1c Fix crash cases where window container tries to touch destroyed window
Fixes: QTBUG-133289
Pick-to: 6.8 6.5
Change-Id: I4b5a6ab12c32133d633e1bf11567119d52c1cb5a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 9940f3f280473856858afafc6a4a4feab48c653f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-29 11:30:03 +00:00
Jøger Hansegård
9f1893855b QTest: Reset repeat counter for each call to QTest::qRun()
This fix ensures that each call to QTest::qRun() runs all tests the
requested number of repetitions.

This fixes an issue where QTEST_QUICKCONTROLS_MAIN would only test the
first style, and skip remaining styles. The cause was that the repeat
counter was not reset between QTest::qRun() calls. Subsequent calls to
QTest::qRun() would therefore not run any tests.

Amends: 80a14c86b2739492d7f7fbdb1cbde1da85d1341d

Fixes: QTBUG-133207
Pick-to: 6.8 6.7
Change-Id: Idb164fd01ac0b8e04e5dd74c3625f2c343f742c5
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 07318c81a700b4d4a46c81ae2e4f17c6b1e501c0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-29 11:30:03 +00:00
Christian Ehrlicher
1a6b177ec7 SQL/PSQL: use a QByteArray for preparedStmtId
... instead a QString as it gets converted to an utf-8 string anyway to
avoid this conversion.

Task-number: QTBUG-132303
Change-Id: I3fcf721f9fd0d1dd181af262663fddd532262ee3
Reviewed-by: Thierry Bastian <thierryb@filewave.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 892a020cc3ad7e3d5cdcb38d26091343e78695da)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-29 08:17:04 +00:00
Thiago Macieira
d5c5f9f352 QSystemLocale: bail out if accessed post-destruction
There's little we can do, but a lot of content ends up in QLocale very
late in the execution. Let's at least not crash.

Task-number: QTBUG-133206
Pick-to: 6.8
Change-Id: I77d41141cb115147f9befffdd5e69dac19c96044
Reviewed-by: Albert Astals Cid <aacid@kde.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit e32f28034ad2383393645777bcd96eab3f696076)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-29 08:17:02 +00:00
Giuseppe D'Angelo
ad867197cf QNumeric: add a private qUnsignedAbs
Checking qAbs preconditions reveals that several places into Qt are
calling it with minimal values, causing UB. Those places do not actually
need that the absolute value is of the same type as the parameter.
Therefore, introduce qUnsignedAbs, which is like qAbs() but whose return
type is always unsigned, and therefore can accept everything.

This function is private; I don't want to encourage users to rely on our
extension.

Aggressively cherry picking because this will be needed in subsequent
bugfixes.

Change-Id: I2047768a5fd35f12bf898ca8c2008813434edd8d
Pick-to: 6.8 6.5 6.2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 83c812e1322a2b004bc604be3e6f61fb83246eb0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-29 05:36:59 +00:00
Marc Mutz
176f9f6ce2 Give LegacyUncomparable::Unordered's value a symbolic name
We'll need it higher up in the file, but we don't want to/can't move
code around, so make -127 a symbolic constant.

Amends 39c7bf4631b401c681c24bb5a732a0359c8a6d7c, which, however,
merely moved the code around.

Pick-to: 6.8
Change-Id: Id6f2d51e5678b3bad7ae658cc3e38fd3909861d7
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 57aabff91eed41fb7ba0cf67df4fe7767c6e0e43)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-29 05:21:26 +00:00
Marc Mutz
36f091f65d QBasicMutex::destroyInternal(): avoid clazy warning about returning void
Says Clazy:

   removed_api.cpp:1291:5: Returning a void expression [clazy-returning-void-expression]

Just drop the return keyword.

Amends bc080a909b8bb67c1fb23afca69682ba86cdf526.

Change-Id: Iccbc343f2dd72a7c75da5e703e8e0722a0c50f31
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 875aaa39a28dfe9c26f1416f3e16758540b17a27)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-29 02:00:35 +00:00
Michael Weghorn
bd1cb1547f a11y atspi: Report app parent
While the application's a11y object doesn't have a parent
within Qt's a11y hierarchy, the AT-SPI registry/desktop is the
parent of all application objects.

Therefore, report that one instead of using a null path.

With that in place, querying the application parent
via Accerciser's IPython console now gives the expected
result:

    In [16]: acc.role
    Out[16]: <enum ATSPI_ROLE_APPLICATION of type Atspi.Role>
    In [17]: acc.parent
    Out[17]: <Atspi.Accessible object at 0x7fbebc3fc1c0 (AtspiAccessible at 0x139d6410)>
    In [18]: acc.parent.role
    Out[18]: <enum ATSPI_ROLE_DESKTOP_FRAME of type Atspi.Role>

While at it, also add a "m_" prefix for the
AtspiAdaptor::accessibilityRegistry member.

Fixes: QTBUG-132935
Change-Id: I0e174f73c837b233fe4d5788d1c375b404000025
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit befce757faa0b0abd2c1f4ec408c1a0932794b0c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-28 22:47:27 +00:00
Friedemann Kleint
4924480944 Notepad example: Use theme icons
Pick-to: 6.8
Change-Id: Id915ecbf218d419b972ff97637673827facf84a2
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit ead6f79dc015aa8e7c152fac315d0426967c0c7e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-28 19:35:30 +00:00
Tim Blechmann
e00b3bfc86 Platform: unix - avoid modifying the environment
Modifying the process environment can cause crashes in application code
that accesses the environment via non-qt functions on worker threads.
When launching a process, we can avoid modifying the environment of the
caller by using QProcess with setEnvironment. The codepaths without
QProcess support is still prone to these issues and could potentially be
improved via execve

Task-number: QTBUG-129222
Pick-to: 6.8
Change-Id: I4e2d93abaa0e392b341041faaae0ffd11e225bcb
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 673400679dca23840174c9882cea5b796b52b2f7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-28 17:40:44 +00:00
Giuseppe D'Angelo
8ef6d4ede8 tst_QGestureRecognizer: do not leak the point device
QTest::createTouchDevice() passes ownership of the device to the caller,
so make sure to delete it.

Change-Id: I100d3de9eab8ec9f88ed3e0850ada9d988bd962e
Pick-to: 6.8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 28d0e658e297b5de52fb0cccaede08179c7f4b8c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-28 16:25:58 +00:00
Giuseppe D'Angelo
8232c837b0 QDebug: do not trigger integer overflow when printing a QRect
QRect::width() and height() may overflow: they're only safe to call
when right-left+1 (or bottom-top+1) is representable by an `int`.
Therefore, avoiding calling them from QDebug, which is supposed to
"always work" (otherwise, it's not of great debugging help...).

QRectF does not have this issue as it stores the width directly.

Change-Id: I438dbacae42c17730afb92f05d16e3eebb161255
Pick-to: 6.8 6.5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 0f336500a0add3e3a8bb31c5cc605e5e13e23833)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-28 16:12:57 +00:00
Volker Hilsheimer
abf6c88a86 JNI: Extract size check from fromContainer
Addresses header review comment.

Change-Id: I302ae22da197fa8c317f0a4749d15b07fb5d0078
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit b5538a5a0ebf9bd9a155b857c385c764c30eabae)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-28 16:12:56 +00:00
Thierry Bastian
779e5faf1d SQL/PSQL: slight improvement in code
added a details about code paths that cannot happen and added constexpr

Fixes: QTBUG-132303
Change-Id: I98340c5a1f275c00aafb3294cf8e5e8368126b76
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit e574cda7fc3f6be5a81489d8d9cdb859625d4e88)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-28 15:26:30 +00:00
Aurélien Brooke
d7736416e8 rhi: be more verbose in QRhiTexture::Format enum documentation
Add missing [since], explicit total size and fix spelling.

https://doc.qt.io/qt-6/10-qdoc-commands-tablesandlists.html#value

Change-Id: I6934944ef4be119ae2934b986c7840d4d1eeea67
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 61dbdbeb3141c392657a75476c1cf1474020583a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-28 11:37:31 +00:00
Kai Köhne
66ed40dfe4 Doc: Fix link to RFC 8259
Fixes qdoc warning
    corelib/doc/src/json.qdoc:22: (qdoc) warning: Can't link to 'RFC 8259'

Amends 65fda988e92e

Change-Id: I62c1cf05366cd13180d21d7b4cbf68c0c0f48e1d
Reviewed-by: Johannes Grunenberg <nerixdev@outlook.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit a4d3a82244ab292c7a906fc19052e8b9d00b0f7b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-28 11:37:31 +00:00
Piotr Wierciński
65a8c2e421 wasm: Update Emscripten to 3.1.70
Change-Id: Id502e6ffa6ee7ef3b000d8e43f112dfb882fe354
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 66b63668212aab585a84929765484393621651ea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-28 11:37:31 +00:00
Thierry Bastian
79f96014d1 SQL/PSQL: Avoid copies of data in QByteArray when binding such a value
Fixes: QTBUG-132303
Change-Id: I84e822078d684850c5c0384338cfa4c01fe5007f
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit f346a6065d36cda4ceacce03962ba58a7cf91019)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-28 11:37:31 +00:00
Laszlo Agocs
33d74f3f58 rhi: gl: Honor deafultFbo from the QOpenGLContext better
The legacy infrastructure does not map very well to the modern one:
it turns out that, somewhat counterintuitively, targeting a
QRhiSwapChain for a QWindow may still mean rendering into a texture,
when using OpenGL on certain platforms.

For example, the Wayland platform plugin implements client-side
decorations by binding an FBO upon making a context current on a
surface for a (decorated) window, and it also makes
defaultFramebufferObject() on the context return the FBO id.

The expectation is that this is why errors such as
GL_INVALID_OPERATION are encountered in glDrawBuffers on Linux.

The QRhi GL backend's assumption that the QRhiRenderTarget being
a QRhiResource::SwapChainRenderTarget implies that the target
really is the color buffer(s) of a window surface is not in practice
sufficient on these platforms.

The bound FBO was already correct always (whatever defaultFbo reports),
but the code path hit was the wrong one. And there is different code
for MRT support (textures only) and stereo rendering (window surface
only).

Make sure defaultFbo() is queried before taking the decision which path
to hit.

Pick-to: 6.8
Fixes: QTBUG-122819
Fixes: QTBUG-132780
Change-Id: Iaaab57b031f430178ee4611a4f7a02c854010441
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 3869106cc5914fb4a8eda30ae1bd5f68dcee2fda)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-28 07:30:17 +00:00
Laszlo Agocs
b96994c9eb rhi: vulkan: Simplify frame sync
imageFence seems to have no purpose. And some of the
comments seem to be out of date / misleading.

More importantly, do the command buffer completion wait
before the acquireNextImage. Otherwise frame.imageSem
may have wait operations pending if the queueSubmit
did not get to wait on it yet. The expectation is that
this potential issue is what triggers the recent
validation layer releases' enhanced synchronization
checkers.

Pick-to: 6.8
Fixes: QTBUG-132808
Change-Id: Ib8e3884ccea343f5a839aa2ee17cd358fafeac69
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 24d62ffd720b5bec5d07b07b8d2c9dda7635f3c0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-28 07:30:08 +00:00
Thiago Macieira
c4eacb70fd QFileSystemEngine/Darwin: remove use of clonefile() on Apple systems
Because we called this before opening the target file, we did not check
that the destination file engine is the QFSFileEngine, and therefore we
may have passed a path that referred to a Qt resource path. We still do
that on Windows, but Qt resource paths start with a ':' character and
that is not allowed on Windows, so the Win32 CopyFile() function fails.

Moreover, this function *can* clone directory trees, which we don't want
to happen because it doesn't happen on other OSes. Instead, fall back to
the fcopyfile() call in cloneFile(). It will still do cloning where
permitted.

This was added in commit db0064b767474a89bc72ea4374f477682983c5f4,
before the fcopyfile() in 974b3adf8a099ca95fc2eabfc434038ce73f62c8,
though both were for Qt 5.10.

[ChangeLog][QtCore][QFile] Fixed a bug on Apple systems that would cause
copy() to copy a directory if the QFile pointed to a directory and the
destination was in the same volume. Now copy()'s behavior is the same as
in other OSes: directories are never copied.

[ChangeLog][QtCore][QFile] Fixed a bug on Apple systems that allowed
copy() to create a file with the name that referred to a Qt resource
path, if one tried to copy to that path. Qt resource paths can't be
modified using QFile.

Change-Id: I996368f4c656ff10ff5efffd5b47c6ddde34fd10
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 45886e6a81016c5c9212fffb5c0a83fd2431223e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-28 05:29:13 +00:00
Eskil Abrahamsen Blomfeldt
8d791bfb30 Port Freetype engine to COLR paint graph renderer
Use the cross-platform renderer code in Freetype as well as
DirectWrite to share as much code as possible.

Change-Id: I643dced6b913138890b39eafc3984cca5ced0aae
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit d58ad990e227fecf5526df1a89736afc0c9268fa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-28 01:34:33 +00:00
Eskil Abrahamsen Blomfeldt
0c4b517e6e DirectWrite: Implement support for COLRv1
This traverses the paint node graph and renders
the emoji through a generic renderer. This renderer
is largely based on the renderer in the FreeType
backend and will be used there as well in a follow-up
patch.

Fixes: QTBUG-113458
Change-Id: I44d17b0be8d85e38589edeb68793bf4ee4491eca
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 9f22a51987614ce51b3c12ced420bc4ca5b1ec61)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-28 01:34:26 +00:00
Joerg Bornemann
e50ae83c8c CMake: Fix examples built as external projects
Usage of a private module needs a respective find_package call now.

Task-number: QTBUG-87776
Change-Id: I3a00a241c5e8637d28606c1f45a843b491c0a8bc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 483768fb8ed18fe5911d96f990ddbc69858146bb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-27 22:38:51 +00:00
Doris Verria
83226ed3d0 QWindowContainer: Improve docs to mention new change in behavior
Specify that since 6.8 tab focus can transfer in and out of the
embedded window if using a Qt Quick based window.

Pick-to: 6.8
Change-Id: I21d04457ee79497431f889e261f1cb6bd9fd39ee
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 059210b17e50fd7c45af4ca0631ddcf8dd7c67f8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-27 22:38:50 +00:00
Thiago Macieira
bcc0e6124a QLocale: try to survive being created during application shut down
QLocale is very often accessed during global static destructors, so
let's try and survive if the default has already been destroyed. In that
case, we shall fall back to the C locale.

I've placed the call to systemData(), which updates the system locale,
before the initialization of defaultLocalePrivate, as the initialization
of the latter depends on the former.

Task-number: QTBUG-133206
Pick-to: 6.8
Change-Id: I48e29b45f9be4514336cfffdf5affa5631a956a3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Albert Astals Cid <aacid@kde.org>
(cherry picked from commit e0a1f491567f2495443babc5aa36a038260f96c6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-27 22:38:50 +00:00
Eskil Abrahamsen Blomfeldt
4bff9e3582 DirectWrite: Support embedded PNGs in color fonts
This does some refactoring on the color font support in
the DirectWrite backend and introduces support for loading
embedded PNGs from the font.

This gives us support for CBDT and SBIX fonts, which are both
based on embedding image files.

[ChangeLog][Windows] Added support for color font formats with
embedded pixmaps in DirectWrite backend.

Task-number: QTBUG-113458
Change-Id: I695901b62600c37619c80aa915f60de13a4fca3f
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 1b85143d217042876209794bf8d0361b7ce8834f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-27 22:38:50 +00:00
Morteza Jamshidi
34167f6622 Change window activation order if active window is moved
Active window should always be in front of the stack so bring it to the
front of the stack if it's not.

Pick-to: 6.8
Fixes: QTBUG-112758
Change-Id: Iff123d1e95f728f51b786106d83a429c111aa6a8
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit e6e210c2406e8d4cfe67543871af5fe14a2bda82)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-27 22:38:50 +00:00
Lucie Gérard
3e0276990d Make module ready for source SBOM checking
This includes:
- turning VERIFY_SOURCE_SBOM ON
- adding exception to the licenseRule.json files
- correcting the licensing given via REUSE.toml files
- renaming license files not located in LICENSES folder.
They need to be named LICENSE. to be ignored by reuse and
excluded from the source SBOM. The name are updated in the
corresponding qt_attribution.json

A lot of files are skipped during the license test,
but all are present in the source SBOM.
This is why  correction are needed before turning the
source SBOM check on.

[ChangeLog][Third-Party Code] Renaming the license files with prefix
LICENSE. to have them ignored by reuse tool.

Task-number: QTBUG-131434
Change-Id: Iab517215bb10a17357d2d2436bba8d3af76e5cd1
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 7cb90e15631a9e6f12469a7ca8c070781c4aafc2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-27 22:38:50 +00:00
Lucie Gérard
01e5801cec Add calling license check on generated source SBOM
The license check is only called if VERIFY_SOURCE_SBOM is set to ON
in the module_config.yaml. This way, a module can turn on the check
only when ready.

The license check is done via a perl script. Since no perl is
available for Windows on ARM64, VERIFY_SOURCE_SBOM is set to OFF
in this case.

Task-number: QTBUG-131434
Change-Id: I183b7726928bbc925940330d39779a4ac2307254
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 153002f7d2904988efdd8abc68adff0f9927943b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-27 22:38:50 +00:00
Assam Boudjelthia
e60b493c2e Android: update to Gradle 8.12 and AGP 8.8.0
Update to latest versions for Gradle:
* Gradle 8.10 -> 8.12
* Android Gradle Plugin 8.6.0 -> 8.8.0.

[ChangeLog][Third-Party Code] Updated Gradle to 8.12 and AGP to 8.8.0.

Fixes: QTBUG-132852
Task-number: QTBUG-132851
Change-Id: I9445f0cd7347a6ee153a987ea28ab617b9cb6055
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Olli Vuolteenaho <olli.vuolteenaho@qt.io>
(cherry picked from commit 0e4f9ffa55c2b77fbe79e96362bc68a968982b48)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-27 17:44:41 +00:00
Kai Köhne
87dc466e29 Doc: Update external link to freedesktop.org trash specification
Old link gives a 404

Change-Id: I3e528a29a6ed2d0d97c3fcf1cf11c441a2882415
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Jaishree Vyas <jaishree.vyas@qt.io>
(cherry picked from commit ccc99bcf8bd48e6c01e5db7fd094dc064bbd72f6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-27 17:44:40 +00:00
Giuseppe D'Angelo
cbdd2d7353 QRhiVulkan: disable -Wundef when including 3rd party headers
The header is -Wundef-unclean.

Change-Id: I30145f331ee1062961abaed14c7b79b84755abb9
Pick-to: 6.8
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 349737c6a94a4628c262776b0b8a08bf24d46363)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-27 17:44:38 +00:00
Christian Ehrlicher
0f744e6b2b SQL/PSQL: call deallocatePreparedStmt() unconditionally
deallocatePreparedStmt() knows by itself when to call the psql cleanup
routines or not. No need to have this logic outside this function.

Task-number: QTBUG-132303
Change-Id: Ib1a5ba7b53c156f6a6b93f23a3ec8c851d7398fc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Thierry Bastian <thierryb@filewave.com>
(cherry picked from commit 9094ad18b0d909f7490dec3451ec7ef9c312f42a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-27 17:44:36 +00:00
Joerg Bornemann
7782f2ad14 CMake: Don't enforce find_package(Qt6FooPrivate) for Qt 6.9
Requiring users to do find_package(Qt6FooPrivate) to use private modules
turned out to be a too invasive change for Qt 6.9. We turn off this
behavior and restrict it to the dev branch.

[ChangeLog][CMake] The requirement to do find_package(Qt6FooPrivate) in
user projects was postponed to a later Qt version.

Task-number: QTBUG-87776
Change-Id: Ifbf676288587ae5fabe100bf3bd93b220ddbc5ac
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2025-01-27 18:33:03 +01:00
Alexandru Croitor
54cb92d58b CMake: Provide a way to find all available Qt module packages
A project might want to find_package all available (installed) Qt CMake
packages that contain qt modules.

A use case might be a qml app that needs to link to all of Qt, and
support showing qml files that can load any Qt qml module.

Add a new Qt6 COMPONENT called ALL_QT_MODULES.

It can be used like this:
  find_package(Qt6 COMPONENTS ALL_QT_MODULES).

The implementation will find all installed Qt modules by globbing over
all json files installed in $qt/modules dir, and treat the file names
as package names.

It will then tell Qt6 to find_package each of those packages.

Pick-to: 6.8
Change-Id: I89242307438576a0cbb3cdca80a9cb72818b6035
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit c7027880aa746a01362ac12491910479d7fc67e3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-27 16:37:03 +00:00
Alexandru Croitor
31c8031847 CMake: Collect all known qml plugin targets into a directory variable
Just like we do with qt plugins, collect all found qml plugin targets
into two new directory scoped variables:
- QT_ALL_QML_PLUGINS_FOUND_VIA_FIND_PACKAGE
- QT_ALL_QML_PLUGINS_VERSIONED_FOUND_VIA_FIND_PACKAGE

The plugin target names are derived from the Config.cmake file names,
based on the existing assumption that qt_internal_add_plugin always
uses the target name when generating the Config.cmake file.

Pick-to: 6.8
Change-Id: I78c76488e133fb3c0374cbc149425726077f6c31
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit bf83fffd13c176391d353080cd76bc68ae7ea184)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-27 16:36:57 +00:00
Alexandru Croitor
4661694382 CMake: Move qml plugin auto inclusion code into a separate macro
The code is moved into a macro without any modifications aside from
removing the escaping of variable evaluation and escaping of quotes.

It's kept as a macro similar to __qt_internal_include_plugin_packages,
because there might be calls to find_package() that set variables in
the current scope.

The reason for moving is easier maintenance (no more escaping).

Pick-to: 6.8
Change-Id: Ie6ddc26fe4ff8db0134f3542c2886f8b5d68dc51
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 47006aca44c16c78f00940574170640f19e9fb43)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-27 16:36:51 +00:00
Alexandru Croitor
93f52f7980 CMake: Set versioned variables with found modules, plugins, types
Introduce two new directory-scoped variables containing versioned
(prefixed with Qt6::) target names of qt modules and qt plugins found
as a result of finding Qt packages:
- QT_ALL_MODULES_VERSIONED_FOUND_VIA_FIND_PACKAGE
- QT_ALL_PLUGINS_VERSIONED_FOUND_VIA_FIND_PACKAGE

To be consistent in the naming of the variables going forward,
deprecate the old QT_ALL_PLUGINS_FOUND_BY_FIND_PACKAGE variable
in favor of a new QT_ALL_PLUGINS_FOUND_VIA_FIND_PACKAGE.
The difference is 'BY' vs 'VIA'.

The non-versioned variables are modified not to contain duplicates:
- QT_ALL_MODULES_FOUND_VIA_FIND_PACKAGE
- QT_ALL_PLUGINS_FOUND_VIA_FIND_PACKAGE

Also remove duplicates from the variable that collects all found qt
plugin types:
- QT_ALL_PLUGIN_TYPES_FOUND_VIA_FIND_PACKAGE

A follow-up change will collect qml plugin targets.

This information can be useful to find out what Qt targets are
available in a project, for example to know what plugin targets or
types can be linked into another target, or which libraries can be
deployed.

Pick-to: 6.8
Change-Id: I4f158872f4a8f6ef6008f081270604f75b77ad9d
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit f7b8ff71778bde94741402216269c2de2dda32c1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-27 16:36:45 +00:00
Soheil Armin
74c455c8bb Android: Incorporate QAbstractItemModelTester into QtAIM CI Tests
QAbstractItemModelTester performs non-destructive tests on test models.
It helps with catching the most common errors in the test model.

Task-number: QTBUG-132880
Change-Id: I719f4223d84e66c1d94cbd0380bfdb77b07da7b6
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit b751a12f7af533049ff46c6a63bd12eb6082415a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-27 08:06:46 +00:00
Soheil Armin
d25e08afc2 Android: Make use of ItemDataRole in QtAIM tests
Previously we were using raw zero-based integer values
for roles in QtAbstractItemModel tests.

Roles starting from 0x0 to 0xFF are reserved for pre-defined roles
defined in Qt::ItemDataRole enum.

This change will change the base role value to Qt::UserRole.
It will later help us to use QAbstractItemModelTester as this
tester class expects certain types from pre-defined role values.

Task-number: QTBUG-132880
Change-Id: Ie19739cd7bf49829fe58f5ad53078942d47a433b
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 967d9b8cf200163b25a3c1a3b3d79a107f9073b2)
2025-01-27 08:06:40 +00:00
Tor Arne Vestbø
abbbfa27bd Don't pass along expose events for destroying QWidgets
When closing a popup window on macOS, and the NSView needs display,
for example due to the frame geometry having changed, the system will
ask our NSView to display one last frame, via NSOrderOutAnimationProxyWindow
initWithSnapshotOfWindow.

If this happens during the close() that the QWidget destructor does,
we no longer have a QWidget subclass to handle the corresponding paint
event, so we'll end up flushing an empty frame, using that for the
animation transition instead of the last valid frame of the widget.

Worse, if the top level is using RHI to flush, the texture list
might be stale, as there is currently no plumbing for a widget to
tell QWidgetRepaintManager about it deleting a texture that was
previously picked up and placed in the QPlatformTextureList. When
this happens we end up crashing on dereferencing the stale texture.

To mitigate these issues we now skip the expose event if the widget
is already in ~QWidget. This potentially means the close animation
will use a stale frame, but we can live with that.

Pick-to: 6.8 6.5
Change-Id: Iabe1d97019923ee3a1a86039630095d00c966156
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9509434ecb4a11409d8c2bea9c010b40f8f7894d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-26 21:23:36 +00:00
Tor Arne Vestbø
ccbf28a56c Don't assume QDockWidgetGroupWindow has toolbars
As part of 3d99f90b50ab22ef5ab4433c57f9ee584a0a7cae we added logic
to look up the toolbar for a QMainWindowLayoutSeparatorHelper. In
the case of QDockWidgetGroupWindow the logic was broken, as it was
casting the layout's parentWidget(), the group window, to a QMainWindow,
instead of using the group window's parent.

However for QDockWidgetGroupWindow we shouldn't look for a toolbar
at all, as QDockWidgetGroupWindow can't have a toolbar. Using the
parent main window's toolbar is wrong, as mouse events for that
window will not affect mouse events for the group window, so the
bug in 3d99f90b50ab22ef5ab4433c57f9ee584a0a7cae is not triggered.

Fixes: QTBUG-132952
Pick-to: 6.8 6.5
Change-Id: Ic7845254e05bc358a39f79ec7622029d90173b45
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 81ed068a510421e6204193ec37448a628324543d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-26 21:23:31 +00:00
Timur Pocheptsov
2d819c7027 QTestLib: Add helper function to check for keychain access issues
To be used in network-related tests where we potentially are
using private/public keys and (on macOS) end-up with keychain
access blocking a test with dialogs requesting a permission
to access the keychain.

Task-number: QTBUG-132645
Pick-to: 6.8
Change-Id: Ide74633bf88b0453d5d8f8de56282c8cf8207380
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 13109ba350686cd8ce8e298db5d76d0e7c209bd1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 11:45:12 +00:00
Alexandru Croitor
940fc15ec1 CMake: Allow skipping some parts of SBOM generation
Makes it easier to debug diffs of SBOMs, due to lower amount of
content in generated files.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I5a1e8a9868cda199de4a7344b86a12f68fec31bf
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 3c516ffa8739a6d8729780138f07a6bea7cfea8c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 11:45:12 +00:00
Alexandru Croitor
fe3b0212ea CMake: Add SUPPLIER as an option to SBOM packages
Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I22cae71dcc7582126320e17271a8c55bea1ad393
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 2857d8d5eaaddde3e3cff916d5ad4b3c93a9b760)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 11:45:12 +00:00
Marc Mutz
760688cc75 tst_QUuid: fix -Wreturn-type in make_minimal(QUuid::Version)
The code relies on -Wswitch, but lacked the Q_UNREACHABLE_RETURN() at
the end that compiler and code readers need to understand that we don't
accept values other than those enumerated, even though an enum variable
could hold other values, too.

Since the function is constexpr, can't use that macro directly, but
need to copy the usual GCC 8 magic incantation.

Amends 171ff57be1b8fd1c1b33cffbffa389790f239b5c.

Pick-to: 6.8
Change-Id: I6c9dd0e4178211f57da61aa6df70f8036370f158
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 420ca3463ee8adf2d986af5802d8da4bb24ce14d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 11:45:12 +00:00
Alexandru Croitor
dcfd35f43b CMake: Add qt exported target name and package name into SBOM
Add them to the PackageComment field of the SBOM.
Can be useful to map back the SPDX Package to the CMake target or
package.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: Icbbb90132038c489b55c4ee7a038aea593ce1ff6
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 0be13fb6994feade6777a17cc405d9b2f32f2aa3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 11:45:11 +00:00
Andreas Eliasson
83cd96307f Doc: Fix method docs for QOpenGLTexture::setWrapMode
The current method description seems like a copy-paste left-over.

Fixes: QTBUG-57209
Pick-to: 6.8 6.7 6.5 6.2 5.15
Change-Id: Ife9f9f7bc97d990f5d447208bd39c2d2b6a614fd
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 9182f60b455cead33c0f4fd4e452b210e2de0fca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 11:45:11 +00:00
Alexandru Croitor
db841d4afe CMake: Add a fake deterministic SBOM generation option
Replaces content like timestamps, version strings and checksums with
constant values to make the SBOM generation deterministic.
This is useful for reproducible builds, to allow cleaner inter-diffs
while developing new SBOM features.

Can be enabled by configuring with
-DQT_SBOM_FAKE_DETERMINISTIC_BUILD=ON

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: Id0003bdd23fe57abd70213a2a108885861693242
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit d2dea0bc08036925cb93c226af19aeb896926309)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 11:45:11 +00:00
Alexandru Croitor
477972b3e0 CMake: Prepend underscore to qt_internal_sbom_set_default_option_value
Because it's in a Public cmake file.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: If3f92af848193cb824b88e93e17965ffed93cf2b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 4be604c55e3cf493f883a7df484940c9a1244a97)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 11:45:11 +00:00
Wladimir Leuschner
6a6a1c0fe2 QWindows11Style: Reduce groove size of QSlider
Reduce the groove size of QSlider when using Windows11Style, so that the
minimum selectable value does appear so.

Fixes: QTBUG-133128
Pick-to: 6.8
Change-Id: I3e5a5378e2eace3920c06db8cb1198122c0937b5
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit dee731ae981eb4f41f4b00be80f75c7a0a5c0e11)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 11:45:10 +00:00
Alexandru Croitor
3d4501bea7 CMake: Remove qt executable SBOM generation stale code
We never ended up calling _qt_internal_finalize_sbom for generic Qt
repo executables, and we never passed an SBOM type, so this code never
worked.

Remove it to avoid confusion.
It might be re-added in the future.
This doesn't affect the SBOM generation for Qt tools and apps.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: Iffde964efe2a6b70e6e0b64ec0803af5e84172fb
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit f2472c2e6a5b93dfbda166582620c30ea8855edb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 11:45:10 +00:00
Alexandru Croitor
69b7c311f3 CMake: Fix SBOM inline comment
Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I53696003b144ad628169a345743e343cdfc022ae
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit ffe972d72c3e577723b3a74eef098e381261c4d8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 11:45:10 +00:00
Fabian Kosmale
6e35353c83 _qt_internal_process_resource: Properly escape XML
XML requires escaping for certain characters, and we need to consider
this when writing out qrc files (which use XML).

This commit introduces a helper function,
_qt_internal_escape_xml_characters, to take care of the escaping.
It uses regular expressions to process the input strings. We take care
to start with '&', as '&' needs to be escaped, too.

We minimize the amount of escaping we're doing (the exact rules
differing between attributes and text), to avoid unnecessary work that
needs to be done when configuring a project. This is achieved by a
SUBSET option which can be passed to _qt_internal_escape_xml_characters.

Pick-to: 6.8
Task-number: QTBUG-131916
Change-Id: Ic1bd0eedee0343c3d70b6954842e21b3c550b092
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit e4fbbdea05540723d4c4429d673d25efa3201d7a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 11:45:10 +00:00
Alexandru Croitor
7584fe901e CMake: Add a few more internal sbom helper functions
Add a few internal functions to allow
- getting the sbom project supplier
- project supplier url
- project namespace
- computing a project namespace
- computing a project file name
- getting a sanitized spdx id given a hint

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I0dc3df274eaf6882a6af021aabee75501b5083f8
Reviewed-by: Moss Heim <moss.heim@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit dbf44b61c11d63a4e3242a62c3be34ebf1f3f012)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 11:45:09 +00:00
Cristian Le
a1a77ea7d1 Forward find_package hints to auto/cmake
If the tests are built and run as standalone or non-prefix build and a
find hint was used, e.g. `Qt6_ROOT`, then this type hint should be
forwarded to the `ctest --build-and-test` otherwise the internal
package would fail when it tries to `find_package`.

Change-Id: If71852dd5124b8deeddd28ba835f1943d96ba2b8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 599ad25a65ddf3b3fb7dcdc7c446da070800e507)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 11:45:09 +00:00
Joerg Bornemann
e120fb78c9 CMake: Only load Qt6FooPrivate automatically when building Qt
[ChangeLog][CMake] CMake packages of public Qt modules don't provide the
targets of their private counterparts anymore. User projects must now
call find_package(Qt6 COMPONENTS FooPrivate) to make use of the
Qt6::FooPrivate target. User projects that rely on the old behavior can
set the CMake variable QT_FIND_PRIVATE_MODULES to ON.

For user projects, the warning message we know from QMake is displayed.
The warning can be disabled by setting the CMake variable
QT_NO_PRIVATE_MODULE_WARNING to ON.

Within Qt itself, find_package(Qt6Foo) will still
find_package(Qt6FooPrivate).

For static Qt builds, we need to wrap usage of private Qt modules in
$<BUILD_INTERFACE> or $<BUILD_LOCAL_INTERFACE> (if CMake's version is >=
3.26). Static builds with CMake < 3.26 will always load the private
modules if the Qt6FooConfig.cmake from Qt's build tree is loaded. This
is the case in non-prefix builds and (in the future) when building
examples as external project.

This amends commit fbbf4ace0188b9718b6d7808021c0b887fd52d9f.

Task-number: QTBUG-87776
Change-Id: I78e95248f2b3fa73c3005c61df2fe4f71ad8eeb8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit ad7b94e163ac5c3959a7e38d7f48536be288a187)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 11:45:09 +00:00
Christian Ehrlicher
49260691b2 Windows11Style: fix drawing rounded corners in itemviews
When drawing an itemview item, the rounded corners (for current and
hovered item) were not properly drawn - the rounded corners of the
windows11 style were sometimes also visible where they should not be.
Fix it by using a clip rect and move the rounded corners out of the clip
rect on the appropriate places.

Task-nubmer: QTBUG-131585
Change-Id: I4eccc1e65768306a5511cda6e18db8f56fe1eff6
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit ed18ad9543ae4b30307bb178d1ee8b309062b9e3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 11:45:09 +00:00
David Redondo
10c195b864 QOpenGlContext: Always unset current context in doneCurrent()
Otherwise when no other context is made current until thread exit, the
QGuiGLThreadContext destructor will try to call doneCurrent() on an
already deleted context.

Pick-to: 6.8
Change-Id: If55dd69a72b8ab4012780a449f6a02729dd0ed43
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit cd1686e55f706048286cbc962bbe02032c2396cd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 11:45:08 +00:00
Aurélien Brooke
7fbc340561 rhi: vulkan: fix the pWaitDstStageMask parameter of vkQueueSubmit
It expects one mask per wait semaphore, where only one was given,
leading to an out-of-bound read.

Amends 202dd3cb39ab4408c44a8588b8d6fb9a1cc3a184.

Fixes: QTBUG-132356
Change-Id: I6f7d33eb4568d1577e09411f7be751c8dc520429
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit ff68e05bc3f8c98ccfc26b03ec68b183af9172f1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 09:00:00 +00:00
Felix Lionardo
ef2200e327 QNX desktop support
Adds functionality to communicate with a desktop manager. This feature
is only enabled if "desktop" is added to the QT_QPA_PLATFORM environment
variable (e.g., "QT_QPA_PLATFORM=qnx:no-fullscreen:desktop").

Pick-to: 6.8
Change-Id: If98e0dda43692abce47f2d8f5f340bd7276ec901
Reviewed-by: James McDonnell <jmcdonnell@blackberry.com>
(cherry picked from commit 70b1db9c0e0a53ec7e47ba296a534d38559c702f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 06:05:27 +00:00
Felix Lionardo
12f59b27e1 Disable incremental updates for raster windows on QNX
Incremental updates don't always work
due to a misinterpretation of the rectangles passed in by the upper
layers.

Pick-to: 6.8
Change-Id: Id30c97f80904209726b3aaf37c52b2e14ee2f187
Reviewed-by: James McDonnell <jmcdonnell@blackberry.com>
(cherry picked from commit d0e64a36d2806ae2892cb34cb44ef63b2d56abd1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 06:05:27 +00:00
Thiago Macieira
a5f12c1ff9 Revert "QFlags: befriend the QDataStream serialization operators"
This reverts commits 729c0960b84183bcf9576f974cb5e3b3c3fdc6ef and
348b680ae56e92f061424a10c4baa726cf7f15d2. Friendship is not required.

The removal of the forward-declaration in qflags.h implied adding it
where it had been required but not present.

Change-Id: Ie17963f95bb5fa98fd75fffd7e6e5289b58f1960
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit c7a069870ae80f47b32479dc1f8f7161a3238201)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 06:05:26 +00:00
Bartlomiej Moskal
b579f48790 Android: Unblacklist testQuickSelectionWithMouse test from tst_QLineEdit
Test was failing on Android because of three issues:
  1. Mouse selection does not work well with Android, especially when
     predictive text is enabled. After changes in
     de5ae6917c819ff23f7d9c5742b50b15e0824877 commit, mouse selection on
     Android needs ImhNoPredictiveText to be set for correct handling.
  2. Test sends mouse press events on center position of the QLineEdit.
     On some devices, the text would sometimes end before this center
     position. To avoid this situation the width is set directly.
  3. Android expects the mouse click to be released before the next
     click. If it doesn't, the next selection won't work properly

This commit fixes all those issues and unblacklists
testQuickSelectionWithMouse test

Fixes: QTBUG-87417
Fixes: QTQAINFRA-6896
Pick-to: 6.8
Change-Id: Id19850446954196a077047e250ea24a91ae7255e
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 1b02900ffe02980cb3e69c60ca415fd694cd773a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 03:21:11 +00:00
Assam Boudjelthia
1c32faa784 AndroidTestRunner: print failed build output when no --verbose is used
This helps with better debugging where in most cases the tests are run
without --verbose, but if there's a build error, it won't be clear what
went wrong, and only re-running with --verbose would give such details,
which is just annoying to deal with.

Change-Id: Icb8bcb8e5ba297d48b9e166c93523f25a21937b2
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit 48dbc72c4467d120353dba46fdbc2f8ddc145629)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 03:21:06 +00:00
Assam Boudjelthia
bff859c2ed AndroidTestRunner: don't automatically print logcat unless its a crash
Print logcats only if it's explicitly requested with the respective
argument or if there was a crash, i.e. where we can't get the test's
exit code. Otherweise, in case of normal failure, we don't really need
to pollute the output.

Change-Id: Ic4e6db5d9fd6786bd28204a3ec87f63a7ec9764a
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit 256fd95a712384c6d5b8b1841ab9c749fca89970)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 03:21:05 +00:00
Thiago Macieira
266653fee4 QFile: use unbuffered mode for the file-copy data pumps
There's no need to have the QIODevice layer buffer the data and thus
allocate memory. In the case of QFile::copy(), it also improves the
error message output.

Previously:
"Cannot create /tmp/tmp/f for output: No space left on device"

Now:
"Failure to write block: No space left on device"

Change-Id: I537a2a79ead9d1d9ac2efffdd650702a4424bac6
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 8a720c162d500369810674930884e36cf2494d88)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 03:21:05 +00:00
Ahmad Samir
2a734e1971 Docs: fix qdoc enum's \value "since" syntax
Square brackets.
https://doc.qt.io/qt-6/10-qdoc-commands-tablesandlists.html#value

Change-Id: I1d9237461a4eafb72b28ae019c02ba72f82d0f17
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9b44acfd26169d087224719b0813a146e7b731b3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-24 22:12:06 +00:00
Wladimir Leuschner
acbfeca2b3 QWindows11Style: Default PE_IndicatorRadioButton to selected/unselected
In case there is no valid QStyleOption::styleObject, default the
PE_IndicatorRadioButton to the selected and unselected appearances.

Fixes: QTBUG-132906
Pick-to: 6.8
Change-Id: I5e9c13cb3384321e025e5af08ee3dab81feb07fe
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit b717945812b16f957421bc2a2b1c4220f8148e64)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-24 21:01:03 +00:00
Mate Barany
eac8f36080 Update CLDR to v46.1
[ChangeLog][Third-Party Code] Updated CLDR data, used by QLocale, to
v46.1.

Task-number: QTBUG-132851
Pick-to: 6.8
Change-Id: Id08d9337e11234d0ca428c7e435808be1b044f7c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 918566aeddbbf56f8539c44bcd45223d2fbab996)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-24 01:45:50 +00:00
Marc Mutz
1ec2f5df26 QTemporaryFile: add private API for an overwriting rename()
In many situations, it is desireable that QTemporaryFile::rename()
overwrites an existing file, such as when emulating QSaveFile because
one would like more control over the temp file (such as passing it to
a different process). The public API of QTemporaryFile did not allow
it, making the typical Unix mktemp + mv algorithm to avoid symlink
attacks unimplementable with public Qt API.

QSaveFile is not a 100% replacement, because it always follows
symlinks and places the temporary file beside the physical target
file, keeping the symlink intact, instead of placing the tmp file
beside the symlink and clobbering it, if the target happens to be one.

Extract Method QTemporaryFilePrivate::rename() and add a bool
overwrite parameter that causes the existing
QTemporaryFileEngine::renameOverwrite() to be called in lieu of
QTemporaryFileEngine::rename(). The non-atomic path via
QFile::rename() is not affected.

This makes the functionality available as private API, in case we need
it in older branches.

Task-number: QTBUG-132646
Pick-to: 6.8 6.5 5.15
Change-Id: I0d5ca96c0a1a557854582e1a565a3db0d8af2a95
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit a01b14f1de59d378088a949bb21f3536832634c8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 23:04:16 +00:00
Felix Lionardo
a50b3916a2 Add libfsnotify to the core library for QNX 8
QNX 8 moved the inotify API implementation to a separate library,
libfsnotify. Added qt_config_compile_test to verify inotify in libfsnotify

Pick-to: 6.8
Change-Id: I5906d8fd0f146dc9db8d9ae2d8c0053bff21b840
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 2dfbfd5f9a800f40afd2a4e48a208a9f781fb0ae)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 23:04:16 +00:00
Alexandru Croitor
3f5df82334 CMake: Add an option to pass --showinternal to qdoc
This adds an SHOW_INTERNAL option to qt_internal_add_docs that
passes the --showinternal option to qdoc.

The option can also be set for all calls by setting either the CMake
variable QT_QDOC_SHOW_INTERNAL or the environment variable.

Pick-to: 6.8
Fixes: QTBUG-118176
Change-Id: If72c4072e10bc5f12b0431a5f8abea6ee1e2bd69
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 0b7ff3d0a7be7b8df6184cde5ca33bb681790131)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 19:06:41 +00:00
Alexandru Croitor
98d5581e16 CMake: Add various option to pass extra args to qdoc execution
Calls to qt_internal_add_docs now accept the following options:
- QDOC_EXTRA_ARGS: Extra arguments to pass to qdoc
- QDOC_PREPARE_EXTRA_ARGS: Extra arguments to pass to qdoc prepare
  phase
- QDOC_GENERATE_EXTRA_ARGS: Extra arguments to pass to qdoc generate
  phase

In addition, the following cmake and environment variables can be set
to pass extra arguments to qdoc for all targets:
- QT_QDOC_EXTRA_ARGS
- QT_QDOC_PREPARE_EXTRA_ARGS
- QT_QDOC_GENERATE_EXTRA_ARGS

The cmake variables can also be set at directory-scope, before the
call to qt_internal_add_docs.

Pick-to: 6.8
Task-number: QTBUG-118176
Change-Id: I0e28f3b863d5ca4efd0256432130af1c9c965f9d
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 948b2f601dd9c7f526497680c5c4928d2793c238)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 19:06:35 +00:00
Alexandru Croitor
a764da6902 CMake: Clean up and document qt_internal_add_docs
Change the option handling code to be similar to our other internal
functions.
Break too long lines.
Add a doc comment.
Add a message(DEBUG) for the case when qt_internal_add_docs is still
called with one argument.
Rename doc_project variable to qdoc_conf_path.

Pick-to: 6.8
Task-number: QTBUG-118176
Change-Id: I73167f1e72e2abcdb90722ecd6ee00f7636b8a5d
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 2fd16b2acb726e597479bb30f42363075e3de56b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 19:06:29 +00:00
Thierry Bastian
f738fcb1f4 Add support for PostgreSQL prepared statements with pgBouncer
Since 2023, pgBouncer supports prepared statements but only when
prepared/executed/removed at the protocol level.
So to support this, You need to call the appropriate functions
from libpq.
it does not change the behavior otherwise. You can note that to free
statements, libpq only has the function in v17.
Prior versions of postgresql will still use DEALLOCATE.

Fixes: QTBUG-132303
Change-Id: I2456820bbea318e1715ae46617bf4d137815ca54
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit ca09bc8d7a96b95d40bec9638f63467a24dfc0c2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 17:34:04 +00:00
Cristian Le
d45687f499 Make user tools symlinks relative
Fixes: QTBUG-132724
Pick-to: 6.8
Change-Id: I0f1d95ef6b66c81e2d12730eae3d5c0452a3a7a1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 6a4df2ac243d54f36ad1c1b406803e6caa1be294)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 17:34:04 +00:00
Cristian Le
9db4c36a2f Export INSTALL_PUBLICBINDIR to QtBuildInternalsExtra.cmake
`INSTALL_PUBLICBINDIR` is only exported if it was defined by the user
when building QtBase. The conditional check aligns with the one used in
`qt_internal_generate_user_facing_tools_info`

Fixes: QTBUG-107016
Pick-to: 6.8
Change-Id: Id5c38555e1d22cb3c16d85261cb052c695b4de03
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit a9964422360c637c7a46f85628a580448bb13bc1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 17:34:04 +00:00
Cristian Le
430779a287 Use _qt_internal_relative_path
Pick-to: 6.8
Change-Id: I1c4248bbf7e06536503224cbfceb57f41de019bc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 1192f2c87778c90530553cc62e763afaa0b6456e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 17:34:03 +00:00
Joerg Bornemann
b8fa115b47 CMake: Remove transitory code from _qt_internal_find_qt_dependencies
...that tried to load Qt6Foo instead of Qt6FooPrivate. This might now
load the wrong package, since we've split CMake packages of public and
private Qt modules.

Enough time has passed, and we can assume that all
Qt6*Dependencies.cmake files have the _qt_package_name property set by
now.

Task-number: QTBUG-87776
Change-Id: Icf18872dd49b1e3a82b7327027f7d6e48b656b70
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit ed7bc398d8f8f033a79e1adddf7874e9fdd961af)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 17:34:03 +00:00
Cristian Le
54f5a61fbc Add _qt_internal_relative_path
This is a compatibility function for `cmake_path(RELATIVE_PATH)`.
For CMake<3.20 it uses `file(RELATIVE_PATH)` instead

Pick-to: 6.8
Change-Id: Ibf9ca221c1753bd99dcc1820bffaea28f9bfe5af
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 334acc2eb3ec0cba702780036c94abdac306864e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 17:34:03 +00:00
Liang Qi
9cb8a156fd QDesktopUnixServices: avoid to call virtual function in constructor
This amends 1969b1a90a79dad049694bd1540f8627d5f26875 .

Pick-to: 6.8 6.5
Change-Id: I1be4e229d531f8a91e1ad3133a5b62784d18bb41
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 225f8e069b8fabff849f2167acd2d9e4b7b94788)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 17:34:02 +00:00
Laszlo Agocs
6fe4ebce70 Drop a limitation for R8/RG8 formats for Mesa in hasOpenGLFeature
The mentioned version is from 2015.

Change-Id: I330bd8ec08ab815a85d3e4e5afc44f314ade2ef6
Reviewed-by: Kristoffer Skau <kristoffer.skau@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 20b07bfa305153b8d828e133bb7dda838c2166c6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 17:34:02 +00:00
Laszlo Agocs
2f632086e9 rhi: vulkan: Support initializing without a Vulkan instance given
Problem is, this has potential issues down the line. For example,
if one pops up a QQuickWindow afterwards, also with Vulkan, and
wants to do things like enabling the debug layer (QSG_RHI_DEBUG_LAYER
and similar), that will not work since the instance is already up.

In absence of better solutions, drop a warning as well and keep this
undocumented for now.

On the plus side, this allows applications to implement things like
enumerating adapters with Vulkan and then launching a QQuickWindow
with the selected adapter. With other APIs (D3D) this is a breeze,
but is impossible here due to the very unfortunate concept of Vulkan
instances, and handles such as a VkPhysicalDevice being tied to the
instance.

An application has no way of knowing what VkInstance Qt Quick will
create/use, unless the developer does the extra boilerplate to
provide their own, which is an overkill in this case. So offer some
way to make this work, even if there are some pitfalls.

Change-Id: I1fc11f90cd1bf3fdac945ed5a7221f596368d30e
Reviewed-by: Kristoffer Skau <kristoffer.skau@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 3c338def89a4e03e3b47e624d83d83785c52037b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 12:56:14 +00:00
Laszlo Agocs
1efb618b9a QVulkanDefaultInstance: warn if setting flags has no effect
Change-Id: Ib939e56f0e8bc3e04725fb3660d30a8d3e13fad3
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Reviewed-by: Kristoffer Skau <kristoffer.skau@qt.io>
(cherry picked from commit 4f5b1c75a9427c26df0bb92c92f3d8c6370a371a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 12:56:14 +00:00
Edward Welbourne
631fa1915e Amend QLocale::uiLanguages() order
Include each of an entry's truncations right after the entry if its
script (or, where absent, the one implied via likely subtag rules)
matches and there is no later entry that it should appear after. This
is a compromise between prefering strictly equivalent matches to
potentially incompatible ones and prefering candidates derived from
earlier entries in the original list. Defer to QLocaleSelector (see
QTBUG-112765) the addition of options to give the caller control over
how to make that compromise.

On picking to 6.9 (by hand, since initial pick failed for want of a
precursor I've now picked) I've decided to pick to 6.8, which shall
surely get conflicts, since we want to fix the same issue there.

Pick-to: 6.8
Fixes: QTBUG-131894
Change-Id: I8750f4f40530c94638853388f47fcae1008db8d5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit cbf49f735e3cca85922a85d6548666816686db78)
2025-01-23 13:56:14 +01:00
Edward Welbourne
45c9a35d35 Include more pruned likely-equivalent entries in QLocale::uiLanguages
We were including, for each entry we got from CLDR or the system,
minimal and maximal additions from CLDR's likely-subtag rules, plus
versions with script omitted and possibly also territory added, when
likely-equivalent to the original. Include also the converse, with
territory omitted and possibly also script added when
likely-equivalent, so as to control order when these entries also show
up by truncation of others.

On picking to 6.9 (by hand, since initial pick failed for want of a
precursor I've now picked) I've decided to pick to 6.8, which shall
probably get conflicts, since we want to fix the same issue there.

Pick-to: 6.8
Task-number: QTBUG-131894
Change-Id: I363bfe31867be43807fe3b4942dafa186b8d2e94
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7f9ee43de783105d8de0a0b614751eec639131f8)
2025-01-23 13:56:13 +01:00
Edward Welbourne
e7cc3ccf1d Rework QLocale::uiLanguages() to be a bit more straigthforward
Skip duplicates as a separate step, to save some complications. Other
than that, achieve the same results by post-processing the list,
instead of trying to integrate the finding of fallbacks into the main
iteration. This makes the code easier to think about and cope with
further complications as we come to them.

Change-Id: If06eae5fd1e91e88b52b3d32ccaba8cbb8e3c8af
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 2c39365aad957aea7ca9c9c861665391edf7ef23)
2025-01-23 13:56:13 +01:00
Edward Welbourne
e149129954 QLocale::uiLanguages(): only QString-ify the locale names we do add
We can test whether the candidate is already in the list by exploiting
the comparison of QLatin1StringView with QString (and related
QStringList::compare() overload), so we don't need to convert the
QByteArray to QString unless we're actually going to add it.

(This does lead to the prior name being converted twice, but the
second of these is about to go away.)

Picked by hand since some later changes turn out to need it.

Change-Id: I8e47cbb4c9e44ad8ef13d04e930a4619845418ef
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f8128f280999e21ba291c899ce669d77803b976c)
2025-01-23 13:56:13 +01:00
Ivan Solovev
1a3efe2249 QFlags: add QT_NO_DATASTREAM checks to datastream operator declaration
Amends 729c0960b84183bcf9576f974cb5e3b3c3fdc6ef.

Found in Qt 6.9 API review.

Change-Id: Ieb81fe000e61fef54a003f52789fa1475aac5239
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 348b680ae56e92f061424a10c4baa726cf7f15d2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 12:56:12 +00:00
Ivan Solovev
d135c9ea00 Restore the docs for QFlags debug streaming operator
The unconstrained implementation was removed, so qdoc was not able to
find a proper function. Provide a fake definition that matches what
qdoc expects. In this case the users shouldn't really care about the
constraints that the actual implementation has.

Amends 0c707c6ebece18677deaccccdfec5d48c587106f.

Found in Qt 6.9 API review.

Change-Id: I6207b491fa94cc62d217af7dc7687923dc6971a4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b1509550436400ec9be608b5c760501d9b86912a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 12:56:12 +00:00
Ivan Solovev
b9c1d1f7a1 Fix SFINAE constraint in flags debug streaming operator
So that it allows overloading.
Also move the type T declaration into the function scope, as it
could never be used as a constraint anyway, and we do not want
users to pass custom type there.

Amends 0c707c6ebece18677deaccccdfec5d48c587106f.

Found in 6.9 API review.

Change-Id: I086d65bdef7be2f9e0e67e96cc8a9ac76eaa5b0f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f1d2d47f609cfb3c4cf9b2a86072613b3c9e0642)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 12:56:12 +00:00
Marc Mutz
faf10af206 Update public suffix list
Version 47264b57765919188b9f4144de8d95cf77e1b6dc, fetched on
2025-01-22.

[ChangeLog][Third-Party Code] Updated the public suffix list to upstream
SHA 47264b57765919188b9f4144de8d95cf77e1b6dc.

Pick-to: 6.8 6.5 6.2 5.15
Task-number: QTBUG-132851
Change-Id: Iba19f5006e8cb60505505c96a4e4649b075cae6e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 09fa335fb22122c42f057380e3d6f4d8944256d0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 09:19:46 +00:00
Marc Mutz
94e4f3c532 util/update_public_suffix_list.sh: adapt to PURL addition to qt_attribution.json
Also add a comment to publicsuffix-list's entry that the update is
done by a script that should be updated whenever this file's contents
change.

Amends 36dca3c04f759449f74008a3e79021a179b0f35e.

Pick-to: 6.8 6.5
Change-Id: I1a0e51568e6d4300197c09f759ad3d82277a74d1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit b9f74f9a0b97588fc07d75fa6a427f5c8d6a2c6c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 09:19:42 +00:00
Marc Mutz
cd99c6aad5 tst_QSet: check whether remove/removeIf detach if nothing is removed
They do.

Task-number: QTBUG-132831
Pick-to: 6.8 6.5 6.2 5.15
Change-Id: Ia4e9de7e443d11af9675924718c551a06bc4b447
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit b80679a90f39106052f1b53f4073e679d5077a5f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 08:25:47 +00:00
Christian Ehrlicher
da4e9b7637 QAbstractFileIconEngine: store pixmaps with correct key
QAbstractFileIconEngine stores the generated pixmap in a QPixmapCache
with the size as key. This is wrong as the size is multiplied by the
current devicePixelRatio so this has to be done also for the key.

Pick-to: 6.8
Change-Id: I6d8ceedc950d23abf9c4d79d92e86848b9508c9b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 83ff179f85559af880d28d7832d44f95c5ce9616)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 05:15:23 +00:00
Shawn Rutledge
a4dc60e9fc doc: Improve QTextTableFormat::setBorderCollapse and related docs
We changed the default in 6.8. It was documented in the changelog but
not in docs. Amends 09ea47f8113bdce437253b19a91f739aeef7a333

Pick-to: 6.8
Fixes: QTBUG-132173
Change-Id: I1b6bf69931ba12025cf95e80c12a5073a94af598
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 622133ace2533617f294b8d875b5eb749a78571b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 01:42:08 +00:00
Volker Hilsheimer
dac4298b72 JNI: remove noexcept from QJniArrayMutableIterator methods with preconditions
Change-Id: Ifdb0c09eec6a269a826ab80e443a11a7858a21b6
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit ab89118b8f54e45c4132467a9018054f835777db)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 00:29:00 +00:00
Thiago Macieira
b0fe7f3479 tst_QTcpServer: add missing const
So the array itself is also const.

Amends a94731c2ad85f9dd40050a780f67c911bf12668e.

Change-Id: Ic4d78d3d059dd47f776ffffdd0971b1aa35a69e9
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 8500e730406cf592d9eeffadab3c4f7e6a51da96)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 00:28:58 +00:00
Christian Ehrlicher
d10cba961b SQL/ODBC: escape values in connection string
The previous attempt to escape invalid characters for username/password
did not work for e.g. '}' or '{'. The msdn documentation is somewhat
inconsitent here but after testing it looks like putting the
username/password inside '{' and '}' no matter if needed or not is the
easiest way. We have to escape '}' by doubling it though.
No need to escape the DSN - testing on windows revealed that ';' is not
allowed in there and '\'' and '"' at the start of the DSN is perfectly
fine without any escaping.

Pick-to: 6.8
Fixes: QTBUG-122642
Change-Id: I04d007d343dd65eb0dbc0252518843eb43cd9ab8
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 38277a88f1dd69de6e031bc8313c8d5beadf6bd0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-22 16:13:35 +00:00
Christian Ehrlicher
b93a8dfdfe Windows11Style: don't set minimum width for QAbstractSpinBox
There is no need to set a minimum width for QAbstractSpinBox in
QWindows11Style::polish() as this might override the user preferences.
Also the minimum size handling is now properly done within
sizeFromContents().

Pick-to: 6.8
Change-Id: Ibc1fd7a6f862fc85e3739025b9de581aa235d74c
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
(cherry picked from commit 2ec4c28470de115c16944653a5d4f6209452d56c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-22 16:13:34 +00:00
Christian Ehrlicher
1ac5e98077 Widgets: add enum values to QStyleOptionViewItem::ViewItemFeature
Add two new enum values:
IsDecoratedRootColumn: notifies the style that the current cell also
contains place for the tree column branch indicator so it can e.g.
properly draw rounded edges in a cell or complete row.
IsDecorationForRootColumn: the item contains the information to draw
the tree column branch indicator.

Task-number: QTBUG-131585
Change-Id: Iee2823fe3a227630f926d0448095a10fad2b0ba7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c917d16f4b9982425b51dfc4947792e36defde35)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-22 16:13:33 +00:00
Edward Welbourne
9ed5d93c77 QtTest: Update valgrind (fatuously) to v3.24.0
Nothing has changed in the headers we use, aside from the version
number, since v3.23.0, so we may as well declare ourselves up to
date.

[ChangeLog][Third-Party Code][QtTest] Valgrind headers are up to date
with Valgrind v3.24.0.

Pick-to: 6.8
Task-number: QTBUG-132871
Change-Id: Ib2ad8d73e662535a014d241b46cc50214b45f50b
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 549bab4150b4652bb8b6577c737e49ae03f6348f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-22 15:07:58 +00:00
Tuomas Vaarala
0d4c3c852a Remove quotation marks from objcopy call parameter for QNX
If the objcopy call parameter is in quotations marks it fails the call
and prevents separate debug info builds for QNX.

Fixes: QTBUG-132801
Pick-to: 6.8
Change-Id: Ifadf57f80eb5c354aedeb8985bc7a0c9b79dc62e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 9261b68395df75dbb01539c547832d9cc35521d9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-22 15:07:53 +00:00
Mitch Curtis
133838a7c7 Make iconbrowser manual test directly openable in Creator
This avoids the need to run qt-cmake-standalone-test and then import
the test, as described in QTCREATORBUG-25389.

Pick-to: 6.8
Change-Id: I010d6613debb2e34ef3809d2da78ca33ade4d602
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 742a0ed72f5264b0198d87df6c4e0657eaf48172)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-22 15:07:53 +00:00
Edward Welbourne
007c0a1854 Add a QDuplicateTracker<T>::contains()
When even some values I haven't seen may need to be left for later,
but values I have seen are definitely to be discarded, I need to know
if I've already processed them before doing the fiddly check for
whether to defer; but if I decide to defer, I haven't yet processed
and need the later check, to which I've deferred, to see the value as
still new, even though I did once ask about it before. So I need a way
to query without adding to the set.

Pick-to: 6.8 6.5
Change-Id: I712f1c400147210c149aeec6de1d15d2e095d6a9
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 09b77a8d07276e0b5e5fec596f957f8fc4a78869)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-22 09:37:15 +00:00
Edward Welbourne
d1f0e924e9 Correct description of 3rd-party CPU cycle counters
Pick-to: 6.8
Task-number: QTBUG-132871
Change-Id: Ia0a467297393be72ff7d39b7333ad86e09057dff
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit a419db7160f2070de9ae52e80dcfff05304d9229)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-22 09:36:54 +00:00
Edward Welbourne
72c674d253 QMimeType::comments(): skip locale-name-trimming
Pruning the part of a locale name after the first '_' should now be
redundant, as QLocale::uiLanguages() now includes the resulting
truncations. It may do so later in the sequence than the pruning used
here, where the pruned version either might be a bad choice (due to
being in a script incompatible with what we started on, e.g. pruning
pa_PK to pa, which uses a different script) or would also arise from
some later, more specific, entry (as when uiLanguages() is expanded
from {en_NL, en_150}, where checking en immediately after en_NL would
bypass the more specific en_150 when present).

Change-Id: I4c7c199ca16a8e4803843547c5a689cea11af1f2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9574e8cbef06b3b55d1f651b09d134aef7150aba)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-22 09:36:38 +00:00
Ivan Solovev
8e4ca03733 qtformat_impl.h: do not include <version>
We intentionally include <version> in the most low-level Qt
header, so that all other headers could just assume that it
is always available.

In this case it is already available from qtconfiginclude.h,
which is included from qtconfigmacros.h.

Amends 20b6ebea84997ecd70d37640f68232c60cc7231f.

Found in Qt 6.9 API review.

Change-Id: I430c7392b5237ec582708e3ae1170eabc7c3a402
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9a3199fec2673e591811a4775ec8a00073c9f433)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-22 09:20:07 +00:00
Shitong Xu
3b5fcd4901 QFileDialog: the lastVisited not loaded correctly
Url passed from the QFileDialogArgs will never be invalid, it will
always be the value that user passed into or the lastVisited or the
working directory. And because of this, the fixes code of QTBUG-70798
will never be invoked, and the `lastVisited` will never be initialize if
nativedialog is in use.

I wrote an init function to initialize the `lastVisited` global
variable, to make sure the value will be loaded correctly

Fixes: QTBUG-70798
Pick-to: 6.8
Change-Id: Id05f63db7b4738e6317721741111882a565437e3
Reviewed-by: Xu Shitong <xushitong@uniontech.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 34f1b6b6d1dd7c37f2d71c0032ddc0c83360c11c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-22 02:25:17 +00:00
Liang Qi
7ab7d88e8a platforms: rename QGenericUnixServices to QDesktopUnixServices
The implementation follows XDG Desktop Portal mostly, and is for
desktop, not generic unix.

Task-number: QTBUG-130884
Change-Id: I88456abb37b8b23cfec00ee8eac8ffee9a65ed9f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 3e29267df0e2f332290caad69e5bd5cfd61cf3da)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-22 03:25:17 +01:00
Liang Qi
78da1f8d00 Use QPlatformServices instead of QGenericUnixServices on embedded
Including bsdfb/directfb/eglfs/integrity/linuxfb/vkkhrdisplay.

QGenericUnixServices is mainly for desktop usages which uses dbus
and xdg things.

Task-number: QTBUG-130884
Change-Id: I003ec780aa039610cb5c36cd67cabbf173d8f642
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit f8d0e4798c0d2985dbe5f8515a8281c9109ef6c4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-22 03:25:16 +01:00
Liang Qi
2a4604e59e QGenericUnixServices: avoid dbus calls on non xdg envs
Fixes: QTBUG-130884
Pick-to: 6.8 6.5
Change-Id: I2525293f776676cda63e61c3c5093045dbafcf38
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 1969b1a90a79dad049694bd1540f8627d5f26875)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-22 03:25:16 +01:00
Liang Qi
dcac89b5c7 qpa: lazily populate the services object except xcb
In order to optimize the footprint of QPA plugins, we avoid to
create QPlatformServices object in QPlatformIntegration constructor.
It benefits embedded platforms and others.

Task-number: QTBUG-130884
Pick-to: 6.8 6.5
Change-Id: I5c0d2616ace9fbc0e077eece32d8836b40fc83dd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ff51ea5418d131248b07e327513b41dad1231f37)
Reviewed-by: Liang Qi <liang.qi@qt.io>
2025-01-22 03:25:16 +01:00
Marc Mutz
cebb2dd068 Short live q20::exchange()!
We have weaned ourselves off of qExchange(), which, however, has C++23
semantics (is constexpr and noexcept), while we only require C++17 atm.
At the same time, we have more and more uses of a constexpr exchange(),
iow: the C++20 extension.

We have the qNN namespaces for this, so let's use it: Add
q20::exchange(), with C++20 semantics (constexpr, not noexcept), and
use it to port the only remaining qExchange() user (since ported to
2×std::move() to make the header compatible with QT_NO_QEXCHANGE),
QScopedValueRollback.

No user requires the C++23 noexcept on the function (compilers will
figure it out, because the std::exchange is fully inline), and we
can't provide a q23::exchange() even if we needed to, because the
author of P2401 forgot to ask to update the value of
__cpp_lib_exchange_function...

Fixes: QTBUG-133038
Pick-to: 6.8
Change-Id: I003df445001d1c5ab02402119c5e5106aa156263
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b5ed7fb203335cef7b7b4f70f4130b07166cecf2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-22 02:25:16 +00:00
Thiago Macieira
c88a8c78bd tst_QProcess: remove duplicate DisableCrashLogger variable
Amends 90bc0ad41f9937f9cba801b3166635f6f55e0678.

Pick-to: 6.8
Change-Id: I3faad81a5748ed0942d4fffd93c82124fc18b751
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 08cd38078e11988530251240096b3686e26dd783)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-21 23:17:54 +00:00
Thiago Macieira
5dbe3ecde8 QMutex: improve codegen for non-futex lockInternal()
Amends commit ff9da1db0b0963f967f45ab430ec40a3051b70b4.

QDeadlineTimer's Forever constructor is constexpr inline, while the one
taking an integer is neither. In an LTO build, the compiler might have
realized that it's constant, but let's be sure.

Pick-to: 6.8
Change-Id: I2c07caec660e05efe695fffd6ac8ec3120258a96
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit ef73a5f175f8d51a0bacbdd30cacbd3b6d151d36)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-21 23:17:45 +00:00
Thiago Macieira
1290935fab QMutex: replace QT_MUTEX_LOCK_NOEXCEPT macro with constexpr trait
This says better what it is and I'll use the trait for the unlock
operation.

Change-Id: I46752ca2ee71297d77e5fffdddaa193b6c86dbbc
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 85ebb9d52a413f205046f864a2823e3f0819ed9e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-21 23:17:44 +00:00
Thiago Macieira
993c3fc35b QCoreApplication/Win: add a better way for ActiveQt to override qAppFileName
Right now, the DLLMain in qaxserverdll.cpp calls GetModuleFileName() on
the hInstance for the DLL and passes the path to QCoreApplication to
override the path. This adds a way for it to simply pass the hInstance
handle, which will automatically cause qAppFileName() &
QCoreApplication::applicationFilePath() return the DLL's path, which in
turn influences the default QCoreApplication::libraryPaths().

Change-Id: I3cc172288c54c3938566fffdfb62985000ce2e9c
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 507024317fec0c1deeb62c8c2ba5a43af7d65f21)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-21 23:17:30 +00:00
Thiago Macieira
2ed35fe889 tst_QMessageLogger: disable Android once and for all
The messages said "This test crashes on Android" bu tit appears the
problem is not a crash, but that the executable can't be executed. The
file appears to be present and yet execve() is producing ENOENT (No such
file or directory). That probably means it's the interpreter stored in
the ELF header's dynamic section that is not found.

Fixing that is SEP[1].

[1] https://en.wikipedia.org/wiki/Somebody_else%27s_problem

Change-Id: I3025825c5e00f47a5a40fffd53c47131db3676dc
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 40ad963e1a22dbf3eea96f6a17bf6cbb28294649)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-21 21:27:47 +00:00
Nicholas Bennett
d07c24d1ba Docs: Add that Qt Print Support is not available on Android
Created a list and added Android to the existing mention of iOS.

Fixes: QTBUG-132742
Pick-to: 6.8
Change-Id: I6e906980d28b54daf18c019eb9299a9d67daef3d
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit afa34d5f3773dec4fb2a7d524100a6f7a307e3e6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-21 20:17:00 +00:00
Giuseppe D'Angelo
b223437124 QEasingCurve: fix (de)serialization in QDataStream
The serialization code did stream out a function pointer as an integer,
and then tried to set it back -- effectively, it has *never* worked
since the beginning of public history, unless
serialization/deserialization were done within the same process.

While we cannot support streaming custom easing functions, we can
recover the non-custom functions from the type, which was also streamed
out; setType will take care of that, and we'll just ignore the
subsequent field in the stream.

If one tries to stream out a QEasingCurve with a custom curve, what do
we do? I've decided to just print a warning and stream _something_ out,
so I can keep some degree of behavioral compatibility and aggressively
cherrypick this patch.
AFAIK, there's no support for such a scenario in QDataStream: all
out-stream operators have a wide contract, and there's no Status flag
that meaningfully represents this case (and I doubt anyone checks QDS'
status while writing into it).

Change-Id: Ifa80cf3a9003cab074ddf112022c09b364497007
Fixes: QTBUG-132575
Pick-to: 6.8 6.5 6.2 5.15
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 78a46bf16b7061bfd77b7b3bcf392c28ee788bfc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-21 20:16:58 +00:00
Alexandru Croitor
858bb5df19 CMake: Build executables in single-config debug-and-release builds
If qtbase is configured with -debug-and-release -force-debug-info,
which maps to '-GNinja Multi-Config'
'-DCMAKE_CONFIGURATION_TYPES=RelWIthDebInfo;Debug'

and then qtopcua is configured with -GNinja -DCMAKE_BUILD_TYPE=Release
building the 'all' target would not build executables or tools.

That's because the targets have their EXCLUDE_FROM_ALL property set to
exclude any non-first multi-config, and Release doesn't match
RelWithDebInfo.

Such a scenario can happen for our multi-config windows builds, when
someone tries to build a repo not with qt-configure-module but rather
with cmake directly. They would then not specify the same build types
or generator, which can happen when opening in an IDE like Qt Creator.

Make sure to also check if the current generator is a multi-config
one, in addition to whether QT_FEATURE_debug_and_release is ON, before
adding the genex to the EXCLUDE_FROM_ALL property.

This allows building and installing executables and tools in such a
scenario, because in a single config build, the genex would not be
added, even if QT_FEATURE_debug_and_release is ON.

Pick-to: 6.8
Fixes: QTBUG-132609
Task-number: QTBUG-132338
Change-Id: Iaee1a0afb19df97ee1263dbaf27c8e29fc127831
Reviewed-by: Jannis Völker <jannis.voelker@basyskom.com>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit baddc0a1958c8ea9cb946465c93ecdd62bde9d3d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-21 20:16:55 +00:00
Eskil Abrahamsen Blomfeldt
c2e528ef42 Update Harfbuzz to version 10.2.0
[ChangeLog][Third-Party Code] Upgraded Harfbuzz to version
10.2.0.

Pick-to: 6.8 6.5 5.15
Fixes: QTBUG-132855
Change-Id: I542c054ccdc311b17363456c693a2057c2e496c1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 308ee2738f24d5f01fc8914f071735ad91716947)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-21 19:21:39 +00:00
Friedemann Kleint
84ad506420 Standard dialogs example: Fix compilation with QT_NO_CAST_FROM_ASCII
Add missing tr(), use literals.

Pick-to: 6.8
Change-Id: I35387e29ce1b08f9df0ade5ee743b33561639f7a
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
(cherry picked from commit 3e1707d43068d43b078a2e626a0c46ff78da997b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-21 11:26:05 +00:00
Friedemann Kleint
82e7d1e56e Standard dialogs example: Fix some clang-tidy warnings
- Use auto * when initializing with new
- Initialize variables
- Fix static invocations
- Use per-class includes
- Minor cleanups

Pick-to: 6.8
Change-Id: I137bc7dfad63bc55a1b1bbc3f42d758bbfdb86ba
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
(cherry picked from commit f388ca8841ad25cf79e5fdf8fa3e9d2f4de48ebc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-21 11:26:04 +00:00
Friedemann Kleint
a97091d699 uic: Write Palette/Gradient code with fully qualified enumerations
Task-number: PYSIDE-1735
Change-Id: Ica05108d8802f235fd067095072547c1461e7387
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
(cherry picked from commit e90115b5f7dafb1d6acd347634b14e12b6ff88f1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-21 08:24:01 +00:00
Shawn Rutledge
3bcc785d0c Avoid dangling d-pointer deref in QWidgetWindow::handleMouseEvent
If you drag-and-drop a OpenGLWidget in Designer, the main window gets
re-created when the OpenGLWidget is instantiated. So in general (in
rare cases), at the end of QWidgetWindow::handleMouseEvent() we might
have a different window, and therefore can't reliably call
QWindowPrivate::maybeSynthesizeContextMenuEvent() without checking for
a valid pointer.

Amends 84a5f50c7766c99f62b22bb4388137e0aa8dd13d

Fixes: QTBUG-132912
Change-Id: I7b220b4daceab988aadabf9427ef6b2d5624e00d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 1accd2421686b387daa115b3a46974fce0fdb118)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-20 19:48:29 +00:00
David Faure
cfe906856b Docs: remove \internal in the docs for encodeMetricF()
The documentation for QPaintDevice::PdmDevicePixelRatioF_EncodedA
refers to encodeMetricF() which was nowhere to be found in the
documentation because it was marked as internal.

Pick-to: 6.8
Change-Id: I37707bc641d359f367f77c958043b6dfa33d4dcb
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 3ff989acaf84405a472605140e4035b993380bce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-20 19:48:26 +00:00
Alexandru Croitor
5165a8bacc Remove unsupported linker script objc_namespace.sh
According to the discussion in QTBUG-132398, the script stopped
working in newer Xcode versions, and also didn't cover new
Objective-C language features.

Remove the script to avoid confusion.

Pick-to: 6.8
Fixes: QTBUG-132398
Change-Id: I37b96ac6a77af1fcc4221591cb1f6320fa9a024b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 6404714183b3fcf93ac27482c5a3193a4f93767d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-20 17:51:38 +00:00
Alexey Edelev
9521b51eef Replace qt_record_extra_qt_package_dependency with qt_register_target_dependencies
qt_register_target_dependencies does the same thing as
qt_record_extra_qt_package_dependency but in more convenient way.

Update the qt_register_target_dependencies signature and adjust naming,
it now accepts PUBLIC and PRIVATE multi-value arguments and called
qt_internal_register_target_dependencies.

Use it and deprecate qt_record_extra_qt_package_dependency.

Pick-to: 6.8 6.5
Change-Id: I0594cf699ec1e3af7210dd7450fa3f81c1f565ae
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 8272b747d3b91e15fda2b76326221a26fb2245d2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-20 17:42:01 +00:00
Alexandru Croitor
b51ee7068c CMake: Use a unique resource identifier in simpletreemodel example
To avoid the following error:

 The custom command generating
    .rcc/qrc_editabletreemodel.cpp
  is attached to multiple targets:
    editabletreemodel
    editabletreemodel_tester
  but none of these is a common dependency of the other(s).  This is
  not allowed by the Xcode "new build system".

Pick-to: 6.8
Fixes: QTBUG-131631
Change-Id: I1c5d0702596a4f8f723d9080bc5304d6ad06853b
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 9f593791988da197dbe956669b8a4647dc50124a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-20 17:42:01 +00:00
Mårten Nordheim
ce820174ee QFile::rename: error out if overwrite fails when changing case on case-insensitive filesystems
The generic copy-and-remove fallback will first open the original file
with a different case, truncate it, and then remove the original file.
Leaving us with no file at all.

Task-number: QTBUG-132785
Pick-to: 6.8 6.5
Change-Id: Ia5a41d26c1d6d6bdc231c71acf15bd2ea496c715
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 2defca418788ab167fa1ce70e518c9250cb0909f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-20 14:06:09 +00:00
Eskil Abrahamsen Blomfeldt
e958f05aec Request actual font family request in final color font fail safe
When we're trying to resolve a font for color emojis, we will
prefer any color font over the selected font (since a normal
font may have monochrome glyphs for emoji characters and that's
not what we are after).

If there are no color fonts on the system at all, we need to do
a final match where we ignore whether the font is in color or
not and just return it anyway.

In this final pass we would find the first best match among the
fallbacks (typically the first one), but never actually check
the font that was requested in the first place. This was a
mistake. Unless it does not exist, we should just return the
requested font family.

Task-number: QTBUG-132377
Change-Id: Ie53a6bd665ebdaaca92bf0c33fabf5195e1aa5fe
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit b154af082c8679fa09f325735025d98df9a8dcff)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-20 14:06:09 +00:00
Assam Boudjelthia
10b88f3f20 AndroidDeployQt: explitly constuct the qmlDomCommand args list
Construct the arguments list explicilty to QStringList to avoid calling
QProcess::splitCommand() and potentially splitting a path with spaces
that shouldn't, this also saves from having to deal with shell quotes.

Fixes: QTBUG-132891
Pick-to: 6.8
Change-Id: I48f6c219830269c507f146b654bcfa025f0e3203
Reviewed-by: Olli Vuolteenaho <olli.vuolteenaho@qt.io>
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Reviewed-by: Soheil Armin <soheil.armin@qt.io>
(cherry picked from commit a8d8fb83ccfed09dd35dbab22caceaff963a3415)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-20 14:06:09 +00:00
Eskil Abrahamsen Blomfeldt
87330d4bd7 FontConfig: Fix detection of color fonts
There were two mistakes in the code that intended to detect
if a specific font was a color font in the FontConfig database.

1. The "int n" parameter in FcPatternGet*() is not an array size,
but an index, so it should be 0 and not 1.

2. We need to add FC_COLOR to the list of properties in our pattern
when populating the database, otherwise we will just fail to match
it and none of the system fonts will be listed as color.

Fixes: QTBUG-132377
Change-Id: Ib3c112e8a354abacd05679c62283a1f1abfb40ee
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 2e1db6541777ee076195ff9e793e4e83afd81539)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-20 14:06:09 +00:00
Thiago Macieira
f9bdb80ef1 De-duplicate the disabling of crash dialogs in our unit tests
The code was duplicated in multiple places.

Pick-to: 6.8 6.5
Change-Id: If2ab30b7afbf6d2f99c9fffd999218802b734d5e
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit b119fee87d5579dc1c4bfc2f508b0e3a75d69fa3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-20 03:24:39 +00:00
Thiago Macieira
b69650be3e QThreadStorage: remove unused moc-skipping guards
QT_MOC_CPP is not the same as Q_MOC_RUN, which moc's preprocessor still
sets. It appears Qt 3's qmake set it when ALLMOC_HEADER was set... a
feature that doesn't appear in Qt 4 (but exists with cmake_automoc).

MOC_SKIP_{BEGIN,END} appears in Qt 3's moc, but not in Qt 4's. But they
weren't in qthreadstorage.h at the time, so I guess they were added in
the 4.0 development cycle when QThreadStorage changed, but before moc
was rewritten (which deleted the Qt historic repository's oldest file,
moc.l).

Change-Id: Ibfff778c9f4d17af006dfffd8545fb24b495ecdd
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit bec49144f809ef8c5c61099ce46241c16b20b180)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-20 02:52:26 +00:00
Ivan Solovev
2db67cb4b6 QtTypeTraits: fix order of the includes
Amends 08c6cc62c743e172fbf064ccaad1159b2a1fb850.

Found in Qt 6.9 API review.

Change-Id: I1ed29a913e34ecf093a98c2053c319f0edfb9135
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 0d047ca713ac66fe8ba94194441cd2e98cb76698)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-19 13:40:22 +00:00
Volker Hilsheimer
afc00d2b9b Doc: fix linking issue in QHeaderView; reflow
QHeaderView has no resizeMode property, only a ResizeMode enum type that
is then used in the sectionResizeMode API.

Fix that reference, reflow the paragraph, and apply some light editing.

Amends 9e3a96189d9db8a458e65cd5078509afe7a160db

Change-Id: I240c3f64fd45c96f4d3ba95c2086a638468e137f
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
(cherry picked from commit 988a3cd95da4b5875c7116141f2b22acf3e20502)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-19 13:40:22 +00:00
Ivan Solovev
e4d59b698e Fix docs for new QDebug streaming operators of std containers
Added the missing function declarations to the #if Q_QDOC part of the
header. Also fixed a typo in the std::unordered_map docs.

Amends 850d4895be565931d18c92e5e2f9a33b7f26de6d,
0c96528e8d43ad4309bdca14b179a5045984655a,
a9fe57fefaac0cb047e4c02e0b8c8f8327e0a58c,
and a8c9a5617c72ad2e55bf497df6ff2c2e141cbdef.

Found in Qt 6.9 API review.

Change-Id: I792023b506e2afdbdca4bca3197887e50c98a788
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 256b56f581a66acde829a2f47b3d0f6ed464fb44)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-19 13:40:22 +00:00
Ahmad Samir
55f8c072a3 tst_QUniqueHandle: silence GCC/Clang -Wself-move warnings
And remove NOLINT(clang-diagnostic-self-move), silencing the warning for
Clang seems to work for clang-tidy too (tested locally).

Amends 03bd9491491881529ad28cd6d672edfdda9a0065.

Pick-to: 6.8
Change-Id: Ibdf982a728f2c6150f2911173dc3c9246f3662b8
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6f0f39673f5ae9debd9ab59be60c32f00f40c41a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-19 13:40:22 +00:00
Allan Sandfeld Jensen
4d34eee362 Fix CMYK8888 on big-endian platforms
Pick-to: 6.8
Fixes: QTBUG-132875
Change-Id: If7e945607125a5ae5ce1f8323df27ab8481e329c
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 7ad2083ec3cbc9dce949e83465973435d0aa992a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-19 13:40:22 +00:00
Thiago Macieira
7920772663 QMutex: mark the out-of-line, *Internal() methods Q_NEVER_INLINE
With LTO, I'm seeing GCC conclude that it's best to inline the
lockInternal() and unlockInternal() methods into the public ones and
then emit out-of-line copies for those. That's actually sub-optimal, so
force GCC not to do it.

Pick-to: 6.8
Change-Id: I88c29098757ea6e70c00fffde56989ec05b136bd
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit cc4abefb1db3bdfee0d57ea528d55073a4498b4d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-19 08:30:37 +00:00
Thiago Macieira
cad8c1e6a7 QCoreApplication: move the QRecursiveMutex into QCoreApplicationData
There's no need for it to be a global, if the data isn't either. I have
a vague recollection of the data also being globals back in the
day... (they used to be plain QStringList pointers).

Change-Id: Ie5f1a71d0b20a0195822fffd992101c94824a07f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit a314e4b98513d4b5cd89d05e74f93c2b16ebc168)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-19 08:30:36 +00:00
Thiago Macieira
a2792a934f Move the libraryPath tests from tst_QApplication to tst_QCoreApplication
Those aren't GUI tests. I suppose they've been in tst_QApplication since
Qt 2 or 3, when there was no QCore/GuiApplication yet, and were never
moved.

Change-Id: I30b3c1a309ba2c720210fffd045ebd0bcfa803fe
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 9fe44e4779cf421de7f33f867be8e55d291c16ea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-19 08:30:36 +00:00
Thiago Macieira
62b1336c55 QJson: Remove QT_JSON_READONLY
moc (and thus the bootstrap library) has needed JSON output since Qt
5.15 (commit da284ef10e0ef80776b9fc9b7bb0e6dc8d71ba63 "Add support for
machine-readable JSON output to the MOC").

Change-Id: I4b8cf51c092eb35cc383fffd48d120f0cb2c56b0
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Johannes Grunenberg <nerixdev@outlook.de>
(cherry picked from commit 029bb47e12d63e186663714c3776d3654285496b)
2025-01-19 00:30:36 -08:00
Marc Mutz
2a5d850e48 Move the <version> include from qcompilerdetection.h to qtconfiginclude.h
The idea of b2ed29b8d9b33dcece83000aee28073dd27f1cd9 was to have the
contents of <version> (if it exists) available in all Qt headers.

Since we broke up qglobal.h into smaller pieces, qcompilerdetection.h
is no longer necessarily included by any given Qt header, which
thwards the original idea.

Try with qtconfiginclude.h, which exists since
61935786c30b0209811fa32f7a02f138da8570b2 (Qt 6.6).

For Qt 6.5, we'll need to add it separately to qtversionchecks.h and
qtconfigmacros.h, whence qtconfiginclude.h was extracted, as well as
keeping it in qcompilerdetection.h, which includes qtconfiginclude.h
only since 22029a76c37d8d670479d523684a84f7966ed434.

Amends the breaking of qglobal.h into smaller headers, without being
attributable to any one of the individual commits that made up the
change, or else amends b2ed29b8d9b33dcece83000aee28073dd27f1cd9.

Pick-to: 6.8 6.5
Task-number: QTBUG-108228
Change-Id: I909196bd767e8d9e016069f1a59994d40e646e59
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4771dc308785ed132198b2c9a3200b7eb26d683e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-19 05:57:53 +00:00
Jonas Kvinge
dc4f7e3ffa QXRenderGlyphCache: Add QColor parameter for QFontEngineFT::loadGlyphFor
Fixes build after commit 39df9e1858a4115bc19b6a4dee5d687c5ee00d21

Pick-to: 6.8
Change-Id: Ice151b27591470ae81e07953f50e1abf9244ea28
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 55a4c6e9fcb364a899da7dcb4e18f76158e38bb7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-19 02:23:45 +00:00
Alexey Edelev
09590ee995 Fix the unsupported Q_UNREACHABLE_RETURN statement in constexpr functions
GCC 8.x does not treat __builtin_unreachable() as constexpr and
disallows using the Q_UNREACHABLE_RETURN macro. Guard the statements
with the respective checks.

Amends b0b34c56a99130bfc9c82cb006653ce6b8f0516e

Pick-to: 6.8
Task-number: QTBUG-125285
Fixes: QTBUG-132804
Change-Id: I88cdbe3bae1a336edc255e3e93e8d948bde253da
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit a57d5b1fd60b6b6848ef8ad9db237941229d7a23)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-18 07:17:52 +00:00
Tor Arne Vestbø
ee97f24ef4 macOS: Ignore stderr in tst_QProcess::terminateInChildProcessModifier
As we produce crash reporting via Swift on macOS 15 now.

Pick-to: 6.8
Change-Id: Iab4777b29bcaa66eff9d2f1de63072f5744d56df
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit dbfc3c9c381aa1cc0ab3cf5b758b38fb4499cb39)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-18 07:17:50 +00:00
Soheil Armin
8d97598e9c Android: Handle dotted URI QML Modules in Java code gen
A QML module can have URI that include dot character.
In this change, we refactor the code generator to create
the same hierarchies as a Java package structure. Each
QML module URI will be appended to the base application
package name to form a package that represents the QML
module as a Java package. Then the generated code of each
QML component will be placed in a single file.

This change, also refactor how to generated code should
be written in the file, by buffering the generated code
to a QByteArray first, and then flushing it into the
target file. We also create a marker file inside the
directories of each module, so that we can entirely
remove the directory and all its files before generating
new code during the next build.

Fixes: QTBUG-125891
Fixes: QTBUG-125970
Fixes: QTBUG-125971
Pick-to: 6.8
Change-Id: Iebce6495d9d29af32c3f1f97274c252444d2864e
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 68785b3e59c8a8f4a383051123b87af3d930ff18)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-18 07:17:47 +00:00
Soheil Armin
b141854d76 Android: Improve qmldir discovery of QML to Java codegen
Recursively find all qml modules, built by this project.
Later, the qmldir of these modules will be used to
generated to code.

The command line argument -i of qmldom tool had
to be replaced with -I. The -i was incorrect as it
expects the qmldir file while -I accepts a QML directory
to be included.

Fixes: QTBUG-125892
Fixes: QTBUG-125970
Pick-to: 6.8
Change-Id: I4099e488d3d7f4b79566e6ea19eca95f57f7c2fd
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 7ed88eb565d40b195aa868e67777872ef07a5ea2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-18 07:17:46 +00:00
Volker Hilsheimer
0246c56005 Fix doc warning
Amends 4d31372a869d6734258eb7c081375581b367759e.

Change-Id: I685a0687e8519f92602857a8259260e3b081864d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 5c783083f5cab0af577fea4dd71e1b3f1e7f5f66)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-18 07:17:45 +00:00
Ivan Solovev
7a579851c2 Provide docs for std::array QDebug streaming operator
Amends b294927a1270f7d0c5aaf0bbe93b617ac995e149.

Found in Qt 6.9 API review.

Change-Id: Iab64d52c506030dd755d61edc376bb47865478ff
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit b9a5a7852caf5c1296776351efa1781dbce04bbf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-18 07:17:43 +00:00
Ivan Solovev
65e70cec0b QCommandLineParser: convert MessageType to enum class
Amends bad618606d64e943e3fa78e7d1dbc8e1fab55480.

Found in Qt 6.9 API review.

Change-Id: I424fc1f80e36343f1aef4b05c551579ec0f04eba
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9a1a828ae535645f98d0ba9fc7c0c429097a2ac4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-18 07:17:42 +00:00
Jaishree Vyas
423659af18 Doc: Add setModel(open) option to the documentation
Changed the Model Dialogs section adding open() function.

Task-number: QTBUG-127777
Pick-to: 6.8
Change-Id: If5086f4e2226c4d032fe1bcfbf2ef550803973c8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 40f7454c919501f3c984c8fe4eeb379b360d4789)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-18 07:17:40 +00:00
Christian Ehrlicher
d5c3460b41 SQLite: Update SQLite to v3.48.0
[ChangeLog][Third-Party Code] Updated SQLite to v3.48.0

Pick-to: 6.8 6.5 5.15
Fixes: QTBUG-132862
Change-Id: If22497590dededc7b0c6f5dcc8d6d909f1e032a2
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit 952ec8db3a096ddb92e98e408dfe193168efa50a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-18 07:17:16 +00:00
Giuseppe D'Angelo
891c1815e8 QLoggingCategory: fix -Wundef
We want to test if QT_BUILDING_QT is defined, so use the right
construct.

Pick-to: 6.8
Task-number: QTBUG-132900
Change-Id: Iac26f70021a337a2c476618979b4b8eb180ffd3b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit fc4aff1249ffbb7a1b34df8a3b06c17aacb22308)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-18 06:32:09 +00:00
Giuseppe D'Angelo
4f8e1bf151 QTestLog: use the right preprocessor test for C++ features
Use ifdef, not if, otherwise we trigger -Wundef if the feature
is unsupported.

Pick-to: 6.8
Task-number: QTBUG-132900
Change-Id: I8a779da59bf2c7add14ace6405faf19b7ca48c28
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f04dfa8666662ddefa52a0bd1c8a60be361e4c00)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-18 06:32:09 +00:00
Shawn Rutledge
648dede46c QWindowPrivate::maybeSynthesizeContextMenuEvent: preserve spontaneity
Call QCoreApplication::forwardEvent() rather than sendEvent() to ensure
the QContextMenuEvent is spontaneous if the mouse event is.

Fixes: QTBUG-132873
Change-Id: I6198c2105210d2841f43ef81a9be0f917272846f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 97605760aec7bfe48a8642ba8677204efd9c46a5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-18 06:32:09 +00:00
Volker Hilsheimer
15a1b718e6 JNI: handle narrowing before creating a new Java string
Emit a warning if the string we get is too large for Java, and cast
the size to jsize before calling JNI.

For consistency, replace the Q_ASSERT in QJniArray's size check to use
the same logic.

Addresses header review comment; code was not handling this case before
it got moved into the inline helper either.

Change-Id: I00d68509be8b5f7304dda2e824fa0ced0f8f8d48
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 9d35561f6f6be125369e6020ce95a73b4aa6b51f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 21:55:10 +00:00
Bartlomiej Moskal
fdf4738be3 Android: Unblacklist textMargin test from tst_QLineEdit
Older devices may have lower screen resolution. In this case, the
hardcoded width may not work as expected. For example, all text may
not fit in QLineEdit.
This was the reason why the tst_qlineedit::textMargin test failed on
some Android devices (especially x86 emulator with Android API 29).
When the left and right margins were set to 20, all tested text did
not fit in QLineEdit. When we clicked at the beginning of QLineEdit,
we clicked on the second character of the text. The cursor was moved
to position 1, which caused the test to fail.

This commit updates textMargin test to make sure that tested text will
fit in to the QLineEdit.

Task-number: QTBUG-87417
Fixes: QTQAINFRA-6897
Pick-to: 6.8
Change-Id: I35352ac1e6f975e72d5c9638f8520f8ddd1d56ae
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
(cherry picked from commit 0a017308cca154b6f906c6e143fb33fe109316bc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 14:53:37 +00:00
Bartlomiej Moskal
4ae1b626ef Android: Unblacklist tst_QLineEdit selection tests
Using the left/right keyboard key will deselect the text but also
move the cursor. In this case, to be consistent with the test, the
cursor must return to the previous position. This allows to
unblacklist tests:
  - undo_keypressevents
  - leftKeyOnSelectedText

Task-number: QTBUG-87417
Fixes: QTQAINFRA-6890
Fixes: QTQAINFRA-6895
Pick-to: 6.8
Change-Id: I8a6d7cca332fe365ca820a67c23d9cd3fc36fc43
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 43f2fdc25cfd356292636ea1f8160cf62bab4018)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 14:53:37 +00:00
Eskil Abrahamsen Blomfeldt
5f98cc3ecd Add some additional debug output to font matching
The font matching process consists of multiple passes, so to help
us keep them apart, this adds some informative output to explain
where we are in the process.

Change-Id: I54f0712cc8600d2b1e1bf4b8688e2ae198e0453b
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit d2c8c12183a7f085643ee2d1fa7cd1677256b148)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 11:23:54 +00:00
Eskil Abrahamsen Blomfeldt
41698bb5c1 FontConfig: Don't register hardcoded fonts as color fonts
This amends 16850709306589a2433c0038605d365a6b6bedad. The patch
aimed to pass false for the color font parameter, but got it in
the wrong position, so it passed false for the pixel size instead.

The registerFont() function is a real mess, and it should be cleaned
up, but this at least fixes the immediate bug.

Task-number: QTBUG-132821
Change-Id: Id54989960aa5f86d3c79423d004530bb6a4fa475
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 0107e05e50761dd29a3d968baa9f502ade41e064)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 11:23:54 +00:00
Eskil Abrahamsen Blomfeldt
5441057cc1 Freetype on Windows: Detect system color fonts
For populating the freetype font database on Windows, we're using
GDI, which does not support color fonts. Therefore we were
registering all system fonts as monochrome, which was okay, because
our Freetype backend did not actually support the color font format
used on Windows.

Since 29a1c57183958b3951db4e7ba9504918a3caa761 we now support COLR
fonts, so they should be added with the correct properties.

Since GDI does not provide this information, we create a temporary
freetype face from the font file when resolving the family during
matching.

Fixes: QTBUG-132255
Change-Id: Ib62632de7fe8d9dc533abe4ae2368090a382cca7
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 81e596c24fc106439ce4135478a2d18d23fdbaac)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 11:23:53 +00:00
Soheil Armin
bbcf5a4191 Android: Fix incorrect JNI call from QAndroidItemModelProxy::sibling()
The return type of the QtAbstractItemModel.sibling() method is
a QtModelIndex Java type.
The JNI call from QAndroidItemModelProxy::sibling() is using
<jobject> as return type of QJniObject::callMethod(). This will
result in a non-matching JVM function signature.

This change replaces jobject with JQtModelIndex as the QtJniType.

Pick-to: 6.8
Fixes: QTBUG-132841
Change-Id: If157858f1ed49e25c8fbdfb9bb5c1fc2b7052826
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 190c85b706ee80bc92d6419676dca0dbfa60587b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 11:23:53 +00:00
Alexei Cazacov
813ea954b3 Docs: Describe QTextFormat::TextUnderlineStyle property
This commit describes the QTextFormat::TextUnderlineStyle,
TextVerticalAlignment, and TextOutline properties and their allowed
values

Task-number: QTBUG-126954
Pick-to: 6.8
Change-Id: Ib961331d9a06edb2bedf0a6b93afebef0cd467cb
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 0ec4447d7a535e1d593f3a5db94f0dcd98fe61ec)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 08:05:30 +00:00
Thiago Macieira
c804fc386b QMessagePattern: merge and improve %{time}-printing code
All modern compilers implement divisions and modulus via multiplications
and shift, so the codegen is practically the same (three multiplications
in total). But the new code allows more than 136 years of uptime (49710
days).

Drive-by fix indentation in nearby line.

Change-Id: Iea806bd7dfac1f852c66fffd41c2ac6660e7cc65
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 61924c622acc5afd1e01dd65702e09a063928c5f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 01:43:36 +00:00
Thiago Macieira
715ae29080 QMessagePattern: replace Q{Elapsed,Deadline}Timer with std::chrono
There's nothing wrong with those two, but we don't need the middle men
to the monotonic clock. This also reduces the sizeof QMessagePattern by
one quint64 (QElapsedTimer is 16 bytes in Qt 6).

Change-Id: I0eb171f03ee8f3a7148bfffd5534a7f3daba3a01
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 9dc294143d8fab498268f88c176b1af16de9b2ee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 01:43:35 +00:00
Thiago Macieira
5dc84d6a21 QCoreApplicationPrivate: move translation NSDM to improve packing
This way they aren't in the middle of a block of booleans.

Change-Id: Iba067f6f23db7c059cddfffdc27231dd09b6898e
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 4daed2877251b861ce9f7ee5a09dc035518e1d9e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 01:43:35 +00:00
Thiago Macieira
dc1a5ac3e4 QMessagePattern: add Q_ASSERT to setDefaultPattern() and improve codegen
Amends commit e04f109456bbcb184963b8ed71944b958b35c201.

This function does not free the pointers stored in literals, so add a
couple of assertions to indicate that it's only safe to call from the
constructor. And that being the case, we can update the tokens
unique_ptr in two steps, which makes the compiler not attempt to call
delete[] on the previous pointer.

Change-Id: Ibe76a7df795e9c6d6191fffdf45e3b3ef6f0f344
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit b86bcf5c25d0072300a8b0a4b5cfe942cabf53ad)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 01:43:35 +00:00
Thiago Macieira
0b0d6b6d36 QCoreApplicationPrivate: make the type member 8 bits
So it packs better with the booleans around it.

Change-Id: I330164b99fcbbf9e9629fffd52bcbb38bec4ac0e
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit ede95ef7e916ffb946878477938c304a5dc206d3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 01:43:35 +00:00
Tinja Paavoseppä
2bebec177d Android: Quit hosting Context only when app is entirely Qt
When quitting Qt, only quit the hosting Activity or Service if it's
primarily a Qt app, i.e. Qt is in the driver's seat. When using QtQuick
for Android, i.e. Qt is just a View, we do not want to forcefully quit
Activities, that is up to the app code.

Task-number: QTBUG-123711
Pick-to: 6.8
Change-Id: Ib98700be8693c3d30a296998b863b0f224c9bf69
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 3bcf55daa597888fcf0997e7ce2edd1d4c730a2a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 01:43:34 +00:00
Tinja Paavoseppä
fbc78ff287 Android: Do not start Qt app if it has already been started
Call startQtApplication() in QtView even if the Qt libs
have already been loaded, to make sure the app gets started
also when the Activity is recreated. Check whether Qt app
is already running inside the method itself to avoid hanging up
because of trying to start it twice.

Task-number: QTBUG-123711
Pick-to: 6.8
Change-Id: I3b009e4c2f40af9f258ce32b7e181c3faa21c194
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit be33f2d3233fb787d5251ba7d0876962efe49075)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 01:43:34 +00:00
Tinja Paavoseppä
35e027fb62 Android: Create new QtThread when needed
When we quit Qt in an Android app, we also quit the Java thread created
to act as the Qt main thread. This works well for normal Qt for Android
apps, where the lifetime of the Qt part and the whole Android app is
essentially the same. However, in QtQuick for Android Qt can be just
a part of the entire app, and the lifecycles are not directly tied.
Hence, we might want to quit Qt when the part of the app that has it
is not active, and restart it when the Qt part of the app comes
active again, and for this we need to create a new QtThread.

Set the QtThread variable to null when it has been terminated,
and if it's required again, create a new instance.

Task-number: QTBUG-130610
Pick-to: 6.8
Change-Id: I430e195fd319a20c9627ed98d6f30858cebc49c4
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 7c7b63f3e85436125baf2211bc5e10556736241b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 01:43:34 +00:00
Tinja Paavoseppä
41047e8b2c Android: Separate JNI initialization from JNI_OnLoad
Currently, we create references to Java classes and objects
in JNI_OnLoad. However, that is done only once, when the
Android QPA plugin is loaded, and in case we would like to stop
Qt entirely and then start it again, we want
to reinitialize all these things. Move these initializations to
a separate method, and call it before starting the Qt runtime and
app.

Remove the synchronization block guarder by m_mainActivityMutex
in QtNative.startApplication(), as it calls startQtAndroidPlugin()
which now will call activity() if the JNI needs to be
reinitialized, leading to a deadlock as that method is guarded
with the same object.

Task-number: QTBUG-130610
Pick-to: 6.8
Change-Id: I826dfb9b032a6c615f2408d484d1f4f0ea528d02
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
(cherry picked from commit 9f8e49360c33d5fb8e39322f3abe9544d38baae6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 01:43:34 +00:00
Marc Mutz
e54ece9dbb QSet: remove misleading bool comparison with 0
Q6Hash::remove() returns a bool, not an integer, like Q5Hash::remove() did.

Pick-to: 6.8 6.5
Change-Id: Ia2907c7a2a4177f9b5ad05ca1ef3b9a5baa8137a
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 441a96ba16794dc8621219be705800480654e9e8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 01:43:30 +00:00
Ahmad Samir
e26acf0f27 Replace qdebug.h include with forward-declarations in private headers
Only one header so far.

Amends 731538fdd469452e721b568fcbd808b437332008.

Pick-to: 6.8 6.5
Change-Id: I7449b4f91d8b44f4efab71d4d0fe259022d847a4
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 22ab256e37e34988bdd405782ad09bb3eed37bf3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-16 20:44:59 +00:00
Ahmad Samir
099fcbb56d Remove unused qdebug.h include from private headers
Change-Id: I03c951d03ab2410298878d0689c0d50bdd4eedf2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 9a1260e3f9fecf3d47cf4f3ad658becd752562f4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-16 20:44:55 +00:00
Liang Qi
a46cb99c69 widget: clear WA_OutsideWSRange when needed in QWidgetPrivate::create()
which follows the behavior in QWidgetPrivate::setGeometry_sys().

Pick-to: 6.8
Fixes: QTBUG-129698
Change-Id: Ia85e9470111eea9e3392cdf38c3da2db232ef065
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit def4f827da98d3027c86a8dae27811729767d36a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-16 20:43:43 +00:00
Volker Hilsheimer
ef2207ae48 API review: add revision and docs for QWindow::safeAreaMarginsChanged
Change-Id: Ie43915510449880bc5a054b9cea7fdd8f48db9b9
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 4d31372a869d6734258eb7c081375581b367759e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-16 20:43:36 +00:00
Thiago Macieira
37dbdd9b58 QCoreApplicationPrivate: use std::unique_ptr for origArgv
Change-Id: Id03feb55d3c3899aa4fffffdc0b3ee7b0742f9e8
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 981c2e8b746a9fb41164e6911d1609119bf1c600)
2025-01-16 12:42:25 -08:00
Thiago Macieira
b9e8a966ea QCoreApplicationPrivate: use NSDMI to initialize the members
This removes the need for #if in the initialization list and the ugly
whitespace-before-punctuation syntax.

Change-Id: Id33ec83e574360f65c9bfffd22b8cb450156477b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit f68df05a77afd58d60a80b16bd062d0e9e6d42a3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-16 20:42:18 +00:00
Ulf Hermann
a256dba802 Core: Remove duplicate QtPrivate namespace
The logging category macro already puts the logging category into the
QtPrivate namespace. There is no need to wrap it into another QtPrivate
namespace.

Fixes: QTBUG-132111
Change-Id: I99a7aa16662e3515c5f96d6736d47c1d0e45034c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 4f05eac0a88959ff0faa4d6b194d9dd8eeb3f4b6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-16 19:41:44 +00:00
Wladimir Leuschner
a2b68996b2 QWindows11Style: Make disabled menu item non-selectable
QWindows11Style inherits the stylehint policy for
SH_Menu_AllowActiveAndDisabled from QWindowsVistaStyle, although the
inactive selection is not visible. This patch makes disabled menu items
non-selectable.

Pick-to: 6.8
Change-Id: Ib59988cfad444f9f8203628d4b3e1f72d6775b46
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3f42d2baacf3d227a001e49d74ea97f7ab551ae1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-16 09:27:22 +00:00
Eskil Abrahamsen Blomfeldt
3780e0edc1 Support COLRv1 fonts in Freetype backend
COLRv1 fonts are not automatically rendered by Freetype, but
is currently gaining traction and the default emoji font on
Android 15 is in this format.

What we get from Freetype is a scene graph that we can render
ourselves. This patch implements a recursive renderer for the
graph.

One current limitations is that conical gradients are not fully
compliant with the spec. I have so far not been able to find
any fonts where conical gradients are used, so this is left
as a semi-supported feature for now. It's certainly not
needed for the Android emoji font.

Pick-to: 6.8
Fixes: QTBUG-130909
Fixes: QTBUG-131116
Change-Id: I2484743602ad16f01318ecd6de2b245b38a8f566
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 9e5887a5d4f2344aa5f62325be9d63ff3d8f18db)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-16 06:50:44 +00:00
Christian Ehrlicher
ce1a9d8bc9 WindowsTheme: Draw icon overlay manually instead of relying on the api
Fix drawing the link overlay icon - we must not set the device pixel
ratio here as we don't know the exact value.
Also fix some styling issues introduced with the previous commit.

This amends fd7bc16e9fbdc63bd22ba90d0c20b36ccffd2bae.

Pick-to: 6.8
Task-number: QTBUG-131843
Change-Id: I382527d17e8187bfae7cf40f352e6f87965671a1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit f4b64f9c12a6351008a08bfeb4540481edf9f1d0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-15 16:24:37 +00:00
Isak Fyksen
842f433471 Replace QPair/qMakePair with std::pair in qtbase/gui
Task-number: QTBUG-115841
Change-Id: Iebd96760ff7b3d7674816553312ba8dc3229c86a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit caf22e481d41d09d608cf1c94dfb740c419d81db)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-15 12:38:06 +00:00
Alexey Edelev
49bf0afdc7 Move qt_internal_sort_android_platforms to public android helpers
The function is used in semi-public API and should in
QtPublicAndroidHelpers.cmake.

Amends de40931eba2cf09a8c97c9a75c6d23c77748f44c

Change-Id: I3946ecb091584ac5406b3eb4d2024210398f26a3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit b0dc47aa447beaf4ab4bad39edeae06275c48f74)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-15 12:38:01 +00:00
Isak Fyksen
2b2271bea3 Replace all QPair/qMakePair with std::pair in qtbase/widgets
As a drive-by replace QList::append and operator<< with emplace_back,
to avoid repeating value_type.

Task-number: QTBUG-115841
Pick-to: 6.8
Change-Id: I6fb790f959b41b0feb49e3a0f0b6b3631e24a232
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 71d114588d9312e89195a32357ec402fc22b062e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-15 12:37:49 +00:00
Topi Reinio
562e74e3b4 Doc: Modify \tabcontent..\endtabcontent macros
QDoc markup following the \tabcontent macro should start a new
paragraph. As HTML-specific macros are injected directly into
the output, QDoc's doc parser is not aware that the macro should
start a new paragraph.

Turn the macros into generic, non-format-specific macros,
expanding to \div and \enddiv commands that wrap the tab
content.

Pick-to: 6.8 6.5
Change-Id: Ie8313af391b1a38ef74592acac3198fef5b7b310
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
(cherry picked from commit 5c0b08a20dd14f7fd8632495aa911fe427f58f7f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-15 12:37:46 +00:00
Alexey Edelev
697b769360 Small _qt_internal_find_tool_dependencies optimization bit
Set __qt_${target}_find_package_args once per the
_qt_internal_find_tool_dependencies call. It doesn't make sense to call
set it in loop, since variable doesn't depend on loop parameters.

Pick-to: 6.8 6.5
Change-Id: Ia1024625b870364a1db8e07f61bf7ea6ab4e9f84
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 80932ed80b5ec809b42be63c8f719290da56f288)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-15 12:37:43 +00:00
Giuseppe D'Angelo
3fda22bd8a Tasktree: fix FTBFS due to unique_ptrs on forward-declared classes
Some classes have circular dependencies:

* RuntimeIteration depends on RuntimeTask
* RuntimeContainer depends on RuntimeIteration
* RuntimeTask depends on RuntimeContainer
* TaskTreePrivate depends on RuntimeTask
* RuntimeContainer depends on TaskTreePrivate

Although there are a few std::unique_ptr deployed, the code at the
moment does not fully solve the problem: the classes have an inline
destructor, and the dependency has only been forward declared, resulting
in a build error.

Make some destructors out-of-line, and define them (as defaulted) late
enough so that all the graph of classes has been seen, in order to fix
the build.

Pick-to: 6.8
Change-Id: If150b92154061e915ebac920806717d2288c0638
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
(cherry picked from commit 71e53405a309684e4adcb8669a5f3d04319ad767)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-15 12:37:32 +00:00
Cristian Le
1ae6883162 Fixup: Add *_check build targets for auto cmake tests
- `PARSE_ARGV` should have been 1.
- `module_includes` target needs to be unique
  See gerrit comment of previous change, and
https://gitlab.kitware.com/cmake/cmake/-/issues/26580

Amends: 8f2f4ad4688df4963982c489c80b84e115cda29d

Pick-to: 6.8
Task-number: QTBUG-98640
Change-Id: I82b85813f282ba1d5b4c938e59558e32647d4d86
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 9f805b5bf7dc61a032a7ec79fd514c932103f1de)
2025-01-15 13:37:25 +01:00
Cristian Le
566db56dd3 Add *_check build targets for auto cmake tests
Similar `*_check` targets are created in `qt_internal_add_test`.
This change extends that implementation to auto cmake tests.

Note: These generated targets do not have additional dependencies, on
the build targets, unlike those generated by `qt_internal_add_test`.
You would need to (re-)run the build first separately and then run the
`*_check` target.

Fixes: QTBUG-98640
Pick-to: 6.8
Change-Id: I387f09570b6a4a345756133870c2eb9ef1cf3cf8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 8f2f4ad4688df4963982c489c80b84e115cda29d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-15 13:37:24 +01:00
Alexey Edelev
bead73f2f3 Fix restoring of CMake environment in _qt_internal_execute_proccess_in_qt_env
Use the correct variable name when restoring the environment.

Amends e388c1caeb1ccdb88b9a9801be9cd6328d8a7987

Task-number: QTBUG-128420
Pick-to: 6.8 6.5
Change-Id: I03ee3481a4638969edd75ce6ad233e8a94d5c563
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit ccbec262c220cbe990a68611e39dca9662b71777)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-15 12:36:49 +00:00
Ahmad Samir
11f94598da Replace qdebug.h includes in public headers with forward-declarations
qdebug.h includes many Qt and STL headers, so if you include a Qt header
you get all those transitive includes, which may affect build time.

- Where appropriate use the printf-like syntax of qDebug() and co.,
  these don't need the QDebug streaming operators
- qfloat16 is used in an inline member function, so include it
  explicitly

[ChangeLog][Potentially Source Incompatible Changes] Various Qt public
headers don't include QDebug any more; if you need QDebug's streaming
you'll have to include it in your code.

Task-number: QTBUG-132439
Change-Id: I750587e17a3b38fa226cd3af8eaccc8da580f436
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 185cba6e95a006d2548f20599f84390e5a3ad653)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-15 11:28:28 +00:00
Michał Łoś
1a98e24d0c Skip QResourceEngine cleanupTestCase on VxWorks
COIN is using patched std::optional header for VxWorks, which is based
on 23.09 version of this system, and fixes few compilation and runtime
issues, unfortunately it introduced runtime error as well. This error
causes std::optional to not destroy contained object in destructor,
which is a source of fail in tst_QResourceEngine::cleanupTestCase().
This fail was quieted down using QEXPECT_FAIL for VxWorks, due to exact
reason being unknown at the time.

It was found out that unpatched version of std::optional header in
VxWorks 24.03 fixes most of issues found in 23.09, so there is no need
to use old header. Additionally it cleans contained object in destructor
properly, so this is the one that should be used. In order to use it,
COIN will need to refresh VxWorks images, but this in turn will fail
this test with XFAIL.

Replace QEXPECT_FAIL with QSKIP in tst_QResourceEngine::cleanupTestCase
for VxWorks, update comment accordngly.

Once unpatched optional version from VxWorks 24.03 will be used on COIN,
skip will be removed entirely.

Task-number: QTBUG-130069
Change-Id: Ib446d04b2fabb027dad7af909ac00b7b30e76b53
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit a10acaca0887541207ad5607680d7864d317cf4b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-15 10:24:22 +00:00
Assam Boudjelthia
c465681a86 Android: use the correct ABI folder to load uncompressed libs
It's possible that the first ABI from Build.SUPPORTED_ABIS would return
an ABI that's not packaged in the APK, for example if an armeabi-v7a APK
is run under the device supporting arm64-v8a, in that case the returned
path would be that of an arm64-v8a while it's not actually packaged
inside the APK.

Fixes: QTBUG-132155
Change-Id: I0f311accee246fa2d1d0b8aaf424d034b4b2d04c
Reviewed-by: André Klitzing <aklitzing@gmail.com>
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
(cherry picked from commit a5f80b4732d33dd36414a6ffbd49a9efc7c87a0a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-15 00:11:09 +00:00
Eirik Aavitsland
d968aacde1 Update bundled libpng to version 1.6.45
[ChangeLog][Third-Party Code] libpng was updated to version 1.6.45

Pick-to: 6.8 6.5 5.15
Change-Id: I8e3f7c889608e8071888239ed0b6003911d1a39f
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit fd6f593c7ffb67566b8efbe1b657dd7824f3b9e9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-14 22:56:24 +00:00
Edward Welbourne
ee65d651a4 Add tests that zh-TW now correctly prefers zh-TW over zh translation
The bug, QTBUG-121418, was actually fixed earlier by commit
84afaafc9c6968dd76fcadc5392065d340543521 (or, for 6.8, commit
8c40e8cf12bb931149367677c56816864265249c), but escaped our attention
at the time.

Fixes: QTBUG-121418
Pick-to: 6.8
Change-Id: Ie24eb172674189079aede7a39584ea760aac1b0c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 12f8ebf5cbdc9089564a93001926d20908bd1785)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-14 22:25:02 +00:00
Ahmad Samir
6d0f277a40 Every private header should include at least another private header
To get qversiontagging_p.h included. See:
https://codereview.qt-project.org/c/qt/qtbase/+/494388/comment/fed896c4_9e7cae6e/

Pick-to: 6.8 6.5
Change-Id: Ifcc7f9cb0ed57f1af9d3283309498546a81fbb17
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 16fc1e07784e294cdd75bbab216c2479ae171221)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-14 17:57:56 +00:00
Giuseppe D'Angelo
c82464ea75 QShortcut: fix build under QT_NO_CONTEXTLESS_CONNECT
QShortcut has a constructor that takes a _parent_ object and a
function to invoke, and it will internally connect its activated()
signal to that function. This connection will not provide a
context object (the parent is not used to this purpose).

Given it's not clear what the context should be if any (the parent?
`this`?), I'm not at ease at just supplying "something" as the context.
Instead, hide the constructor if we're under QT_NO_CONTEXTLESS_CONNECT.
There's another constructor where the caller can supply a context.

Change-Id: I21befcc86eeb07e65eadee1222757ecc5bab1d2c
Pick-to: 6.8
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ade3bb1c5224a9155a2a2f965fa70740aa9ec8a7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-14 17:57:54 +00:00
Eskil Abrahamsen Blomfeldt
37c389c779 Implement COLRv0 support in Freetype engine
COLRv0 fonts are both scalable and in color, which was not
previously handled in the Freetype backend because it only
supported color fonts with embedded bitmaps. This patch
simply correctly detects the scalable color fonts and
render them through the same mechanism as other color
fonts.

[ChangeLog][Freetype] Added support for COLRv0 format color
fonts.

Pick-to: 6.8
Task-number: QTBUG-131116
Change-Id: I290e7525c24b4cf2ec872a366e5193f54712a3a4
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 39df9e1858a4115bc19b6a4dee5d687c5ee00d21)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-14 14:16:58 +00:00
Giuseppe D'Angelo
72d0b8f709 QStringConverterBase: make it move-only
The class declares a protected destructor, which interferes with the
RO5. The only subclass in qtbase is move-only; QTextCodec (in
Core5Compat) is not even movable.
Make QStringConverterBase move-only as well.

Pick-to: 6.8
Change-Id: I20d16df79f7ad8e7e7a8af339954cfa2d1482e96
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit eb533c81b8aa55f89605bb1d091afe4df4db763c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-14 12:34:56 +00:00
Piotr Wiercinski
f7efdfac36 wasm tests: Add option to run Chrome in headless mode
Running Chrome in headless mode helps to circumvent
a lot of issues with GPU driver/Wayland interactions
that we encounter in CI.
Run Chrome in headless mode if corresponding environment
variable is set.

Change-Id: I1cf290f484054766e2b99d99045e7b39d5662210
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Even Oscar Andersen <even.oscar.andersen@qt.io>
(cherry picked from commit 213a2610d821b93429d6519dda11ab0e7b5cae84)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-14 12:34:54 +00:00
Ahmad Samir
92afa1eaf8 network/*/removed_api.cpp: include qdebug.h explicitly
Since the removed API uses QDebug. Requested in code review.

This is needed for a subsequent commit (removing qdebug.h from public
headers when possible), but I split out to its own commit to ease
backporting.

Pick-to: 6.8
Change-Id: I76980634b9ebbae7cf010d99f5095aa94a825824
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit c0fcb2db242a40cdcc2bbfd00332390b64cab439)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-14 12:34:52 +00:00
Jøger Hansegård
99d401220c Compare QUniqueHandles using comparesEqual and compareThreeWay
This fixes an issue where comparing pointers to object is only defined
if both pointers point into the same array.

Task-number: QTBUG-132507
Pick-to: 6.8
Change-Id: Ib7ccb30001add38ad25b62c848a01cd53566d8bf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5dcdeeebbc08be8845cdb5a0e586b7a864b7f16f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-14 07:20:13 +00:00
Mate Barany
3fa33cf1f1 Update qtimezonelocale_data_p.h with correct CLDR v46 data
The data for the CLDR update was generated from an incorrect xnr.xml
that has contained an extra &lt; and hence the generated
qtimezonelocale_data_p.h is also incorrect.

Update qtimezonelocale_data_p.h with the correct CLDR v46 data.

Task-number: QTBUG-130877
Change-Id: Ibc87e137b1519be470704ed519c0988333625af5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 95abc38ba6e586c8e491593ebe4c4b4ee32a79e7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 23:40:00 +00:00
Giuseppe D'Angelo
25296f86d6 QListSpecialMethods: honor RO5
This looks like another case of a base class with a protected, defaulted
destructor, which interferes with RO5. Explicitly redeclare the other
special member functions in order to suppress the warnings coming from
the deprecated copies.

Pick-to: 6.8
Change-Id: Icf8c8817ef001d0503683d071c4f004db64caa2d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit f6e99f347d243749af8d9beacd7c68852f0ff636)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 23:08:27 +00:00
Giuseppe D'Angelo
ac7ff59b6a function_ref_base: honor the RO5
I'm not entirely sure why function_ref_base declares its destructor. I
guess it's declared in order to make it protected, because the class is
non-polymorphic and inherited by function_ref, and one may want to avoid
slicing. On the other hand, function_ref_base is an implementation
detail, living in a `detail` namespace; so that sounds very unlikely.

In any case, the class is clearly meant to be copiable, so add back
(as protected) the missing special members.

Pick-to: 6.8 6.5
Change-Id: Ibf909e1746e65eecf8b8990839a6e4c9eb56ca13
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 74b875641f40b15a4a59a0c55cd79c251b49c05e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 23:08:21 +00:00
Marc Mutz
8c8dfce81e q(v)snprintf: fix a typo in the deprecation warning
Found in API review.

Amends afd0bb28fbac6d4c24c6785bff9c72bd56eaceb4.

Change-Id: I694dfc3f16ea90bca07a47c1d57ba1cf21b23f1a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8e75e1c1852fee22982cebe1f02cfeff4699aafe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 22:49:59 +00:00
Christian Ehrlicher
b7e0a7bfde Windows11Style: adjust size of flat buttons
Flat buttons were larger than normal buttons - therefore also add
marginsRemove(QMargins(2,2,2,2) for the flat case too.

Pick-to: 6.8
Task-number: QTBUG-132433
Change-Id: Id010d45bf85c5d7d09ff8db8bda44b1be7d85297
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
(cherry picked from commit a930fb758d71ef6bf353e8fd8078de2335c32085)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 22:49:58 +00:00
Ahmad Samir
936992c404 Remove unused qdebug.h includes
Change-Id: I09ad5987bde71ca37c7869c4dd63fb4f41c707ea
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 8a2cb53b3710b333653bea5554713b84e3980fdc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 20:27:15 +00:00
Ahmad Samir
27f16490fa Include climits explicitly instead of relying on transitive includes
Pick-to: 6.8 6.5
Change-Id: Ib55b337aa6e0a93c7ac7ee9bf492784cc81808d7
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 158f2c95c8b69f586bd1155fc5993bdb61f76e77)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 20:27:15 +00:00
Tor Arne Vestbø
33b0661cc6 tst_Q*Application::runHelperTest(): Run test without activating app on macOS
As that will steal focus from tst_QApplication, which is needed for
subsequent tests.

Pick-to: 6.8
Change-Id: I5720c4a2bb45f98894616e01da10b9c40a2b6735
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8de8800670d2881c6dfe957d6a1c5d925417b85c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 20:27:15 +00:00
Piotr Wierciński
06ab82d945 wasm: Add helper for pluging preloads
Dynamic linking on WebAssembly involves preloading .so libraries
during startup of application. Normally, those plugin preload
lists are generating manually by user, which can be tedious.
Add a bash script which demonstrates how to call python
programs to generate preload lists.

Change-Id: I0a9869ad0d26606f8b33af2c38248cec3088dd0d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 010ed1788402bf98d9b98500fdb1f61c333cebe5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 20:27:15 +00:00
Tor Arne Vestbø
e50b0337e9 tst_Q*Application::runHelperTest(): Disable CFLog spam on macOS
Otherwise the "+[IMKClient subclass]: chose IMKClient_Legacy" log
spam will break the test.

Pick-to: 6.8
Change-Id: Iccfb46204394bbc1b084de4b1e7b2f1ea6b4f05b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f411ac4752b3ab77f6ce44f005af558ccf1dd503)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 20:27:14 +00:00
Ivan Solovev
652fe10689 Use [[noreturn]] on QCommandLineParser::showMessageAndExit()
... instead of Q_NORETURN, as the attribute should be unconditionally
available since C++11.

Amends bad618606d64e943e3fa78e7d1dbc8e1fab55480.

Found in Qt 6.9 API review.

Change-Id: Ia008acf0777867f551c7e1cc3423f29f8ed6fbed
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8472004a895fa98e68f6f3ff134720904a00c150)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 20:27:14 +00:00
Edward Welbourne
cf9e8434eb Remove constexpr from a function that doesn't need it, and asserts
The call to q_assert() isn't constexpr, so can't happen in a constexpr
function. Most compilers shrug this off as they can see the code
actually is unreachable, but apparently debug builds on QNX can't work
that out. Since nothing actually needs the function to be constexpr,
remove that qualifier. In the process, move the offset-case, which is
also unreachable, to the end of the switch, closer to the unreachable
end of the function (since I failed to spot that there were two
unreachable parts at first).

Pick-to: 6.8
Fixes: QTBUG-132698
Change-Id: Ibdde7abd91d284e1c1af53e2b5e142fc234400a8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 2578d72a7cb9b784a00efb04df6a31496d92dcdc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 16:56:38 +00:00
Moss Heim
aa494a4de7 CMake: Fix typo in comment
Pick-to: 6.8
Change-Id: I6151bd27d5310ac153c7c2c8fbb97a9de68a4f01
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 21bd32b2cc8995d8624cd0fea6f6685827c741c1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 15:38:58 +00:00
Volker Hilsheimer
e09afd3cc0 QFontVariableAxis: add debug stream support
Was missing from this new value type, and is quite useful for this type.

Addresses API review comment.

Change-Id: I07ea7ded7f963b2032c377f024bb88e9d54a4d5c
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit b562c36a9a7be5f62a8e79b93c9728381775f460)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 15:38:57 +00:00
Thiago Macieira
b7711eb94c Bootstrap: remove QSystemLibrary and QWinRegistryKey
They're unused.

Change-Id: I781690cca811cdbab757fffd30b64fccb197ef46
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 2d2cba103f1b0ed3151660aadd8c717c172207e7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 15:04:36 +00:00
Soheil Armin
2b14b70b43 Android: Fix synchronization issue of QtAbstractItemModel and its proxy
Java methods of QtAbstractItemModel may get called from Qt GUI thread or
Java main thread. Situation is the same with internal proxy methods,
where they may directly or indirectly called from these two thread.
At the same time, a chain of calls may happen from these threads, so
some functions may get called indirectly from a single caller thread.

In this change, we are adding a map of QObject* to QRecursiveMutux
where the QObject is a QAbstractItemModel, either the proxy instance
or a reference to an underlaying QAbstractItemModel when the model
is implemented in C++.

Each call to any function locks the QRecursiveMutux instance associated
with the QAbstractItemModel instance. A connection from
QObject::destroyed to a lamda, helps to remove the map entry when
the model is destroyed.

Pick-to: 6.8
Fixes: QTBUG-127467
Change-Id: I18dcdc207e201b3883526648b4e672e5868ed8ab
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit bf76387507dde71063ebe484bce1e7d1b8e09bc2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 13:14:58 +00:00
Ivan Solovev
be31cbfce8 QThreadStorage: move includes to the top
The qthreadstorage.h header contains two implementations controlled by
the QT_CONFIG(thread) definition.

Commit 8553ffd8d147ecf6a713d12a360027b477dd59c8 changed the positions
of the namespace macros in the header, but didn't consider the fact
that we now include std and Qt headers inside QT_NAMESPACE in the
!QT_CONFIG(thread) case.

Fix it by moving all the includes to the top, and wrapping them in
the needed QT_CONFIG() checks. As a drive-by, drop the unused
type_traits include.

Found in Qt 6.9 API review, but picking down to 6.5, as that's what
the original commit did.

Note that 6.5 cherry-pick will require to replace <memory> with
QtCore/qscopedpointer.h because
6da1f72311b844b2232da3067ad6e1e24614e67c was never picked to that
branch.

Pick-to: 6.8 6.5
Change-Id: Ic9c5fe82df38a3bd64829c016de8dcbd9f060315
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4a6ef7fc6881c7b5ab0b9f6d51a2738ce86cca93)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 11:48:35 +00:00
Ivan Solovev
fb1d47b93e Do not export QFontVariableAxis wholesale
This is a non-polymorphic class, so explicitly export only the
out-of-line methods.

Amends cc128d802c6d9c87a1e00a8a88d5e6590a7195f4.

Found in Qt 6.9 API review.

Change-Id: I30af1121bce1ba9c57cb326cffb1375ac3b22195
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 5f7149e3590e3c2e829f5a843feebe357c42ca67)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 11:48:33 +00:00
Wladimir Leuschner
840cf0a43a QWindows11Style: Increase QComboBoxSize and align subline
Increase the size of QComboBoxSize and align the subline for editable
QComboBoxes with the begin end end of the rounded corners.

Task-number: QTBUG-132261
Pick-to: 6.8
Change-Id: I235ec1ceb94a5e87f373b007ac31d0d8a83cf600
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 23c16c611cfeee55ce38e928989b346c697270b0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 05:32:03 +00:00
Wladimir Leuschner
f8adee805b QWindows11Style: Decrease bottomline frame thickness for QToolButton
Decrease the bottom line frame thickness for QToolButton by using
fractional coordinates.

Task-number: QTBUG-132261
Pick-to: 6.8
Change-Id: I77a3acdd20c694dce38d809db9c3051949a98fa3
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 3e9baca7d2197bfc10d20de6f326e2749a8f781e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 05:31:45 +00:00
Marc Mutz
2c4756af80 QDebugStateSaver: port from QScopedPointer to unique_ptr
In preparation of adding QT_NO_SCOPED_POINTER, which would be rather
pointless for users if public headers continued to mention the type.

Pick-to: 6.8
Task-number: QTBUG-132213
Change-Id: Ib5a40a1b8defe1cfe858218bb25c422f900dfe6b
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c5a4e3f790eb4157e33eac2402110f71a76a5418)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 00:43:44 +00:00
Marc Mutz
cddddd753c QSpan: don't detach Qt containers
When converting an implicitly-shared Qt container to QSpan, the QSpan
ctor would call .data(), which detaches said Qt container (if it's not
const). This is what must happen for mutable spans (QSpan<int>), but
is not necessary for non-mutable spans (QSpan<const int>).

Fix by copying the potential const from QSpan::element_type to the
Range object in the resp. QSpan ctor. This makes a QSpan over a const
element_type mark the range const before passing it to adl_data() (=
member-data()). For a non-const element_type, nothing changes.

[ChangeLog][QtCore][QSpan] No longer detaches implicitly-shared Qt
containers converted to QSpan<const T, N>. Note that std::span<const
T, N> will, however, detach such containers, so we recommend to use
std::as_const() with implcitly-shared Qt containers, as always.

Fixes: QTBUG-132133
Change-Id: I9fdae20994d2c900bc5b45b44db3901d10f8838a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 287234704b57e171c786ba8df0b93c49edb903c5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 00:43:42 +00:00
Giuseppe D'Angelo
37a553a3a5 QException: honor the RO5
QException has an out-of-line destructor in order to pin its vtable.
But like any std::exception subclass it's meant to be (and effectively
is) copy-constructible and copy-assignable (cf. [exception]/2).
Add the missing copy operations, and the default constructor.

One may argue that this class should use some other approach since it
also has a polymorphic clone() -- for instance disable assignments and
make copy constructions protected -- but that ship has sailed.

This prevents a Clang warning about the deprecated copies in the
presence of a user-declared destructor.

Change-Id: I4d8613ade265ea85a5a7e97255b75b7fcf3e5a27
Pick-to: 6.8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 793309693aac24e7f88fc225408d92def638996e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 00:38:20 +00:00
Thiago Macieira
6ce164b3e0 QThread/Unix: move the pthread_key to a file-scope static
So that the pthread_key is destroyed much later than now, at QtCore
unload time instead of a bit earlier in exit(). That's important so it
runs later than the Q_DESTRUCTOR_FUNCTION for QLibraryStore
(qlibrary.cpp), which is what unloads plugins, whose unload-time
destructors may be attempting to quit() & wait() for their worker
threads.

I had to keep the destruction of the exiting thread's adopted thread
where it was: a function-local static's destructor. As noted in the
comment added by 1da7558bfd7626bcc40a214a90ae5027f32f6c7f, we need
QThreadData::cleanup() to run before the libraries start to unload
because we need to delete the event dispatcher.

Init priority 10 will place it after the QHash random seed and qsimd
initialization, on ELF systems and on Windows. On other systems (incl.
Apple ones), the order probably depends on the order of the files in the
CMakeLists.txt. I thought that would mean the destructor for thread/
would run before plugin/ but that apparently is not the case. But that's
fragile.

Amends 1da7558bfd7626bcc40a214a90ae5027f32f6c7f, which amended other
things...

Fixes: QTBUG-132697
Task-number: QTBUG-102984
Task-number: QTBUG-132381
Pick-to: 6.8
Change-Id: Id7263d6ffe7a5949cd84e35d942ad0e02df1b455
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 2f69a05bd0cd7ce63890f709ff3ed7a4f78acd70)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-12 17:40:00 +00:00
Thiago Macieira
ea6d467c05 tst_Q*Application: add tests for unusual qApp creations and exits
This commit adds one unusual creation and three more unusual exits:
* creation of the Q*Application in a thread (QTBUG-130895)
* exits using ::exit() instead of returning from main():
  * from the main thread's event loop
  * from an auxiliary thread
  * from inside an auxiliary thread's event loop

All of these exercise the moment the QAdoptedThread & QThreadData for
the main thread is destroyed, which are, respectively:
* thread exit time, running thread-specific destructors
* inside exit(), running atexit()-like callbacks (qthread_*.cpp)
* [tst_static_q*application] inside exit(), running static destructors
  (added in commit 1da7558bfd7626bcc40a214a90ae5027f32f6c7f)

Unlike the tst_static_q*application tests, the calls to ::exit() cannot
be a regular QtTest because that would cause the log output to be
incomplete. The threaded Q*Application could be a test of its own, but
since I needed to add the helper anyway, I chose to add the test there.

For the majority of the tests, the failure mode is going to be a crash
on exit.

Task-number: QTBUG-12673
Task-number: QTBUG-132429
Pick-to: 6.8
Change-Id: I1062ef500356bd97dd0cfffda4aeeda9afa138e8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit bfbd1a281dd00c47df315c06e895bf5d53cd8764)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-12 17:40:00 +00:00
Christian Ehrlicher
2bb83f6b16 QIcon: don't search for high-res svg icons
There is no need to search for high-res svg icons - a svg scalable by
design. Also the QSvgIconEngine does not support it.

Pick-to: 6.8
Change-Id: Ib76c887900ce77268e9c0253cb697b8de9e7f10e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c64774eef72411029f7c2fb611328f25b83ff8ca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-12 09:05:44 +00:00
Tor Arne Vestbø
197a46313d coin: Ignore exit code of LastTest.log copy if COIN_CTEST_IGNORE_EXIT_CODE
If COIN_CTEST_IGNORE_EXIT_CODE is in effect and ctest aborts for some
reason (for example due to the workitem being cancelled) the ctest exit
code will be ignored, as expected, but we will not have a LastTest.log
to copy, which will fail the workitem unexpectedly.

We now match the ignoreExitCode of the LastTest.log copy with the ctest
run.

Change-Id: I9df0f863a42dd4cf25cee1694e85cb32058a4e5b
Reviewed-by: Toni Saario <toni.saario@qt.io>
(cherry picked from commit 0e2067334d58787464a3554730042dba37413c6d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-11 14:02:54 +00:00
Marc Mutz
58221c1955 QTemporaryFile: fix incorrect info about duplicate placeholders
The docs said only the first placeholder would be considered; in fact,
it considers only the last.

Fix the docs and add a test (also for QTemporaryDir).

Amends b4bb4449aea7592afdb9b9134bb90c40fe29735a.

While 6.6 and earlier are unaffected by the incorrect documentation,
pick this to all active branches in order to verify the behavior is
the same everywhere.

Pick-to: 6.8 6.5 6.2 5.15
Fixes: QTBUG-132597
Change-Id: Ia7a37f714f834191b07420d31ca9024702b537cc
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit e7abbc7bf3ab06359b2847b1e1a46c38d8bc6581)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-11 08:48:30 +00:00
Alexandru Croitor
0cb2413219 CMake: Fix sbom git vars not being available in various scopes
Initially the git vars were assigned to the parent scope of the
_qt_internal_sbom_begin_project function, with the intent to set them
in the global scope. But the function was later wrapped in other
functions, so the variables stopped being accessible.

Instead of playing with recursive PARENT_SCOPEs, save the variables in
global properties like we do for other info, and use a new
_qt_internal_sbom_get_git_version_vars() function to query the vars in
the code that needs them.

This fixes generated purls to contain the git version and hashes.

Also add a new internal API wrapper macro called
qt_internal_sbom_get_git_version_vars to allow calling it
in other repos.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I061b34f418c1ecc1c66c8c01ef758d2f40611ede
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 41a92bf6f1486259ef25db775520cba647e1cc15)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-11 08:48:30 +00:00
Alexandru Croitor
65b1756d01 CMake: Split SBOM implementation into separate files
The SBOM implementation got somewhat large. Split the code into
several new QtPublicSbomFooHelpers.cmake files, to make it more
manageable.

No code or behavior was changed.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: Ia0ca1792eec21d12c4bb4cabe63279e1f5c07e3d
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 27d2b54b5d2bc5a69edc2de703b2ca34cb2637dc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-11 08:48:29 +00:00
Christian Ehrlicher
3536eb32bf QStandardItem: correctly set model during insertRows()
When calling insertRows(), the model of the child items was not
correctly updated. insertRow() is behaving correctly.

Pick-to: 6.8
Fixes: QTBUG-131372
Change-Id: I8b6aef7ab97887c6eb46eb21b992d76e4d59b3a0
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 5bab8448feb2661f871e71d71a95afaffcb1656a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-11 08:48:29 +00:00
Marc Mutz
3660ff9ff8 tst_QSaveFile: QVERIFY the commit() return value in symlink() test
It's kinda is important to verify that commit() worked; all the
follow-up tests assume it, so wrap the calls in QVERIFY().

Amends 7e5e7eeaa1418d959906cdf9d717c984c9fc7a7e.

Pick-to: 6.8 6.5 5.15
Change-Id: I01185d65a5ec06ed122e59c43d9cdcc3a7157259
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 97fe38ff0d1e60f92c0bfa6fb3571a0433e60352)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-11 00:04:16 +00:00
Marc Mutz
b2dad9724d tst_QSaveFile: mark a QString const
To ensure we don't overwrite it in this quite long function.

Amends 7e5e7eeaa1418d959906cdf9d717c984c9fc7a7e.

Pick-to: 6.8 6.5 5.15
Change-Id: Ie5f81b50d2d66ba9e064810f8cbc1a7af298cc2b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 67a906b5564a1ccf03e547aa78fc6fd910d9cd15)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-11 00:04:09 +00:00
Marc Mutz
ab9021e2d6 QSaveFile: mention that you need to setFileName() before open()
... in the descriptiong of the (QObject*) ctor.

Pick-to: 6.8 6.5 5.15
Change-Id: I1b8a788eff1fbb50134b51de7d9ee8f7cb2af785
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6397dac97962e40104e6a94bc147e093af8186e2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-11 00:04:03 +00:00
Alexandru Croitor
3ee0cb32e0 CMake: Fix LINK_LIBRARIES not being properly processed for SBOM
There was a typo in the link_libraries variable name, where an upper
case 'L' was used instead of a lower case 'l'.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I206a161107cf7510856ad8740dada88e12341e94
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 2affe46b2543f7d2de1939e049a0d783b5a7dcfb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-10 17:30:19 +00:00
Alexandru Croitor
7d0b4be42d CMake: Fix purl variant list iteration
The correct syntax is IN LISTS, not IN_LIST.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: Ibf64e48ffcf0b061887b7b015096d588b14bce57
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 4c5d9a3ca339f36f10922f9b1d5849fca1f2bdc4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-10 17:30:19 +00:00
Tor Arne Vestbø
b07580da56 macOS: Completely disable lldb backtraces in QtTestLib on Apple Silicon
They result in lldb hanging, which was previously only a case when SIP
was enabled, but can now be reproduced on macOS 15 even with SIP disabled.

 https://github.com/llvm/llvm-project/issues/53254

Pick-to: 6.8
Change-Id: Ifa09f8cf22522b5a1028db1f250ebe9e1543cf9d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 50d5914f28b535790f8eca6210adad24fe76940b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-10 14:49:26 +00:00
Tor Arne Vestbø
b04935ed9f macOS: Enable crash reporting for tests via Swift
Swift 5.9 includes built in crash reporting, printing stack traces,
libraries, and registers to stdout/err.

https://www.swift.org/blog/swift-5.9-backtraces/

As (Core)Foundation is written in Swift nowadays, we get this feature
for free even in our "C++" apps, as we always link to CoreFoundation.

To enable the feature the binary needs the com.apple.security.get-task-allow
entitlement, so we add it for all our tests automatically.

The final piece is to run the tests with SWIFT_BACKTRACE=enable=yes,
but we'll do this in our CI provisioning, as setting it from within
testlib doesn't seem to work.

Pick-to: 6.8
Change-Id: I31090efee06460f45522093e17f900e76590b282
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 9bebdc97f161cc58461530fa0171e0defc6cc1ee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-10 14:49:24 +00:00
Ivan Solovev
0db648ba3b QMetaEnum::valueToKeys: fix REMOVED_SINCE version
Should be 6.9. The entries in removed_api.cpp are already added to the
correct place, just the macro in the public header used wrong version.

Amends d41b87e06742b491c4e36aeae32e03f85b078d69.

Change-Id: I88749dbeb070206c42feb4ffc504f260f8857823
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit da799c20d763b5534152dca52fef12fda875acc2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-10 14:17:26 +00:00
Ivan Solovev
5e84f22a0a [docs] Fix a typo in the QColorSpace class name
That prevented qdoc from generating the docs for the fromPrimaries()
function.

Amends bde2292247bf4849852355c0dcc71f97c9daace9.

Found in Qt 6.9 API review.

Change-Id: I2f5c57a4dc4a437798907c64fb657c9fda61e0df
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e2756158dcf87fea757475d711ac9cda20f42152)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-10 10:47:34 +00:00
Christian Ehrlicher
c74f0ccf15 QTreeView: fix Private::intersectedRect()
Don't try to update the left and right boundaries when no valid idxRect
was found.
Also fix the early exit check - we can exit when the idxRect is
completely below *or* completely above the current viewport.

This amends 2f9c72028d2481f587f378a256654d0a362e3d44.

Pick-to: 6.8
Fixes: QTBUG-132670
Task-number: QTBUG-124173
Change-Id: I51f9e12c66268318e597facfbe4df74367d1089a
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 9d4b5fa017199627a42477a842a4e1ef349bb1ae)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-09 23:20:17 +00:00
Alexandru Croitor
2220e447ca CMake: Fix file path in checksum computation to allow spaces
Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: Ica5f830e6d7ca9d8acbc13ebec543ee3cf96b3fe
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 242e29332373d91e1ffff344e1733bd38094606e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-09 18:34:47 +00:00
Alexandru Croitor
fafb4f11ef CMake: Use the $<VERSION> placeholder in qt_attribution.json
For all CPE and PURL fields where it makes sense, to avoid
duplication.

Pick-to: 6.8
Task-number: QTBUG-132181
Change-Id: Icd1c5267e4e9b582eea28150ebd1b2cca3852229
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 82dc92cb1b94de12761f23ad6ec27feb2aca43cd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-09 18:34:41 +00:00
Alexandru Croitor
21815ae5e5 CMake: Replace placeholders in CPE and PURL strings in SBOMs
Replace instances of $<VERSION> in CPE and PURL strings read from
qt_attribution.json files with the version of the package being
processed.

This avoids duplicating the version in qt_attribution.json files in 3
different fields Version, CPE, and PURL.

Pick-to: 6.8
Task-number: QTBUG-132181
Change-Id: I91af17c82dbb936739f4811bf86043e00ee49a78
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit bc3bbb51b7b48d3c4a44a432441938863582242c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-09 18:34:34 +00:00
Alexandru Croitor
a32359a101 CMake: Add internal functions to get various kinds of spdx ids
These can be useful when adding custom relationships to the generated
SBOM document.

Sample usages could be:

qt_internal_sbom_get_target_spdx_id(Svg svg_spdx_id)
qt_internal_sbom_get_project_spdx_id(project_spdx_id)
qt_internal_sbom_get_external_document_ref_spdx_id(
    "qt5compat" document_ref_spdx_id)

Pick-to: 6.8
Task-number: QTBUG-122899
Task-number: QTBUG-129901
Task-number: QTBUG-131377
Change-Id: Idbd5c8bffece50871f995805b619226e32957866
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 97ac4053137c7d0ff5ec71de22cf8c0c7af7006a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-09 18:34:28 +00:00
Alexandru Croitor
97775f43a1 CMake: Add way to convert JSON SPDX to tag/value SPDX document
Add a new qt_internal_sbom_generate_tag_value_spdx_document function
that takes an input SPDX JSON file and generates a tag/value SPDX
file. This is needed by WebEngine to convert the Chromium JSON file to
a tag/value SPDX file so we can reference it as an external document.

To ensure the external document is found, we now always add the
current sbom build directories as install prefixes. This was
previously done only for top-level builds.

To ensure the converted external document is referenced only after it
is converted, it needs to be converted before any targets mention
packages from within it.

A sample usage might be:

qt_internal_sbom_generate_tag_value_spdx_document(
    OPERATION_ID qt5compat
    INPUT_JSON_FILE_PATH "${external_sbom_file_path}"
    OUT_VAR_OUTPUT_FILE_NAME external_output_file_name
    OUT_VAR_OUTPUT_ABSOLUTE_FILE_PATH external_output_file_path
)

Pick-to: 6.8
Task-number: QTBUG-122899
Task-number: QTBUG-129901
Task-number: QTBUG-131377
Change-Id: I5d5397f788c8c7960b6fc233c2868244e5816e0b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit b8f5e5f554c0c8b340b532b998fed5ef2a87eefd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-09 18:34:21 +00:00
Alexandru Croitor
5a878ca693 CMake: Allow adding custom SBOM relationships to targets and projects
Add a new SBOM_RELATIONSHIPS option to qt_internal_extend_target and
friends that allows adding custom relationships to the current target.

Add a new function qt_internal_sbom_add_project_relationship that
allows adding custom relationships to the current project SBOM
document.

A sample usage might be:

qt_internal_sbom_get_project_spdx_id(project_spdx_id)
qt_internal_sbom_get_target_spdx_id(Svg svg_spdx_id)

qt_internal_extend_target(Svg
    SBOM_RELATIONSHIPS
        "${svg_spdx_id} DESCENDANT_OF ${project_spdx_id}"
)

qt_internal_sbom_add_project_relationship(
    RELATIONSHIPS
        "${svg_spdx_id} CONTAINS NOASSERTION"
        "${svg_spdx_id} DESCRIBES NOASSERTION"
        "${project_spdx_id} DESCRIBES NOASSERTION"
)

Pick-to: 6.8
Task-number: QTBUG-122899
Task-number: QTBUG-129901
Task-number: QTBUG-131377
Change-Id: Ie0119ca71b047c7515e1deaf84a5a67ea01b5274
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit d079fdd76cf3f44181c6099b845ba9b41892740e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-09 18:34:15 +00:00
Alexandru Croitor
a33ce2a2ca CMake: Fix project spdx id used in implicit relationships
We shouldn't be using the direct project name in spdx relationships,
but rather the sanitized name which is prefixed with
'SPDXRef-Package-', to ensure sbom validation succeeds.

Also we should default PROJECT_FOR_SPDX_ID to
"Package-${arg_PROJECT}" if it's not set.

Pick-to: 6.8
Task-number: QTBUG-122899
Task-number: QTBUG-129901
Task-number: QTBUG-131377
Change-Id: I354babcf4fea5f6efd9b32422dd8d3835ef50f15
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit f086e72b7e6332412a7c87bc435398a0e3dee305)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-09 18:34:08 +00:00
Alexandru Croitor
31237ffd5f CMake: Add API to allow referencing external packages in the SPDX SBOM
This change modifies the existing implementation of the
external references API to have better named options and better
behavior.
It also adds comments and exposes an internal API wrapper around the
existing implementation.
It's meant to be used by qtwebengine to reference the
Chromium-generated SBOM.

As a drive-by, it removes the previously unused RENAME option.

A sample usage could be:

qt_internal_sbom_get_external_document_ref_spdx_id(
    "qt5compat" document_ref_spdx_id)
qt_internal_sbom_add_external_reference(
    EXTERNAL_DOCUMENT_FILE_PATH "/path/to/qt5compat-6.8.1.spdx.json"
    EXTERNAL_DOCUMENT_SPDX_ID "${document_ref_spdx_id}"
)

Pick-to: 6.8
Task-number: QTBUG-122899
Task-number: QTBUG-129901
Task-number: QTBUG-131377
Change-Id: I13d0fe4d803449bec42f8b454c8131e4d727669a
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Moss Heim <moss.heim@qt.io>
(cherry picked from commit 9a3998692c10964a919942147d8d8035e878b167)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-09 18:34:01 +00:00
Alexandru Croitor
419979e0dc CMake: Add API to include custom cmake files during SBOM generation
Allow including custom cmake files at predefined steps of the sbom
generation using the new internal
qt_internal_sbom_add_cmake_include_step API.

This covers pre-existing steps like BEGIN, END, POST_GENERATION, and
VERIFY, as well as two new steps, BEFORE_CHECKSUM and AFTER_CHECKSUM.

A sample usage of the new API could be:

set(step_path "${CMAKE_CURRENT_BINARY_DIR}/run_some_cmake.cmake")
file(WRITE "${step_path}"
    "
    # This is a CMake script to run some CMake code.
    message(STATUS \"Running some CMake code...\")
    message(STATUS \"Done running some CMake code.\")
    "
)

foreach(step IN ITEMS BEGIN END BEFORE_CHECKSUM
                      AFTER_CHECKSUM POST_GENERATION VERIFY)
    qt_internal_sbom_add_cmake_include_step(
        STEP "${step}"
        INCLUDE_PATH "${step_path}"
    )
endforeach()

Pick-to: 6.8
Task-number: QTBUG-122899
Task-number: QTBUG-129901
Task-number: QTBUG-131377
Change-Id: I6f9512bf3a3bc3ebeb7d21426e5a3833280e42a5
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 8c754dcbb139ba83f033b3b3fc1d9edb8a909811)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-09 18:33:55 +00:00
Alexandru Croitor
6ed0b578a8 CMake: Add SBOM support for translations, custom files and friends
This change introduces a new SBOM API to add info about various kinds
of files to a target SBOM package. The new function name is called
qt_internal_sbom_add_files().

The motivating case is including SBOM information for qt translation
files, resources (e.g. webengine data files) and any other kind of
custom files.

A sample call might look like:

qt_internal_sbom_add_files(Translations
    FILES "${qm_files}"
    SOURCE_FILES_ONE_PER_INPUT_FILE "${ts_files}"
    FILE_TYPE "QT_TRANSLATION"
    INSTALL_PATH "${INSTALL_TRANSLATIONSDIR}"
)

While the motivating case is Qt-specific, the function implementation
is being somewhat future proofed for the not-yet created public SBOM
API.

The new API supports adding files to any target that is backed by an
SBOM package, so all targets created by qt_internal_add_module()
and friends, as well as ones created by qt_internal_add_sbom().

It can be called multiple times for the same target, with a different
set of files, to e.g. assign a different license, or file type per
file set. Note that the file set doesn't have anything to do with
CMake's concept of file sets.
The function is also multi-config aware, and allows specifying
different install paths per config, as well as generator expressions
in file names. But the multi-config support is a bit wonky, and might
need some rethinking in the future.

Note that the custom files must be installed and available in the
specified qt install path, because the file contents will be
checksummed at install time and embedded into the sbom document.
Calling the new API does not do installation itself.

Implementation wise, the function call flow is
- project calls qt_internal_sbom_add_files() one or more times
- at finalization time, the _qt_internal_sbom_add_target finalizer is
  called for a target, which then calls
  _qt_internal_sbom_handle_target_custom_files()
- the latter calls _qt_internal_sbom_handle_target_custom_file_set()
  for each file set that was added to the target
- the latter calls _qt_internal_sbom_handle_multi_config_custom_file()
  for each input file in the file set, which ultimately calls
  _qt_internal_sbom_add_custom_file()

Pick-to: 6.8
Task-number: QTBUG-122899
Task-number: QTBUG-128320
Change-Id: Iafde26ebd68f4168b49e55fbc8ad1c251e98d4b0
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit b085fe6ad9eee69791bc3c15bfeb7cc41245519a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-09 18:33:48 +00:00
Alexandru Croitor
04c3e5e5a7 CMake: Remove SBOM multi-config dead code
These variables were not used anywhere.

Pick-to: 6.8
Task-number: QTBUG-128893
Task-number: QTBUG-122899
Change-Id: If53b3fd8200971dcfde69cefa4df07b67d5669c5
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 42a58d661947cbbe8c1c5f26cea2d92e25a54f46)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-09 18:33:41 +00:00
Alexandru Croitor
6e74281ba3 CMake: Move SBOM project ops setup to run at project begin time
Previously Python and other sbom tooling was looked up at SBOM
project end time.
This was fine for the use cases we had so far, but it prevents
introducing new API that wants call the spdx tools before the end of
the project. Such API will be introduced in a follow up change.

Move the python interpreter, python dependency lookup and other sbom
tooling setup to happen at project begin time.

Pick-to: 6.8
Task-number: QTBUG-122899
Task-number: QTBUG-129901
Task-number: QTBUG-131377
Change-Id: Ic8884e378c0ffd9720ede26b0c61f4122f3bb9d9
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 2fa815341c68148ff00c6d16be017f80e4032ef1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-09 18:33:35 +00:00
Alexey Edelev
df5c9259af Split the tool dendencies lookup to Qt and 3rd party
Tool dependencies that are added using the
qt_record_extra_package_dependency function now are considered as
the third party dependencies. This allows using two different
approaches when looking for the dependencies of Qt tools.

All dependencies that are Qt tools now go to the path invented in
035fbd068b5a3fbc18b7868ecac9a6a6a2f6602c and use the
_qt_internal_find_tool_dependencies function which is designed to
look for Qt packages and uses CONFIG signature of find_package.

To look for the non-Qt modules we should use more generic find_package
signature and _qt_internal_find_third_party_dependencies fits perfecly
for these purpose.

Note that it's known issue that the
_qt_internal_find_third_party_dependencies command also may find
"target" tools when crosscompiling, but this commmit doesn't reinvent
it. We already have various places which make the scoped "host"
dependencies lookups to ensure that "host" tools look for the "host"
dependencies in build systems like yocto.

Ammends 035fbd068b5a3fbc18b7868ecac9a6a6a2f6602c

Task-number: QTBUG-132340
Fixes: QTBUG-132622
Fixes: QTBUG-132616
Pick-to: 6.8 6.5
Change-Id: I9effba3d405ceec720a8a2a332250619cd56f598
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit f881e06dd44c377772dd3b99793ab7552c7cd64e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-09 10:58:45 +00:00
Even Oscar Andersen
887601bf0e Make QWasmScreen::allWindows return all (wasm) windows
It seems that findChildren does not return every window if called
at an inconvenient time.

This causes not all windows to be returned, and later the
QWasmCompositor will not detect a valid window to compose,
and therefor goes to disabled.

Fixes: QTBUG-132414
Change-Id: I6c872071751d5a2fbdeea36fb8f4c7e9677fd7d0
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 5c5844cedb938c38ea595957b172c48a67c502fc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-09 05:56:51 +00:00
Joerg Bornemann
83cb2ca344 CMake: Simplify Qt6FooPrivate -> Qt6Foo package dependency setup
This amends commit fbbf4ace0188b9718b6d7808021c0b887fd52d9f.

Remove the EXTRA_PACKAGE_DEPENDENCIES argument that was added in
mentioned commit, and use the qt_register_target_dependencies function
instead to add the package dependency Qt6FooPrivate -> Qt6Foo.

Task-number: QTBUG-87776
Change-Id: I08a48954576dc3c0b6fde809f90d2022201d7eb0
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 2d38af3125d18255007f7451f31e26e9c16af45a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-09 00:51:20 +00:00
Volker Hilsheimer
58113ca96e QFontIconEngine: implement actualSize correctly and fit pixmap to it
Some icon glyphs might not be square, and actualSize needs to return a
size that fits into, and maintains the aspect ratio of, the requested
size.

Compute the bounding rect of the text/glyph that would be rendered, and
scale it to fit into the requested size.

Use that to return a pixmap of the correct size.

As a drive-by, fix the cache-testing by comparing the
deviceIndependentSize of the stored pixmap with the size we want.

Change-Id: Ic6fd0f0e260b3e3946d032941d9b677463d5c145
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit be9682d372e0021ff112817dc146f5768ac6f28c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-09 00:51:20 +00:00
Marc Mutz
96c5792d5b QUuid: mark Version::UnixEpoch as since 6.9
... because it is.

Amends d89cef439f5c1a58aeff879a12d9a33292764b7f.

Change-Id: I82cfb386c058a0dda873022377ec91368c71e026
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4af8a20e8e0384d3de4af6c2b47a0783ba28bbc3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 20:27:36 +00:00
Volker Hilsheimer
59420d3a0b JNI: avoid detach attempt when populating an uninitialized QString
QString::data on a non-const string will needlessly try to detach.
Avoid that by accessing the raw data pointer.

Addresses header review comment.

Change-Id: I89b4d3451cda517e5c5ca08173510b3529ce73aa
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit bf2491acc74528004af8d5f4caf50e88fcb86f89)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 20:22:08 +00:00
Volker Hilsheimer
30e7ce0fc1 JNI: add missing qxptype_traits.h include to qjniobject.h
We use qxp::is_detected_v. Addresses header review comment.

Change-Id: I57bb2bb2158d82e2cd5e6df5885cde8aedb63b4f
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 611914421d8dae7546842aa5097000ed135117db)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 20:22:08 +00:00
Volker Hilsheimer
1ed487f1ac JNI: Simplify Traits specialization for QJniArrayMutableValueRef<T>
Just inherit from Traits<T>. Addresses header review comment.

Change-Id: If11df666a925a13e54e94b30e42316a6aa06bbc7
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit c5c3730400d0f7bb1f1b93117f8ad5c1262ed695)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 20:22:07 +00:00
Joerg Bornemann
a090ecbdd1 CMake: Don't export 3rdparty dependency find_package calls
...of private modules in public modules. This isn't necessary anymore
since the Qt6FooPrivateDependencies.cmake files contain these 3rdparty
dependencies proper.

This reverts commit dae078e521c3932c66436cbdbfaf5294a1842901.
This amends commit fbbf4ace0188b9718b6d7808021c0b887fd52d9f.

Task-number: QTBUG-87776
Change-Id: I2c425d49fe7beb790abf9a94f089d43fde8b047e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit e7816586b612050adf0cd872b81d04b606ec2b54)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 20:22:07 +00:00
Volker Hilsheimer
087db1d000 JNI: fix declaration of QJniArray(Mutable)Iterator postfix operators
As per the standard at [1], the second parameter has to be int, while
difference_type is jint (which is also int, so no difference in
practice, esp for the already released QJniArrayIterator).

https://eel.is/c++draft/over.oper#over.inc-1.sentence-3

Addresses API review comment.

Change-Id: Idea11f83048b9b65548ec1ac8abc2586c6e61a27
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 291c5ec433131d43921e77f3b6565e89cc0b3420)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 20:22:07 +00:00
Ivan Solovev
b18c3ecdbd [docs] Add description of other C++20 features to the overview
Task-number: QTBUG-128837
Pick-to: 6.8
Change-Id: I07731cd75c97c16eb008a76727b2ae831c029284
Reviewed-by: Jaishree Vyas <jaishree.vyas@qt.io>
(cherry picked from commit 82f6938d8ad66468576c52da7d85a2288f78af7e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 20:22:07 +00:00
Topi Reinio
85088954de Third party code attribution: Change Id to lower case
Each 3rd party license attribution is identified by a
unique Id key, which should be all lower case and without
spaces. See QUIP-7 for more info. about the
qt_attribution.json file format:
https://contribute.qt-project.org/quips/7.

Pick-to: 6.8
Change-Id: Iaa233a0e6180945e014b9a407bbd61df591f1dea
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
(cherry picked from commit 1926df8d57c2b6c600a5486b1939d96b21f7f812)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 20:22:06 +00:00
Alexandru Croitor
fa8effc7da Silence qcompare.h "zero as null pointer constant" warnings on macOS
When using qmake to build a user project on macOS, the Qt headers are
included with the -I option, rather than the -isystem option. This
means that the compiler will not silence warnings that are generated
while parsing Qt headers.

If the user project compiles their code with the
-Wzero-as-null-pointer-constant compiler option, this leads to
warnings like:

/QtCore.framework/Headers/qcompare.h:226:78:
 warning: zero as null pointer constant
     [-Wzero-as-null-pointer-constant]
  friend constexpr bool is_eq  (partial_ordering o) noexcept
  { return o == 0; }
                ^
                nullptr

Fixing qmake to use -isystem instead of -I is not trivial.
We already silence these warnings for gcc in the header file.
Do it for clang as well.

Amends bdd41f491c0f85ae0897a1c7372c5ecda62a5aab

Pick-to: 6.8
Fixes: QTBUG-132581
Change-Id: I7883248b7be548580a03333e76620ac10f57733a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 0711eb60716b53dc86cacb2fc19b72aa4ffee3d0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 17:23:58 +00:00
Ahmad Samir
69277b9ed9 tst_Q{Chrono,}Timer: fix typo in CMakelists.txt
Spotted by Thiago in code review.

Amends bd764cc1ca578759f16fbe292fbe14a243b7d263 and
9cf47946fc872ed95f1b3a766658dd5076a5d473.

Pick-to: 6.8
Change-Id: I01b04d2c80c62158917e6f190418053edc0a0fe5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4073a75959e00722271b8784cb8cb2ee40756ff6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 16:57:15 +00:00
Volker Hilsheimer
103aa5afb2 JNI: replace va_arg helper with variadic template
Android 15 (at least) seems to have changed how float arguments are
passed to native functions, breaking our (conceptually correct) code for
processing the va_arg list into a list of static argument types of the
function implementation.

To fix this, we have to move away from using a va_arg function, and
register a function with statically typed arguments instead.

Use a template function that we instantiate with variadic arguments
deduced from the actual function, using a factory-helper that generates
a JNINativeMethod struct with that template instantiation as the
function pointer. Move all of that into a struct where we can also
declare the signature string as compile-time constant without cluttering
the namespace with static objects.

We can now remove the helpers that took care of type promotion in va_arg
functions, and of the tuple-construction from a va_list.

As a drive-by, don't cast function pointers to void *; it's strictly
speaking undefined behavior in C and should have generated a compiler
warning, if not a hard error [1]. We must initialize the
JNINativeMethod::fnPtr member with the address of the function pointer
instead.

[1] https://port70.net/~nsz/c/c11/n1570.html#6.3.2.3p8

Also, declare the native method as the JNICALL calling convention. That
is only defined on Windows, so makes no difference in practice, but it's
the correct thing to do anyway.

Fixes: QTBUG-132410
Pick-to: 6.8
Change-Id: I190b95fcbcd07cf99c6765fa426c3c351f91994a
Reviewed-by: Volker Krause <vkrause@kde.org>
(cherry picked from commit e91a17873ee4ae58d369b8eb70029cf895b31d03)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 03:05:46 +00:00
Christian Ehrlicher
37effa5dd3 Windows11Style: Misc cleanup for drawControl(CE_ItemViewItem)
Cleanup CE_ItemViewItem branch in drawControl():
 - use local rect instead rect, vopt->rect or option->rect for
   consistency
 - move out viewItemPosition comparisons into local booleans
 - fix coding style
 - merge two QPainter::drawLine() calls into one

Pick-to: 6.8
Task-number: QTBUG-131585
Change-Id: I7cd2f96a2a733a55d5e7fb5956c59bd043317cb2
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
(cherry picked from commit 44edab7c84be101025dc6f9a74f87944ea3a22e9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 03:05:43 +00:00
Giuseppe D'Angelo
1426bd170b QBitmap: undeprecate the QBitmap(QSize) constructor
There is no reason why the QBitmap(int w,int h) constructor is not
deprecated, and the one taking a QSize is. Since there's no deprecation
marker in the source code, I'm assuming this is just a documentation
issue.

Amends 111115bf8862b7cd1197c2ef8a4b475c882776d4.

Change-Id: I700de1821ab23ce85e793734c7048d1b2031ce9d
Pick-to: 6.8 6.5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7f7605c22f0e1847612e9e283eead75a1ace409e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 03:05:41 +00:00
Volker Krause
e342a52613 Expand tst_qjniobject to cover float arguments in JNI native methods
Demonstrates the problem described in the bug report on Android
15/x86_64. QEXPECT_FAIL the relevant test cases until the next
commit fixes the problem.

Task-number: QTBUG-132410
Pick-to: 6.8
Change-Id: I065fd29282ef42ed75a2ed8177ded183c92aa6e3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 749367da8c3309c98b3285836c2bd8abcd7274b1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 03:05:40 +00:00
Axel Spoerl
8b7bf25f7f QtGuiTest namespace: Export symbols
Export functions in the namespace explicitly, to enable usage outside
Qt.

Change-Id: I1d3ea8f043b83cc38a9c6f4ff372e7bb37f2b0cc
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 31e1a79120e1ef9b681b45b2d2c3a7dfef752b8b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 03:05:37 +00:00
Volker Hilsheimer
6a6ce2474e JNI: fix JNI warning from local reference mixup
When making an object array, we use a LocalFrame to get access to the
conversion routine, but manage the frame of local references manually in
chunks of 100 objects. If any of the conversion routines uses the
LocalFrame's implicit frame management, then we push and pop frames out
of order.

Disable the frame's implicit frame management, and only use our chunk
management.

Amends 37638c84efaf2810ad49da0b987f19287d8c4ad6.

Pick-to: 6.8
Change-Id: I93be77ffc8750bb90fd7daed8c273169b03a29e4
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit fe6222b7561faa52f12a961d7c5417e364cf0236)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 03:05:35 +00:00
Thiago Macieira
b39b3551b7 QStandardPaths: use qTokenizer
Avoids allocating memory for the array.

Change-Id: I425235b948609e5f0ffcfffd0f93375a224e5bcb
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 403a47cfd571c9954e91234084c6994901939326)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 02:49:40 +00:00
Shawn Rutledge
96fe113608 doc: Fix description of QSizeF::fromCGSize
Change-Id: I22c3c5a50d624dc1f6a46aa5f1630c08267c4925
Pick-to: 6.8 6.5 5.15
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 9d6614d74cda8eae886f72a688271cdcd3ddcddd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 02:49:40 +00:00
Thiago Macieira
875ccc41f4 tst_QSaveFile: add a test for attempting to overwrite a dir
This is not the same as the 'directory' test below, which tests that we
can't open() a QSaveFile on something that already is a directory. For
this one, the target file did not exist when we open()ed, but has become
a directory since then.

Change-Id: I92d13f103693d375e742fffdd74053dd1b86d81f
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit f4ff7c40588a4515504e22266d15816ca8616cba)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 02:49:40 +00:00
Thiago Macieira
765aa27aa3 QMessagePattern: "precompile" the default pattern
So we don't have to parse it on first use if it isn't set. This should
be a small performance gain for everyone who uses the default, which is
usually the majority of people.

Change-Id: I10c471715457dcfa3a1dfffd2768ce605e4f7e30
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit e04f109456bbcb184963b8ed71944b958b35c201)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 02:49:39 +00:00
Mårten Nordheim
9a1edf52d4 tst_Http2: Test SETTINGS_HEADER_TABLE_SIZE handling
This somewhat duplicates some other tests, namely the QHttp2Connection
one, but tst_http2 is our only coverage of the HTTP/2 code prior to 6.8.

This change adds a test where the server sets the
SETTINGS_HEADER_TABLE_SIZE to 0, effectively disabling the dynamic
table. We, in an earlier patch, makes the HPack table error out if
a new header entry is about to be added if the table has not been
resized below a changed 'max'. So, we take advantage of that here and
set the new 'max' capacity without resizing the table, or updating
dynamic capacity causing it to fail if the client doesn't send the
expected Dynamic Table Size Update.

Task-number: QTBUG-132277
Pick-to: 6.8 6.5
Change-Id: I1ca8ca7828d5b83606e7adbcfc13c154fa1e3cab
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit f7c3acd27ff48b24f99086be206acbe7e00e3208)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-07 22:33:06 +00:00
Assam Boudjelthia
aae66d7518 Android: fix warnings about Class raw type usage
Using Class<?> fixes the warning.

Pick-to: 6.8
Change-Id: Ia65aa78509c41d041970631dc21c8dd72459e674
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
(cherry picked from commit f342f27a0cc6c82f9503c0002b6fd32cb3ada3c3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-07 22:33:06 +00:00
Jøger Hansegård
11abd87046 Implement QUniqueHandle move assignment using MOVE_AND_SWAP macro
This removes boilerplate and the extra complication of std::addressof.

Task-number: QTBUG-132507
Pick-to: 6.8
Change-Id: I07091ec0ac526975cf55361a9811fad77eb152c2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 30ae70a110ee2460744e4fb78bae29b75effbf72)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-07 22:33:06 +00:00
Assam Boudjelthia
a892eb50d3 Android: add android test runner docs to the build
Amends 5735d7ac861fe99a71d8044977e5f487c401ca12.

Pick-to: 6.8
Task-number: QTBUG-84330
Change-Id: Ie78f88cf84376c08e44d887b09d116845882788b
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
(cherry picked from commit 1fb369211e3e477de8531485a33241d5d99b7a21)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-07 22:33:06 +00:00
Assam Boudjelthia
e3feb85abc Android: pass safe area margins to relevant windows only
Instead of passing the safe area margins to all windows
or top windows, we can instead call the listener for
setOnApplyWindowInsetsListener() on specific QtWindow
and have it pass the windowId with the callback to C++.
What was missing before was that the listner was not reset
after removing the window and also, we don't need to
necessarily require a window matching the id to be found,
so that if no window is found we can assume that the callback
is not valid.

Task-number: QTBUG-131519
Change-Id: Idd411e407ac8f5992aa6684ece70329198de1bc2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit d7860d445d462dae853358c8b956fa6b1b6a2fc7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-07 22:33:06 +00:00
Jøger Hansegård
bded4bd5fc Require that the handle type used with QUniqueHandle is quite noexcept
QUniqueHandle is intended for handle types or opaque pointers that are
no-throw constructible, copyable, and assignable, and has nothrow
comparison and relation operators. This patch ensures that this holds
true, and makes most of the QUniqueHandle noexcept specifiers valid.

This will make it easier to implement the comparison and relation
operators in terms of the Qt comparison framework.

Task-number: QTBUG-132507
Pick-to: 6.8
Change-Id: Id9fc3fac72a2337541e49c3b4613b8fd082796af
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 49f1877bbbb8f96d81144861558bdcc81e758a58)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-07 22:33:06 +00:00
Mårten Nordheim
55dc2af21d QHttp2Connection: Fix handling of MAX_HEADER_TABLE_SIZE setting
We need to, following the RFC, send a Dynamic Table Size Update using
HPack once we have acknowledged the setting as long as the new size is
smaller, or if we decide to use the new, larger size.

It's further complicated by the fact that we need to send this update on
the next 'field block' (anything with headers in it), and we may have
multiple SETTING frames come in, and we need to then acknowledge the
_smallest_ one as well as the _final_ one. This is so the decoder on the
peer's side can know that we have set the smallest size, and trimmed our
tables thusly, before going to the larger size.

This could, for example, be used to clear the table.

Task-number: QTBUG-132277
Pick-to: 6.8
Change-Id: I2b886e125f2c197bc3d42aa0b2bbd308ed2a687c
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 57f44d6d882e09f1560f86816fac6ca8d06264fc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-07 22:33:05 +00:00
Peter Kling
40608d0a37 CMake: fix absolute paths w/o suffix in pri/prl files
In the update from 6.7.2 to 6.7.3, commit `ea0f00d5d` changed how linker
flags like `ws2_32` are treated when generating pri/prl files.
Specifically, before the commit a flag like `ws2_32` was left
untouched. The above commit changed it such that such flags are
converted to `-lws2_32` (seemingly in order to better support FFmpeg,
according to the commit message). However, this change also affects
absolute paths if the file has no extension. That is, after the above
mentioned commit, an absolute path linker flag to, say, a dylib on macOS
without a suffix will result in prepending the `-l` flag. This will
result in errors during link time.

An example where this caused problems can be found in the nixpkgs PR
draft #367206 (https://github.com/NixOS/nixpkgs/pull/367206).

This adds a small check to ensure that `-l` is not prepended if the
linker flag is an absolute path without a suffix.

Change-Id: I2c7ce3aac6624e1a27c59af233e3da2c1ae7ba60
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 714ae22b84553271a2809c393dd1a5a90089cc19)
2025-01-07 18:14:42 +00:00
Tor Arne Vestbø
b5c3a3fe73 Add change-notification signal to QInputDevice::capabilities property
On some platforms the capabilities of a device can change at runtime,
and we don't want to model this as a "new device" appearing in place
of the old one.

We already made the capabilities property non-CONSTANT, but let's add
a NOTIFY as well for completeness.

I considered making the capabilities member protected, but
QXcbConnection's xi2 handling relies on modifying the caps
as part of creating the device.

Fixes: QTBUG-132281
Change-Id: Ic345475b179f4562cdd39ecf51c7d6738ad47a74
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit d74079873bbbff8701ec9b254647624775ced27a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-07 13:17:09 +00:00
Marc Mutz
79bd27a82b CompactContinuation: make sure what is being deleted by runObj
A lambda creates a struct with a function-call operator. So use of
'this' in a lambda body is always a bit ambiguous (the outer object?
Or the lambda itself? even though C++ defines it unabiguously to the
former).

Use a named capture variable instead of 'this' to make it obvious what
is being deleted.

Amends 699162c6fa6121cc496338f1d8d6e1b4287f7760.

Change-Id: I48d82d788d495bac43c6adb114dfdd95a8dd0d1f
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 21811161c9109c28da70b7bb9b28df33fa9b7766)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-07 13:17:09 +00:00
David Faure
2a121a9506 Fix wrong value for 'noon' in tst_bench_qdatetime
12 hours corresponds to 43,200 seconds, not 43,200 milliseconds.
Amends commit 3febcd6286a3cd22db4f294e7f31a94c07c51fb0

Pick-to: 6.8 6.5
Change-Id: I2eb3abcab18cd87d51ae70b5fbaeac71a8fcd0a8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 0e2656f9371f92db3bb95ee5ba52c44a91e5ce68)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-07 13:17:09 +00:00
Marc Mutz
1b09c46051 CompactContinuation: make type member const
Because it can be.

Helps readers understand that the type of a continuation doesn't
change once constructed.

Amends 699162c6fa6121cc496338f1d8d6e1b4287f7760.

Change-Id: I43848204cfd8584e6e55d7fbca1b22d30b391e50
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 9dadca4d4e6058299f9d50ae28fd734717d7fdc5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-07 13:17:09 +00:00
Christian Ehrlicher
bf535c4c66 Windows11 style: fix drawing horizontal progressbar in rtl mode
The progressbar content calculation assumes that
subElementRect(SE_ProgressBarContents) returns a rect at 0/0 which is
not the case for progressbars in rtl mode. Fix it by moving the topLeft
edge to 0/0 and translating the painter accordingly

Pick-to: 6.8
Task-number: QTBUG-132459
Change-Id: I614589c9094b0da3c02867b45570d4dfdca61a18
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 314a5b972646a4f2ef9c1f49ddfd335f546336ab)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-07 13:17:09 +00:00
Christian Ehrlicher
5ff8c2eb00 Windows11Style: enable mouse tracking for QTableView
Mouse tracking is needed for windows 11 style since it is using
QStyle::State_MouseOver to draw the cells.

Pick-to: 6.8
Fixes: QTBUG-129242
Change-Id: Ib79ac5a8c14ac8c70365e87120f80b4e4ee4c5b9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 85333b3d8cb89bf58c6c6c0db7c3db5c95b4cbfc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-07 13:17:08 +00:00
Volker Hilsheimer
11b9657b08 JNI: don't access null jobject
When Java calls a native function that expects a QString with a null
String object, then we get a nullptr jstring. We must not try to convert
that to a QString.

Add the necessary checks at the call-site of the toQString helper, and
an assert to the helper itself. Add test case.

Change-Id: If5c55c702bdb3f89ac45fdf3912af2ac295f5e5c
Reviewed-by: Volker Krause <vkrause@kde.org>
(cherry picked from commit db6a9834d2b109e81cc73ef3c64d0c420237e9dc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-07 13:17:08 +00:00
Thiago Macieira
6dc19b55fc QThread/Unix: revert to pthread destruction instead of thread_local
Amends 65093a84c2b94b1543fd4593bc45d491951d28d4, which changed how we
destroyed the main thread's QThreadData. This merges the call to
destroy_current_thread_data() for both types of Unix systems: those with
broken thread_local destructors and those with working ones. It turns
out that the function got called too early for us in those working
systems (see updated comment).

The clean up of the QThreadData is split into two different mechanisms:
 * for any auxiliary thread, when it exits, PThread will call back to
   destroy_current_thread_data()
 * for the thread that called ::exit(), PThread won't, but ::exit() will
   invoke set_thread_data()::TlsKey's destructor

This is different from the situation that existed prior to commit
65093a84c2b94b1543fd4593bc45d491951d28d4: first, there's no code in
qcoreapplication.cpp for this (all in qthread_unix.cpp). Second one may
call ::exit() from any thread, whether that is the thread that called
main(), the thread Qt thinks is theMainThread, or any other.

This commit moves the tst_QCoreApplication check for no extant objects
to a new test. I've chosen to add a new test instead of running a helper
binary via QProcess because we do have a couple of !QT_CONFIG(process)
platforms in the CI, and this is too important.

Credit to OSS-Fuzz for finding this, though it is not itself a fuzzying
problem (all tests of a given structure were crashing on exit).

Fixes: QTBUG-132381
Task-number: QTBUG-130895
Task-number: QTBUG-129927
Task-number: QTBUG-129846
Task-number: QTBUG-130341
Task-number: QTBUG-117996
Pick-to: 6.8
Change-Id: Ie294dce7263b4189f89ffffd9155ec71d31b89d9
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 1da7558bfd7626bcc40a214a90ae5027f32f6c7f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-07 03:46:12 +00:00
Thiago Macieira
60eaa42a25 Revert "Add categorized logging of delete later machinery"
This reverts commit c3a2b9f35a9a12ff3c6f5f0d11844de161b47c2a.

Unfortunately, some of the log messages happen WAY too late at process
exit time, when QtCore is unloading. In particular, the worst offender
is the one in QThreadPrivate::finish(), which is called after the last
QObject in the thread that called ::exit() was getting destroyed. This
implies we have Static (De)Initialization Order Fiascos happening (the
logging recurses into qlocale.cpp and the defaultLocalePrivate global
static has already been destroyed).

I need to revert this commit in order to fix QThreadData destruction.
The functionality is welcome back in QtCore once the fixes are in, so
long as whoever does it fixes the issues we're seeing in the CI (and I
can't reproduce on my development machine). I've created QTBUG-132429 to
track the reversal and see if the functionality can be brought back in.

Task-number: QTBUG-120124
Task-number: QTBUG-132429
Pick-to: 6.8
Change-Id: Iecf8f14529c7a2bb2185fffdfd328066098826b1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 357351b7ab8ab2eee865d2449ffcca9c9f502fd3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-07 03:46:07 +00:00
Friedemann Kleint
7f78908b44 Mime type browser example: Add translator loader code
Enable testing translations.

Task-number: QTBUG-127004
Pick-to: 6.8
Change-Id: Ie83092b4db5bcf516834cf0b5b564a67d7ab6227
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 8778a493606c8733d72db1c09fff5e4bf1f13cc0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-06 18:08:10 +00:00
Mate Barany
9413c19cc1 Update CLDR to v46
New languages added with v46
- Kara-Kalpak
- Swampy Cree

Several new Chinese-language locales have been added, including one
using Latin script, which invalidated some prior QLocale tests, which
have been adjusted to fit.

Some obsolete time-zone identifiers are now treated as deprecated
aliases. These have lost their AnyTerritory association, implying
changes to QTimeZone tests.

Many redundant likely sub-tag rules for unspecified language have been
dropped, in favor of simpler rules.

[ChangeLog][Third-Party Code] Updated CLDR data, used by QLocale, to
v46.

Task-number: QTBUG-130877
Pick-to: 6.8
Change-Id: I92cf210422c7759dd829a7ca2f845d20e263d25b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit e316276b76b9c3768ca4e19a04d03308ef21fe12)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-06 17:56:36 +00:00
Mårten Nordheim
2101e91465 HPack: test and fix Dynamic Table Size Update
Expose some new API to make it easier to test too.
Will be used in follow-up patches for a http2 bugfix.

The setMaxDynamicTableSize() method no longer sets capacity or evicts
entries. This can then be used to set the new maximum size which we will
accept later when we receive a Dynamic Table Size Update.

This flow makes sense with both encoder and decoder. The decoder would
usually be set by us when we send our SETTINGS frame, and then the
Dynamic Table Size Update would be sent by the peer.
For the encoder we would set the maximum size when we receive the
SETTINGS frame, and then we must defer the actual resizing until we
can send the Dynamic Table Size Update ourselves, usually along with the
next HEADERS frame.

Pick-to: 6.8 6.5
Task-number: QTBUG-132277
Change-Id: I959f5006eb09427d130735efe136da8c04453fa2
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit be477819ac17850632bca6ce59ee2c8ef11191cd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-06 17:56:33 +00:00
Jan Moeller
a306131977 Check for valid QAccessibleInterface before invoking action
To avoid illegal access, the change ensures that the QAccessibleInterface
is non-null and valid before accessing its QAccessibleActionInterface.

The check for the validity was also added to existing code which
previously only checked for the QAccessibleInterface not being null.

Fixes: QTBUG-132059
Pick-to: 6.8
Change-Id: I69fc4f9bb052ded8f188032d324666d0c00b9c3c
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Reviewed-by: Lars Schmertmann <lars.schmertmann@governikus.de>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 279c891ddf0ad10dd86c8fc836ce385df57593c4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-06 17:44:48 +00:00
Morteza Jamshidi
59861df8ce Draw icon overlay manually instead of relying on the api
Even with SHGSI_LINKOVERLAY flag set, loaded Icon with
SHDefExtractIcon doesn't have any overlay, so we draw
it manually.

Pick-to: 6.8
Fixes: QTBUG-131843
Change-Id: Iae4c2da12104a361b9a8cf05c78adcdb698f1f82
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit fd7bc16e9fbdc63bd22ba90d0c20b36ccffd2bae)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-06 17:44:48 +00:00
Richard Moe Gustavsen
9db6df1a56 iOS: remove registered undo/redo actions upon qiostextresponder dealloc
QIOSTextResponder add actions to its own NSUndoManager. But
we need to remove those actions again when the responder is
deallocated, otherwise it can lead to a crash in UIKit when
swiping between apps.

Fixes: QTBUG-123843
Pick-to: 6.8 6.5 6.2
Change-Id: I404751bc50692a960e568ff2eb0f1754da0cec31
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 42f29da7a5b6c6969c169e9a868696a968ca930d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-06 17:44:48 +00:00
Morteza Jamshidi
6d8afaac84 Windows: Add Key_Backtab as possible key combination for Shift+Tab
In windows Backtab key event always comes as "Shift+Backtab".
So in order for Backtab key to be recognized as a shortcut sequence,
we also consider Backtab without shift modifier a possibility.

Fixes: QTBUG-94890
Change-Id: I20a7b404b57d8df5bea23765257a178f2e098ed0
Pick-to: 6.8
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 4d9f99c4ea70cdae58c80e1bfdbabefe3abb455f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-06 17:09:27 +00:00
Jøger Hansegård
64c5043a40 Add missing noexcept specifiers for QUniqueHandle handle traits
Handle traits should be simple, and not require exceptions. Note that
we should not make calls to fclose() or close() noexcept, because these
are POSIX cancellation points.

Pick-to: 6.8
Change-Id: I8bbf573b1346eafd52c6080dbb024f8b3bc89359
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit a80d1bf2716b1ba404799d6a09003b145b73b079)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-06 14:03:25 +00:00
Kaloyan Chehlarski
0ce8e1db2b Fixup minimum MSVC version check when configuring Qt
The message displayed to the user says they need "at least Visual Studio
2019", but in reality the minimum is now 2022.

Amends 9a409295c7cfe74b4fb6b1892f4ff86d4f3c23f3

Pick-to: 6.8
Change-Id: Idaedd72d114b994fddd2ba7574fb7a45ca0a3e85
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 652250295c7f9812b49c522ab2fbe518ac9690e4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-06 14:03:25 +00:00
Alexandru Croitor
0e14e9042d CMake: Handle DESTDIR for SBOM doc references in top-level builds
When installing a top-level build using the DESTDIR env var mechanism,
the SBOM generation process could not find the qtbase sbom document,
while generating the qtshadertools document.

Make sure to prepend the DESTDIR env var to the install-time install
prefix, when looking for external SBOM documents.

Pick-to: 6.8
Fixes: QTBUG-132188
Change-Id: I1cdb75842fc552b43d982f05444b5ddc1fe58595
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit f2ce68d8f31f4c90471183d66075bd6fd5955d6a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-06 14:03:25 +00:00
Ivan Solovev
7b356f0f31 QtConcurrent: fix support for callables with deduced return type
Commit 6ebe3d0f0806069f906522dfe9b81baa3f3478de introduced extra
SFINAE checks on the template conditions.
However, it broke the case of using callables with deduced return
type, because SFINAE does not work for such conditions and treated
as a hard error instead.

Fix by explicitly providing all template parameters, so that compiler
could figure a better overload on its own.

Only QtConcurrent::blockingMapped() seems to be affected, but add
unit-tests to check all other methods as well.

Fixes: QTBUG-130766
Pick-to: 6.8 6.5
Change-Id: I1ddbe712d8ce04ac96ba13841cb569d728cfb943
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
(cherry picked from commit f73765682e7c8f1e0e78b7464deec57c7f2669ba)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-06 14:03:25 +00:00
Jøger Hansegård
33f37ff637 Test that reset() and move assignment handles self-assignment
Calling reset() with the owned handle should maintain ownership and not
leak resources. Move assignment should also handle self-assignment
without leaks. The new tests verifies that this holds true.

Task-number: QTBUG-132507
Pick-to: 6.8
Change-Id: Icdfa4d67b06b71a74e810593e57449b51982c98c
Reviewed-by: Tim Blechmann <tim.blechmann@qt.io>
(cherry picked from commit 03bd9491491881529ad28cd6d672edfdda9a0065)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-06 14:03:25 +00:00
Tim Blechmann
cffb015be5 gui: link with OpenGL framework
qopengl.h pulls in headers from the OpenGL framework on macos when
opengl is enabled. We should therefore also link the OpenGL framework.

fixes linker error in libqcocoa:
Undefined symbols for architecture x86_64:
  "_glGetIntegerv", referenced from:
QCocoaGLContext::updateSurfaceFormat() in
libqcocoa.a(qcocoaglcontext.mm.o)
  "_glGetString", referenced from:
QCocoaGLContext::updateSurfaceFormat() in
libqcocoa.a(qcocoaglcontext.mm.o)

Change-Id: I02d2c80e2652da0cf16eaca7ab161cf711599dc2
Pick-to: 6.8 6.5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 6f41c1652f73e1d79d6a4a91d009671a1e285b15)
2025-01-06 11:05:34 +00:00
Jøger Hansegård
8adfacca61 Add missing noexcept specifiers for QUniqueHandle handle traits
Handle traits should be simple, and not require exceptions. This patch
will allow us to improve the noexcept correctness of QUniqueHandle.

Pick-to: 6.8
Change-Id: I84d92818a2fcea5b98e09c0b7dc08b251751396c
Reviewed-by: Tim Blechmann <tim.blechmann@qt.io>
(cherry picked from commit 3c57c7357422bdfda60f56901a7590b258915b6b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-05 16:32:11 +00:00
Juha Vuolle
ee432b6431 Rename Gui test utility's factor() to scaleFactor()
This makes it more clear which 'factor' the function is about.
The function internally calls a pre-existing 'factor()' function,
but since that is a static method of QHighDpiScaling, there the
meaning of 'factor' is more clear from the call context:
QHighDpiScaling::factor(window).

Resulted from API review.

Amends: 5ac4f04325a56d47812f528fe31ceb0d4932f664

Task-number: QTBUG-132090
Change-Id: I869bc05116d334b53b23a46aa2bb788432f250de
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit f9376703c92e957c7334a2ff42a801237f53c8bf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-05 16:02:25 +00:00
Lars Schmertmann
850ed0222f Android: Fix freeze on start when the activity was destroyed before
This can be tested by enabling "Don't keep activities" in the developer
options. With this option Android will immediately destroy the activity
when it is moved to the background. In this case registerBackends will
be called the first time before the BackendRegister was created. Because
m_backendsRegistered was set to true even if it failed, the final call has
no effect. So we need to ensure to set m_backendsRegistered only if a
BackendRegister is available.

Fixes: QTBUG-132085
Pick-to: 6.8
Change-Id: I2ea1c0e0737c982594ceb06cbaf540399c45e3f4
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 9903242ecab82c1ed72dcaf90e90a171c942a84a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-05 11:46:17 +00:00
Jøger Hansegård
b72c4988fb Implement QUniqueHandle::release() using std::exchange
This does not change the behavior of release() but gives more
compact code.

Task-number: QTBUG-132507
Pick-to: 6.8
Change-Id: I5b34c80409ca0e9e9a5e9aee9ef7bc80017610af
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ec0c62385e0df00f42bc9fb5e117cb8b994cfc96)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-03 16:05:55 +00:00
Alexandru Croitor
cdc8811492 CMake: Error out when xcode / SDK version check fail in Qt 6.8+
Starting with Qt 6.8+ we should error out if the minimum sdk / Xcode
version requirements are not met.

An opt out is added for cmake build tests, otherwise all the tests
that use private cmake api will fail to configure when run on older
Xcode or SDK versions in the CI.
We do this by checking for a new QT_INTERNAL_IS_CMAKE_BUILD_TEST
variable.
We do the check inside
_qt_internal_check_apple_sdk_and_xcode_versions
instead of passing
a QT_FORCE_WARN_APPLE_SDK_AND_XCODE_CHECK variable to the test
configuration, because not all cmake build tests use private api, so
this way the list of projects that get the opt out is more
constrained.

Pick-to: 6.8
Task-number: QTBUG-119490
Change-Id: I1284616c91341848a9cf6406fbf35750707d1227
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit a13bfec63df2cf206e354ab56fc017a1f0eb8f6d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-03 16:05:51 +00:00
Jøger Hansegård
5653829bf8 Make QUniqueHandle::reset() default to invalid handle
Having a defaulted argument to QUniqueHandle::reset() gives a convenient
way of releasing ownership without assigning a new handle, and makes
the QUniqueHandle API more similar to std::unique_ptr.

Task-number: QTBUG-132507
Pick-to: 6.8
Change-Id: I842d4545d7cc2da8fe2df08280d0d816ed4be7fd
Reviewed-by: Tim Blechmann <tim.blechmann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 248ac4128fe86150532ff7146d0459abb5260946)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-03 16:05:49 +00:00
Alexey Edelev
2378455647 Unset the temporary variables in Dependencies scripts
Unset the temporary variables to avoid littering the scope.

Pick-to: 6.8
Change-Id: Ibd6b2896113a9fcd9eae7bc202dc0dc8c7a9f9bd
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 96bb0db5afbab2c5cc32a6b19abc74497c839f5a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-03 15:59:40 +00:00
Alexey Edelev
d83081c78e Assume that the Qt Plugin package is FOUND by default
Set the <package>_FOUND variable to TRUE by default, so the follow
logic that need to change the flag only need to take care about
setting it to FALSE if something exceptional occurred.

Amends 8d0283ad2cae3d8fbd4b1b7ee5c6454f7fcc079c

Pick-to: 6.8 6.5
Change-Id: Idd4407ea77e81703b5fa8cc5efa8c52b53d401ae
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 13608241793f6671500868c9ce96468f604f651e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-03 15:59:38 +00:00
Alexey Edelev
b942110a4a Adopt the Qt dependencies lookup mechanism for tools dependencies
The existing lookup mechanism doesn't consider Qt path when looking for
the Qt Tool package dependencies. In good scenario this leads to the
missing Qt Tool package, in worst case scenario the Tool package could
be found by alternative search path and attempt using the invalid
tools.

Use the lookup functionality we have for Qt modules when looking for
dependencies of the Qt tools. This will look the tools in Qt search
paths first and only then attempt looking elsewhere, considering the
QT_HOST_PATH.

Pick-to: 6.8 6.5
Fixes: QTBUG-132340
Change-Id: I570c03037f2a92922d2546a4f5fde1bc17a7f812
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 035fbd068b5a3fbc18b7868ecac9a6a6a2f6602c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-03 15:59:34 +00:00
Alexey Edelev
ee533138d8 Use the 'call' command when generating the command scripts
cmd.exe has a huge problem when running the batch scripts locating
by paths contaning spaces and more the one set of quotes in arguments.
This can be worked around by using the 'call' command as the test
command runner.

Fixes: QTBUG-132258
Pick-to: 6.8 6.5
Change-Id: I9b6fb0f8bccf44456e4cb9b79f3c6bd3f9fe4678
Reviewed-by: Even Oscar Andersen <even.oscar.andersen@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 10a3859809fc0b6e1edd6cbb93e409f0513a9bbe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-03 15:59:31 +00:00
Marc Mutz
c35cb5fe9a QRhiWidget: mark (Private&, parent, flags) ctor explicit
Found in API-review.

Amends 8386dfee05d35057836f93d182ef96674a6fd11e.

Change-Id: I5ad063b17356f75084655f1af353ba34a5deb4bf
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit be8391e56dc76f88058b432b015711cd7bce9c35)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-03 14:16:08 +00:00
Marc Mutz
ffb442db62 qpropertytesthelper_p.h: port from QScopedPointer to std::optional
It's more efficient (doesn't need to allocate the QSignalSpies on the
heap) and makes the header fit for the upcoming QT_NO_SCOPED_POINTER.

VxWorks seems to have a problem with its std::optional implementation,
though:

   QWARN  : tst_QAbstractAnimation::stateBinding() Trying to construct an instance of an invalid type, type id: -2125884168
   QWARN  : tst_QAbstractAnimation::stateBinding() Trying to construct an instance of an invalid type, type id: -2125884172
   QWARN  : tst_QAbstractAnimation::stateBinding() Trying to construct an instance of an invalid type, type id: -2125884024
   Received signal 11 (SIGSEGV), code 2, for address 0x0000000d

So write a small optional-like wrapper around std::unique_ptr for that
platform.

Amends 930e59b798d9e3d08e17440980d33a08fb411cbe.

Pick-to: 6.8 6.5
Task-number: QTBUG-132213
Change-Id: Icf85678d616bc96c7d74b982d0b919ea3f13265a
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 7bd47fb70881e7240c027cd2844866c99f8f096d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-03 10:38:12 +00:00
Shawn Rutledge
5ead2a3d63 Fix QTransform::quadToQuad() to work with QRectF
A typical usage for mapping a 4-point polygon to a rectangle might be

  QTransform transform;
  bool ok = QTransform::quadToQuad(polygon, polygon->boundingRect(),
                                   transform);

It works because the QPolygonF(QRectF) ctor is implicitly called on
the second argument; but that ctor turns it into a 5-point polygon.
So it should be legal for QTransform functions to work with 5-point
closed paths.

Fixes: QTBUG-21329
Change-Id: Iae249012e14b8a3e8d3b0dfa35da8f9759359832
Pick-to: 6.8 6.5 5.15
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 48b1af941c50ab28cc92f9ea65a8a74a32eaf2bc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 19:39:17 +00:00
Alexandru Croitor
ff596bfac8 Revert "CMake: Temporarily allow using any version in Qt's CI"
We updated the minimum CMake version used in CI for Qt 6.9+ to 3.22.
Enforce the minimum CMake version in CI to avoid regressions.

This reverts commit 5803af38aab09b7e47230a494e14654031d024e7.

Task-number: QTBUG-131169
Change-Id: Ifc91644dd26e465be44bfa7cfe6f99e295a174a9
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit dcd057a31b54de637a5ca8bb8a5d46e753d3066a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 19:19:27 +00:00
Aurélien Brooke
076a818f74 rhi: vulkan: fix crash when making readbacks in consecutive frames
When requesting a readback every frame, the readback activeFrameSlot
alternates between 0 and 1. Suppose we are in currentFrame 1, and
process a list of readbacks of slots [1, 0]. First, we skip the readback
of slot 0 since it does not match the currentFrame 1. The list thus
remains [1, 0]. Then, we process the readback of slot 1, and call
activeTextureReadbacks.removeLast(). This removes the readback of slot
0, while in reality we processed the readback of slot 1. The
activeTextureReadbacks is now [1], containing a readback for which we
called vmaDestroyBuffer(), leading to a crash ("double-free" attempt) in
Vulkan on the next function call.

To fix this, remove the readback that is actually processed (index i)
instead of the last one. Since we iterate backwards, indices remain
valid.

Pick-to: 6.8
Change-Id: Idd4296de45167edd0a9da345dcc1c3b6ac71a6d6
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 73405890b8911dd1a58120665ce63a38281c6ce4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 19:19:27 +00:00
Michał Łoś
f13ef41580 VxWorks: Enable video device discovery
Video devices should be discovered by VxWorks properly.

Pick-to: 6.8
Task-number: QTBUG-115777
Change-Id: Ib6719fc9480827aed296343e0b91286ae8408c8a
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit fbd7c7c45af8102090cf9e606ade565e5357a220)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 19:19:27 +00:00
Marc Mutz
7aadf25ccd QThreadStorage: replace QScoped- with std::unique_ptr
This only affects the !QT_CONFIG(thread) case and requires the rewrite
of the old-style static cleanup() deleter protocol into the modern
operator()() one.

As a drive-by, mark the deleter noexcept, like destructors are
supposed to be.

Pick-to: 6.8
Task-number: QTBUG-132213
Change-Id: I8839865880647d76b77eb9a3f2858067db86234e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6da1f72311b844b2232da3067ad6e1e24614e67c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 19:19:27 +00:00
Marc Mutz
77de3d45d3 Remove QT_NO_CAST_FROM_ASCII from QT_ENABLE_STRICT_MODE_UP_TO
QT_NO_CAST_FROM_ASCII is a policy setting, not a strictness
setting. The other components of QT_ENABLE_STRICT_MODE_UP_TO all deal
with clearly undesirable APIs, which QString(const char*) cannot be
said to be.

Keeping it in QT_ENABLE_STRICT_MODE_UP_TO would seriously impede the
use of strict mode in Qt itself (cf. QTBUG-132327).

Amends 3a6c8e02b6d1b0574da52b0087092d0c74aa92c1.

[ChangeLog][QtCore][QT_ENABLE_STRICT_MODE_UP_TO] No longer includes
QT_NO_CAST_FROM_ASCII. If you wish to continue using
QT_NO_CAST_FROM_ASCII, you need to define it in addition to
QT_ENABLE_STRICT_MODE_UP_TO. The reason for this change is that, while
everything else in strict mode should eventually become the default,
we're not proposing to remove the ability to construct a QString from
a const char*. QT_NO_CAST_FROM_BYTEARRAY and QT_NO_CAST_TO_ASCII
remain enabled in strict mode, though.

Task-number: QTBUG-132327
Pick-to: 6.8
Change-Id: I36b850833b1de79a47de975ca28d3591a0a0e089
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit f9163ae7a8167daded0798654d99a2e3a5aaa2b5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 15:23:07 +00:00
Ivan Solovev
90fab1e4e9 Fix QtFuture::when{All,Any}() overload resolution
Both whenAll() and whenAny() have two overloads:
* an overload taking two input iterators, e.g.
  whenAll(IntpuIt begin, InputIt end)
* an overload taking an arbitrary number of future objects, e.g.
  whenAll(Futures &&... futures)

The public APIs are properly constrained, but internally they call
QtPrivate::when*Impl() template functions, that have the same two
overloads, but do not have any constraints.

As a result, passing exactly two QFuture<T>{} objects was leading to
the compiler picking the Impl overload that takes a pair of iterators.

Fix it by applying a subset of constraints from the public API to
the private implementation as well.

Amends 102f7d31c469a546f52c930a047bd294fb198186 which was introduced
for Qt 6.3, so picking down to Qt 6.5.

Fixes: QTBUG-131959
Pick-to: 6.8 6.5
Change-Id: Ide29ac9a494d07870e92957c40c1f614e56825f8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 8aef5b0d8fd57684abe39c88af8c14d8882ef07b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 13:58:28 +00:00
Ivan Solovev
73b8c83ec7 Do not duplicate JsonFormat enum
The enum already exists in QJsonDocument, so there is no reason to
introduce a new one in QJsonValue.

Instead, use the fact that we only need to forward-declare QJsonValue
in QJsonDocument's header, include the latter into qjsonvalue.h, and
use a type alias.

For Qt 7, pre-program moving of the enum into QJsonValue and using
an alias in QJsonDocument.

Amends ac73079dee5f0260528a5c217a82cb0beafb0a56.

Found in Qt 6.9 API review.

[ChangeLog][QtCore][Potentially Source-Incompatible Changes] The
QJsonDocument header no longer includes QJsonValue.
The backward-compatible fix is to include all needed headers
explicitly and to not rely on the transitive includes.

Change-Id: I7c5219a239149e4a87d4780c4277d111983ad0f4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 3cb87d891bb040f73fb68b6c5e7e82518f603c59)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 12:07:32 +00:00
Joerg Bornemann
523f711295 CMake: Yield error if VCPKG_ROOT variable is missing
...and vcpkg usage was requested.

The user got no further feedback why vcpkg wasn't used despite passing
the -vcpkg configure argument.

Pick-to: 6.8
Change-Id: Ib43c2045f093c3887a63406e37f37bdd681341cd
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit fecae6ab1b1aa36f43b5cd87b229de4df37e44ab)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 10:25:22 +00:00
Marc Mutz
c806d2bbbc sqlbrowser example: use = default on empty dtors
Idiomatic C++11 code.

Amends 2690822428deec4f0c08f4d118d69a7c6036369e, which, however,
inherited the issue from older code.

Pick-to: 6.8
Change-Id: Iba1fb9874bd93b4a560c33e3ecf62ecaa96d8bda
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 19564e033cf65a0a67680285d1cbcc85c9437aaf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 09:57:54 +00:00
Marc Mutz
101fedb17f sqlbrowser example: fix ugly margin around ConnectionWidget
When a layout is used to arrange the children of a non-top-level
custom widget, the layout's contentsMargins need to be manually set to
zero to avoid extra empty space around the widgets, misaligning it
w.r.t. its siblings.

Add the necessary call.

Amends 2690822428deec4f0c08f4d118d69a7c6036369e, which, however,
inherited the missing margin adjustment from older code.

Pick-to: 6.8
Change-Id: Icd1945a4f2b1635f031e50758ec2f1ec9313ae27
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 15524d1623a1400e4de15e57408e37020d394986)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 09:57:48 +00:00
Marc Mutz
cc1af8409a sqlbrowser example: use explicit / override
Examples should show idiomatic use of Qt and C++, so mark the custom
widget constructors in this example as explicit and their destructors
are override.

Amends 2690822428deec4f0c08f4d118d69a7c6036369e, which, however,
inherited the missing explicit from older code.

Pick-to: 6.8
Change-Id: I5b5b49f69330c6f139345bed7264c85a36c36e9b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e0e9a5627376e04aba1b2ca2591554851d7de240)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 09:57:42 +00:00
Marc Mutz
88600c3096 sqlbrowser example: use unique_ptr to hold m_ui
The old code used manual memory mangement (raw new/delete) to
(de)allocate the Ui struct. This is so 80s.

Use an owning smart pointer to manage the memory. Ordinarily, this
would have been QScopedPointer, but seeing as that doesn't have a
create() method to hide the raw new, use std::unique_ptr and
std::make_unique() instead.

Amends 2690822428deec4f0c08f4d118d69a7c6036369e.

Pick-to: 6.8
Change-Id: Icabb9154eb38630855e14094b958af0214516f6b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 0da2c2c4ef2219967db87021eece2a60b6e207af)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 09:57:35 +00:00
Marc Mutz
02f05bdb5f sqlbrowser example: use idiomatic Qt [3/3]: use form-layout
The old code used a grid layout inside the QGroupBox, but the design
with labels in the first and edit-widgets in the second column lends
itself to a QFormLayout, which adapts the alignment of the widgets to
the platform style, so use that.

Amends 2690822428deec4f0c08f4d118d69a7c6036369e, which, however,
inherited all of the above from even older code.

Pick-to: 6.8
Change-Id: I528f0ce9d8cb7a997fbfabcdca887c059f571b38
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9c099ef942216d01261c26b60e3727a2a467f12a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 09:57:29 +00:00
Marc Mutz
8dbd0828e9 sqlbrowser example: use idiomatic Qt [2/3]: use button-box / override accept()
- The old code used two QPushButtons in a QHBoxLayout to provide
  Ok/Cancel buttons. This hard-codes the positions and text (and
  icons) of these buttons, instead of adapting to the platform style.

  The new code simply uses QDialogButtonBox, which is designed for
  this purpose.

- Also, the old code connected the Ok button's clicked() signal to a
  custom slot that then called QDialog::accept(). This means that the
  code in the custom slot is not executed when the dialog is accepted
  by other means (e.g. return press in one of the line edits
  ("auto-default"), though I'm not sure here).

  The new code uses the idiomatic Qt way of overriding
  QDialog::accept() instead, and connects the button-box's accepted()
  signal to it. This is done in the .ui file, so it already works in
  Designer preview.

- Finally, the old code made a manual connection from the Cancel
  button to QDialog::reject().

  The new code uses the Qt idiom of connecting in the .ui file
  directly, using QDialogButtonBox::rejected() as the signal.

Amends 2690822428deec4f0c08f4d118d69a7c6036369e, which, however,
inherited all of the above from even older code.

Pick-to: 6.8
Change-Id: I83afd6156a0811e0c0f99f2480625ea6b69ff78b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3419c299369ac1da94ba5710aaf5f5f65c38c33c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 09:57:23 +00:00
Marc Mutz
f2b88b3225 sqlbrowser example: use idiomatic Qt [1/3]: disabling group-box
The old code connected to the wrong signal and therefore had to write
a custom slot to perform the disabling of the group-box.

The new code simply connects the QCheckBox::toggled(bool) signal to
the directly-compatible QWidget::setDisabled(bool) slot, removing the
need for a custom slot.

Also move the connection into the .ui file, so it works already when
checking the form in QtDesigner.

Amends 2690822428deec4f0c08f4d118d69a7c6036369e, which, however, only
inherited the issues from older code.

Pick-to: 6.8
Change-Id: Ia834f92de270bb7b18981273188f6e5b6cd457a2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 53826d1cde26f825d1983476c6697f72130e351f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 09:57:17 +00:00
Thiago Macieira
381dca29ff Replace qgetenv() calls converted to QString with qEnvironmentVariable()
It's slightly more efficient.

Change-Id: Id5ac04fc27eee108c8e5fffd786c3d5f793a0a9d
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit db34e27f7f6ade54bfae59e5eed14c05ac508a49)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-01 19:55:21 +00:00
Thiago Macieira
36d260014f qEnvironmentVariable: avoid a temporary QByteArray
Because we don't need one. I guess I was just lazy.

Amends b12fd1fa9d0b64e3cb66fa68c85392dbde8e175b ("Long live
qEnvironmentVariable()").

Pick-to: 6.8
Change-Id: I5b9141c5a32f9d784e0bfffdc3e4d742790aebdd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ce95c26034cc5b3ae8094c1521221e5b2f13ecfa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-01 16:46:29 +00:00
Ahmad Samir
01edc916d2 moc: fix GCC -Wextra-semi colon after member function definitions
As pointed out by Thiago the QT_DECLARE_METATYPE calls are redundant, so
remove them.

Task-number: QTBUG-132101
Pick-to: 6.8
Change-Id: I73800e70d3f270fb87941d4e053aa7ac5ed1841c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 3bb4c4949fed9ccf8653151c78d5130b8db00716)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-31 23:59:24 +00:00
Ahmad Samir
5171b7f488 src/plugins/*: fix GCC -Wextra-semi colon after member func definition
Pick-to: 6.8
Task-number: QTBUG-132101
Change-Id: I947fdb66df9b6d86c60139046166395e4ae42127
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 997abb0520cdfbde60e0fe4fdb133e15e24ce871)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-31 23:09:12 +00:00
Ahmad Samir
cc369ad07f QCryptographicHash: hashInto(): check the buffer size earlier
We can use hashLengthInternal() to check if the buffer is big enough.
This matches what the QCH::hash() method does, it also has an assert
that `result.size() == ba.size()`, so we can assume this works with
OpenSSL's EVP_MD_get_size() in EVP::finalizeUnchecked().

Amends c70c81b371993ca865d523bb5f37eac4eb8a972b.

Pick-to: 6.8
Change-Id: I64935f3d590ab243b361a0b764f011c388820e32
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit b83e825fab16f83f86149ead78efb6ec3d2fa16d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-31 23:09:11 +00:00
Marc Mutz
11f485ea68 tst_QImage: fix discarded QFile::open() results
Wrap them in QVERIFY(), as usual.

Found by QFile::open()-turned-nodiscard-come-6.10.

Amends e673e5a257569eaa816c6acd31dd754efd9f8c75 and
25c96d547b4563cbfedcec6093d68116148d8599.

Pick-to: 6.8
Change-Id: Id39e5d9e500b524af8443cb57916a12f98bd7c23
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit cf6ae9a90106a3557a8df1e0d2567b02a4ef6ded)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-31 19:03:28 +00:00
Marc Mutz
c970909437 tst_Q(Gui)EventLoop: Unbreak UBSan build
The tests peek into QEventLoopPrivate, which means that a UBSan build
needs access to QEventLoopPrivate's type_info, for which we need to
export the class.

Amends 3af20bd8eb8c75017c5d6d138d7c42914ee5bee3, which fixed the weak
vtable that, presumably, made this test work before.

Pick-to: 6.8
Change-Id: I4104ba95093fa240c5ef7d9d5bf287c1652333f0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 8bf54385319df958ea88f9998e7690d4c35e354d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-31 10:13:04 +00:00
Marc Mutz
5cd16659ff Port QtCore from QScoped- to std::unique_ptr [1/2]: private uses
This patch series is in preparation of enabling QT_NO_SCOPED_POINTER
when building QtCore, a prerequisite for enabling this opt-out in leaf
modules.

This first part of the patch series ports objects whose use cannot
"leak" into other modules, e.g. because they are in .cpp files or are
private members and is thus SC (and, as demonstrated by various static
assertions we put into the source code over the years, BC).

The second patch will deal with objects in protected and public APIs,
and thus might be QUIP-6 SiC Type A.

Task-number: QTBUG-132213
Change-Id: If4967f6e563a4e7d74550fad4c6d354fad1beef5
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 63f1c6fcbab5f36809ffc96ac5ff6cb9e01e70bb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-31 10:12:58 +00:00
Marc Mutz
3ea877a844 QLibraryInfo: de-pessimize prefixFromAppDirHelper()
The local appDir variable was only used to hold the return value of
another function call. But hardly any compiler will be able to look
through the QString atomic ref-counting to turn the non-Darwin code
paths into the tail-calls that they ought to be.

Remove the variable and return the result immediately. This removes
the move-assignment and dtor calls in the two changed lines and lets
RVO kick in, turning these calls into tail-calls on non-Darwin
platforms.

Amends 4ac872639ed0dd3ae6627e05bdda821f7d128500.

Pick-to: 6.8 6.5
Change-Id: Ieeefbd52fc983ab7aebcff6419965b206f374935
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit e57113feac183abd1f5bfcfb633a33e1387b2d3e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-31 10:12:56 +00:00
Toni Saario
60a264ed50 Coin: Tweak VxWorks testrunner
Add crash handling to avoid waiting until 10min timeout on each crash.
Force restart on each crash by killing emulator.

Make health check more robust to allow it to work even when emulator is
down. This is done via wait in separate process which cannot be done
with normal timeout command, as input to pipe that is not being read
by emulator will block forever.

Change-Id: I86c3c86f936cc96d57b38983da48d1d73162399d
Reviewed-by: Simo Fält <simo.falt@qt.io>
(cherry picked from commit 918cbe7601b07fa6db7973ff9a4f76208dae8f22)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-30 11:31:47 +00:00
Samuli Piippo
884c338355 egldevice: allow DRM device path to be overridden
The backend-provided DRM device might not be the right one,
so allow kms config to override it.

Pick-to: 6.8
Task-number: QTBUG-131887
Change-Id: Ied744ae7015eae64f4556f1528e0dbe8ae69d206
Reviewed-by: Pasi Petäjäjärvi <pasi.petajajarvi@qt.io>
(cherry picked from commit c3bbbb22b8bc920e4937cf640fd1d2df3b0f9205)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-30 11:31:47 +00:00
Friedemann Kleint
b06125aa51 uic: Generate fully qualified enumerations for QFormLayout
This is required for Python.

Task-number: PYSIDE-1735
Change-Id: I92108009dd23565adaa2ee77300059cb197a89c5
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
(cherry picked from commit 11d6200d8ad88459a499550b30f5c22f1657719b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-30 04:04:22 +00:00
Ahmad Samir
bbf78c9636 tst_QCryptographicHash: split 4GiB tests to a separate unit test
With those tests split, tst_QCryptographicHash takes about 4ms.
When FEATURE_openssl_hash is enabled those tests take about 15s on
their own, but when openssl_hash is disabled they take about 2 minutes.
That makes running the tests locally a bit of a hassle when hacking
code ... test ... hack ... test.

This is with a debug build, GCC, `-O0 -g` flags.

Change-Id: I8b8f5d1954feb1f9eb8115e27635610a41b42f47
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit fff217824b532da7306af1ac755581e76e098a27)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-29 23:22:56 +00:00
Christian Ehrlicher
6790d8d716 QCommandLinkButton: fix drawing high-dpi icons
QCommandLinkButton was using QIcon::pixmap() without specifying the
current device pixel ratio. Switch to QIcon::paint() to not have to
fiddle around with the dpr at all here.
As a drive-by remove a useless QPainter::save/restore call.

Pick-to: 6.8
Change-Id: I7e2492a09b28cb8a4f4cc60454733e0054fe1e9b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 785fb89e0aafc25a435d28ff05bf0dc05385b372)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-29 19:35:04 +00:00
Thiago Macieira
d39c493390 3rdparty: patch BLAKE2 sources to not export anything in static builds
This could cause conflicts with other users of these algorithms, notably
libb2 itself. Though if you're using libb2, you shouldn't be using the
un-optimized copy inside QtCore...

I've updated the SHA1 of the last commit in the repository, but there
were no changes to our sources.

[ChangeLog][Third-Party Code] Fixed a bug that caused the BLAKE2 symbols
to be visible from QtCore in a static build. If you need to use the
BLAKE2 hashing algorithm in your own code, either use QCryptographicHash
or import libb2 into your build environment. Using libb2 remains the
recommended solution for all systems, especially those for which it has
optimized (vectorized) implementations.

Fixes: QTBUG-132347
Pick-to: 6.8
Change-Id: I48003b58cef0d8bcc720fffdd89b0f151fd102e3
Reviewed-by: Linus Jahn <lnj@kaidan.im>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit b884fbf10237547e809745f528978942faf0e5f6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-29 11:40:51 +00:00
Marc Mutz
b79b2edde8 QLibraryInfo: port from manual memory management to unique_ptr
It's safer and clearer.

Also standardize on unique_ptr instead of QScopedPointer, because the
latter is not supposed to be movable, so the assignment in
QLibrarySettings::load() would not compile.

As a drive-by, scope a variable tighter (in an if condition).

Task-number: QTBUG-132213
Pick-to: 6.8
Change-Id: Iecdd910af4d06dbd03d2daf3ccf99dd4822f04ac
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit aa1f2064801b39a26a718703817e197a3e31447e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-29 11:40:51 +00:00
Christian Ehrlicher
e23933e868 QStyleSheetStyle: Honor box settings for QSpinBox
The previous patch to not modify the CT_SpinBox by QStyleSheet when
nothing was added for QStylesheet also removed the additional margins &
paddings handling for the size calculation. This patch re-adds this.

This amends 96adebed606cdbc73c73778917d777dc04c6e93e.

Pick-to: 6.8
Task-number: QTBUG-130642
Fixes: QTBUG-132431
Change-Id: Iff1f0febeca90d3154e61fd80e4b359bc7766b84
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit b2cc8824ec2cdeb6e053a2ff92d7d5b71f8d0ee5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-29 03:54:57 +00:00
Christian Ehrlicher
314c91d94e Widgets: pass dpr to QIcon::pixmap()
Change the remaining calls to QIcon::pixmap() to pass a valid
devicePixelRatio parameter.

Change-Id: I0e71e20c8109e296446e9e13cddba31d53c05df9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit efc318e05a2288f3fe62d9d7b2b892906e9263e0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-29 03:54:57 +00:00
Christian Ehrlicher
fba5f806e6 QCommandLinkButton: reload icon on style change
Different styles provide different icons for SP_CommandLink so reload
the icon on every style change.

Pick-to: 6.8
Change-Id: I2d8bd706d4c1bca89b91c90f1bb90a796b38e0d3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d4c518b210ad56cb51c17e6e1b4a81b0deb7253c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-29 03:54:57 +00:00
Volker Hilsheimer
843e2e1309 JNI: don't pass jobject by reference
And definitely not by non-const reference.

Discovered during upcoming fixes for native function registration.

Task-number: QTBUG-132410
Pick-to: 6.8
Change-Id: I0ce8519f5a1f9f3caffefc53e6d93b52509bc439
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 1b84970b90c36771bf266f8612dba9585341795a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-28 19:19:03 +00:00
Marc Mutz
5e6fa3dbc5 QTest::toString(QCbor-type): port from const char* to unique_ptr<char[]>
This is more robust and lessens the impedance mismatch as seen by the
old code using std::unique_ptr<char[]>(expr).get().

The new code isn't impedance-mismatch-free, either
(UP{qstrdup(qba.data())}), but short of writing a small string class
whose internal buffer can be release()ed to comply with the archaic
QTest::toString() new[]'ed const char* return value, there's not much
we can do about it atm.

Also separate the internal from the "public" stuff in
QCborValueFormatter by adding private: and public: sections.

Pick-to: 6.8
Change-Id: I09a2ad1a75bb9eab3d01f2b5b60afc2d762da384
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d9264ee65d6f24e1008b08494b1472a54ac01940)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-26 17:23:30 +00:00
Thiago Macieira
8fdcda4dac Replace qTerminate() with std::terminate() and mark it for removal
It was used by the QT_TERMINATE_ON_EXCEPTION macro, introduced in 2012,
to support pre-C++11 noexcept semantics. That macro was removed for Qt
6.8 in commit 9b2ae564a59656d9cf49b141e70f5958b4fb79a4. This commit
amends that removing the definition of qTerminate() immediately in Qt
6.9 (it was an \internal function).

Change-Id: I9682121c04fafb3676b0fffd9f5ac999e7603c84
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit b8f84fd1e2af38ece89d60619bf93e7af34433ab)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-26 17:23:30 +00:00
Thiago Macieira
09d44fdef3 QSaveFile: make it so flush() errors imply commit() failed
QSaveFile records past write errors in writeData(), but often the
QFileDevice::writeData() calls it places will succeed because the data
is only being buffered. Instead, the failures are noticed only by
flush(), whose actions do not affect QSaveFilePrivate::writeError.

[ChangeLog][QtCore][QSaveFile] Fixed a bug that caused commit() to
return true and overwrite its intended target file even though it failed
to flush buffered data to the storage, which could cause data loss. This
issue can be worked around by calling flush() first and only calling
commit() if that returns success.

[ChangeLog][QtCore][QSaveFile] Fixed a bug that caused commit() to
return true even after a cancelWriting() call had been placed, if
writing directly to the target file (that is, only with
setDirectWriteFallback() set to true). Note that the state of the file
does not change under those conditions, only the value returned by the
function.

Drive-by clarify a comment from 6bf1674f1e51fd8b08783035cda7493ecd63b44
(Qt 4.6 "Don't drop errors from flush on QFile::close") which had me
chasing the wrong lead.

Fixes: QTBUG-132332
Pick-to: 6.8 6.5 5.15
Change-Id: I427df6fd02132d02be91fffd175579c35b9c06cc
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
(cherry picked from commit 92373d353cf090faa03cbc8aca505d1784b10b54)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-26 17:23:29 +00:00
Lars Schmertmann
e6434a71eb Avoid unused variable warning in qfilesystemmodel.cpp
2135:5: warning: unused variable 'q' [-Wunused-variable]
    2135 |     Q_Q(QFileSystemModel);
         |     ^~~~~~~~~~~~~~~~~~~~~

The variable is only required for the feature filesystemwatcher.

Pick-to: 6.8
Change-Id: I5da48f94118179ec20fec7da7169b7f22cec17fe
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 46dddcb213eb5080b8f759633a1b025d86f55e36)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-26 16:35:11 +00:00
Marc Mutz
353d22756f Fix a performance regression in QDataStream
Commit e176dd78fd2f253eb2625585b2bd90b5713e5984 replaced a `new
char[n]` with a std::make_unique<char[]>(n), probably on this author's
insistence.

But the two are not equivalent: make_unique() value-initializes, even
arrays, even of built-in type, which means that each buffer resize
writes each byte twice: first nulling out the whole buffer as part of
value-initialization, then in the memcpy() and any following read()s.

For buffers of several MiB, or even GiB in size, this is very costly.

Fix by adding and using a backport of C++20
make_unique_for_overwrite(), which performs the equivalent of the old
code (ie. default-, not value-initialization).

Also add q20::is_(un)bounded_array, which are needed for the
implementation of q20::make_unique_for_overwrite().

Amends e176dd78fd2f253eb2625585b2bd90b5713e5984.

Pick-to: 6.8 6.5
Change-Id: I8865c7369e522ec475df122e3d00d6aba3b24561
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 1a9f8cc0df33195df959cee2e355dde4cbacd754)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-24 23:42:09 +00:00
Marc Mutz
aff082764a tst_QSpan: check QList<int> -> QSpan<const int> doesn't detach the former
It does.

While std::span, does, too, and so users should be using
std::as_const(), it's quite simple to avoid for QSpan, so we'll fix it
in QSpan. This patch adds the reproducer.

Task-number: QTBUG-132133
Pick-to: 6.8
Change-Id: I2e416fb7344830cd5e0d945cce61491cd6f4a7a5
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 05b9a4b2deefd586356e1f36d84372b06e74cfe3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-24 22:24:05 +00:00
Mike Chen
b6108318c2 QFactoryLoader: load extraSearchPath first
Since `QT_QPA_PLATFORM_PLUGIN_PATH` or `-platformpluginpath`
 specifies the path to platform plugins, `extraSearchPath`
 should be loaded first.

Pick-to: 6.8
Change-Id: I2e62fbf2021250ca864c669a7bbd7d56acd67d1e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 457580936ddebc73e8a24fc8af0d342084b3a0b5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-23 04:08:12 +00:00
Marc Mutz
7b5dbe165d QDecompressHelper: fix compilation with GCC 9
GCC 9 doesn't accept [[unlikely]] between the (condition) and the
compound-statement of an if, in both C++17 and C++20 modes:

  qdecompresshelper.cpp: In member function ‘qsizetype QDecompressHelper::readZLib(char*, qsizetype)’:
  qcompilerdetection.h:1048:31: error: attributes at the beginning of statement are ignored [-Werror=attributes]
   1048 | #    define Q_UNLIKELY_BRANCH [[unlikely]]
        |                               ^~~~~~~~~~~~
  qdecompresshelper.cpp:597:54: note: in expansion of macro ‘Q_UNLIKELY_BRANCH’
    597 |         if (ret == Z_DATA_ERROR && !triedRawDeflate) Q_UNLIKELY_BRANCH {
        |                                                      ^~~~~~~~~~~~~~~~~

See also https://stackoverflow.com/questions/51797959/how-to-use-c20s-likely-unlikely-attribute-in-if-else-statement

Put it into the compound-statement instead, then GCC 9 accepts it. The
two are equivalent, because [[likely]] marks a path, and there is no
selection statement between the two positions.

Amends 5ae84d0afbd3690a2c003d06d920566a5d56dc8c.

Change-Id: Iac1970219c98a1c26e450dfe6bad6583e4d32c29
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7a7804d4b454021d68d1d5138d134ef62abfcdb3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-22 16:28:52 +00:00
Marc Mutz
fc29f57a17 q23type_traits.h: use is_scoped_enum_v from std
We don't like surprises in qNN, so use the real is_scoped_enum_v from
std instead of adding the _v version outselves, even in C++20.

Amends 03a7be37806a32e9a8ac963b309812d6b8f125f6 and
63a8f657c2236829f16016602d9c0098b089d35e.

Change-Id: I7f9149678b95f7a59643152abf5a627e226cc058
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 40501ffbb441ce48733b3733b7ab781c7db8cca8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-22 13:50:51 +00:00
Christian Ehrlicher
4354d7797e QDrawUtil: use QPainterStateGuard
Replace the internal PainterStateGuard class with the now public
QPainterStateGuard.

Change-Id: I9c072ce6e45ddfe2d0a8aba789311193788dee5a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 204df603ef43be921e0eecae4d4af0ae6026787f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-22 09:19:05 +00:00
Christian Ehrlicher
6f7b8ada85 QCommonStyle: use QPainterStateGuard
Replace the internal QPainterStateSaver class with the now public
QPainterStateGuard.

Change-Id: I56285cb469cec43071320e87ac378674fd99c06b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7690b6260eac12958c97d642421e27680ca57496)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-22 09:19:04 +00:00
Wladimir Leuschner
4eaaf89db5 QWindows11Style: Adjust Subline for QLineEdit to fit rounded corners
Reduce the size of the subline for QLineEdit to fit the begin and end of
the rounded frame corner.

Task-number: QTBUG-132261
Pick-to: 6.8
Change-Id: I879f30c2bdc6601fef4738aeec71d7ab7bcee22c
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 5e656b9ea3c192f389b7e4f7aa2ae6b010cec306)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-22 09:19:03 +00:00
Wladimir Leuschner
4c2f439001 QWindows11Style: Align QSpinBox rect to match QLineEdits rect
The content rects for QSpinBoxes were smaller than QLineEdits rects for
UI elements that should have the same size. This patch increases the
content rect for QSpinBoxes.

Task-number: QTBUG-132261
Pick-to: 6.8
Change-Id: I59e752b719399c5845ab3ef81c6e271deda16273
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit a53e095882551caf3684a1f6a205b6c7d76a8913)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-22 09:19:02 +00:00
Alexey Edelev
8f1438b1a8 Avoid creating Plugin targets if the dependencies are missing
The plugin lookup mechanism doesn't handle the situation, when the
plugin is available but it's private dependency(static plugin case)
is missing. In this case we currently silently bypass the dependency
lookup and create targets. So users see the confusing message about
missing linked target, like:

   Qt6QSQLiteDriverPluginTargets.cmake:61 (set_target_properties):
   The link interface of target "Qt6::QSQLiteDriverPlugin" contains:
     SQLite::SQLite3
   but the target was not found.  Possible reasons include:
     * There is a typo in the target name.
     * A find_package call is missing for an IMPORTED target.
     * An ALIAS target is missing.

This indeed should be handled properly and we should omit creating
targets especially if users don't really use the plugin directly.

Also if dependencies are not satisfied it looks logically to set
the <plugin>_FOUND to false as this will be yet another indicator
for user that the plugin is not found.

Task-number: QTBUG-132244
Pick-to: 6.8 6.5
Change-Id: I8685163df0dee3a728c724901f69780569ffcad5
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 8d0283ad2cae3d8fbd4b1b7ee5c6454f7fcc079c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-21 04:51:58 +00:00
Eskil Abrahamsen Blomfeldt
610ee0c504 Don't include bearing of mid-string characters in max width
When calculating the maximum width of a text layout, we
would add the text width of each substring *after* we had
added the negative right bearing of the last character to it.
But the bearing of the last character in a wrapped substring
does not actually add to the maximum width unless it is the
last character of the *whole* string.

Prior to 250117086ff15bba79df8f0e15ee66192edc9ea9 this was
not noticed, because the last glyph in the substring would
typically be a space and the space does not have any
bearings (when doing wrapping on individual characters it
could still happen). After the change, the previous glyph
for which we get the right bearing will be the last
non-whitespace glyph. If this happened to have a negative
right bearing, we would add this to the max width and
end up with a larger max width than we should.

This caused a test failure in tst_qquicktext.

This test prefers the text width without the bearing (i.e.
the *advance* of the substring) unless the line is manually
wrapped or it is the last line of the layout.

Pick-to: 6.8
Change-Id: Iba1a5ad48d575683672400f0572dfa683a0f2d9c
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
(cherry picked from commit c08a92307d6d9fa9d9d9a1f301e3f2a65374e99a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-21 04:51:43 +00:00
Tor Arne Vestbø
e266949979 Apple: Use automatic rendering mode for icon engine
When requesting symbol icons the OS automatically chooses a rendering
mode per icon. Most icons use the monochrome rendering mode by default,
but some of them use the hierarchical.

We don't want to override this choice by always using hierarchical,
as that doesn't match the look of most icons in the system and may
be surprising to the user.

We still want to support tinted icons, based on the QPalette. For
iOS this is easy via [UIImage withTintColor:] but for macOS we
have to do an extra render pass. Unfortunately we can't use
configurationWithPaletteColors with a single color, as for the
hierarchical icons this will produce a different looking icon
than if we tint the entire icon.

[ChangeLog][macOS/iOS] The Apple icon engine, used for theme
icons on macOS and iOS, will now use the default rendering
mode for icons, typically monochrome, instead of always
using hierarchical icons.

Pick-to: 6.8
Change-Id: I9e66d848222e8ed0f7f20897454f27446bf0fd81
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9f392c09a1d30e48494b4df0e2f5f531c7e4ec4b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-20 15:38:18 +00:00
Mårten Nordheim
b91edac40d tst_QHttp2Connection: make settings exchange wait for acknowledgement
Is needed when sending more SETTINGS frames during the test later

Task-number: QTBUG-132277
Pick-to: 6.8
Change-Id: I24b2a5d1b2e7aecd8687db5b24f37233df3b91dd
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 6e7a15f5c50a94216bcf35241ec008e6c419ba18)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-20 15:38:18 +00:00
Toni Saario
7ce68e59fd Increase VxWorks stack size
Increases to around 16MB with the format change.
Required by some tests.

Change-Id: Ia41436b4269220f84271b614ea6f2b96ca605c32
Reviewed-by: Simo Fält <simo.falt@qt.io>
(cherry picked from commit 75d87caef70ff79b4db04834d28daa1905f0d5a0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-20 15:38:18 +00:00
Juha Vuolle
651b515074 Change QImage::mirrored() deprecation from Qt 6.10 to Qt 6.13
The deprecations aren't urgent, and allowing more time for users to
adapt is appropriate. In addition, also suppress the deprecation
warnings when compiling the related autotest.

Resulted from API-review.

Amends: 577946c1f05aaaa2a3f9682001aeb4144386b26b

Task-number: QTBUG-132090
Change-Id: Ia0c07ab510a9a9c8722892fcd94f58f6ec287059
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 0aa07ce77237dacc58de5939d5a239fb8997da7a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-20 15:38:17 +00:00
Christian Ehrlicher
1319dcf472 QWindows11Style: Adjust position of MDI subwindow icon
The y position for the MDI subwindow icon was not calculated correctly
so the icon was not painted vertically centered.

Pick-to: 6.8
Task-number: QTBUG-130673
Change-Id: I5f9023820a4e4b4288017869ac4088fe2669ce50
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 6e29a94b547fbafa69e97ac02aeb33edad63f2ae)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-20 15:38:17 +00:00
Marc Mutz
9cd2e3ffef qtesttostring.h: standardize on unique_ptr<[]>
... instead of QScopedArrayPointer.

Less Qt code (which we're supposed to test with this library) and more
consistent with the tuple implementation.

Also makes the header clean w.r.t. upcoming QT_NO_SCOPED_POINTER.

Pick-to: 6.8
Task-number: QTBUG-132213
Change-Id: I3705b8db89e909e3f1e37ad6a31aaba6f9af899a
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f405925829ca37af47ecbb291bdb8a95a606e024)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-20 15:38:17 +00:00
Christian Ehrlicher
ecc31955f1 QWindows11Style: adjust text rect for CC_TitleBar
The adjustment for the textrect was wrong - the bottomRight point must
be moved by -1/-1, not 1/1.

Pick-to: 6.8
Task-number: QTBUG-130673
Change-Id: I6c099fdd9a03188e7a5c7852b1912ed9b2801f7a
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 2c85e5d22215f24bd46d07a1183393e52702493f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-20 15:38:17 +00:00
Christian Ehrlicher
f349040b39 QDrawUtil: Cleanup qDrawPlainRoundedRect/qDrawPlainRect
Fix the style and use PainterStateGuard instead own save/restore
functionality because PainterStateGuard is already available and used in
those functions.

Pick-to: 6.8
Task-number: QTBUG-132187
Change-Id: Ie454b6cffe03444d88f13d15adb19a7e7783a493
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 1fb86f1f84bb56dab60bc15604c09a14157d6f10)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-20 15:38:17 +00:00
Volker Hilsheimer
319b31a5a2 QTestLib: Remove logging category declaration from public header
The lcQtGuiTest category is only used in qtestsupport_gui.cpp, so
declare it there as a static logging category.

Addresses header-review comment, amends
5ac4f04325a56d47812f528fe31ceb0d4932f664.

Task-number: QTBUG-132090
Change-Id: I5b2a93822a698f55c52c1be87ebf8a689f49e2a3
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
(cherry picked from commit b957dfc6e06deed64e20e8eee5d2164250b28b95)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-20 15:38:16 +00:00
Thiago Macieira
1596b5855c QDebug: constrain the new Standard Library op<<
So they be SFINAE-ruled out when either the key or (for associative
containers) value types don't provide their debug-streaming operators
either.

Amends 850d4895be565931d18c92e5e2f9a33b7f26de6d,
0c96528e8d43ad4309bdca14b179a5045984655a,
a9fe57fefaac0cb047e4c02e0b8c8f8327e0a58c.

Fixes: QTBUG-132104
Task-number: QTBUG-130290
Change-Id: I1d6703b1fdf6cfd03799fffd33191d8028ecc123
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 8f958a6e2dcff5bb9b01442a19f5605f357c6e7e)
2024-12-20 08:17:40 -03:00
Christian Ehrlicher
7ab2885594 QSqlQueryModel: add new function to refresh the model data
This function re-executes the query used by QSqlQueryModel and refreshes
the data from the database. The query must not use bound values as these
values are not preserved.

[ChangeLog][QtSql][QSqlQueryModel] Added refresh() to refresh the model
data from the database.

Task-number: QTBUG-123603
Change-Id: I3f1d779e07b88565abe825c31cfc4d7d1b2312c4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 1bd883dbc15c4016f78d421afac2ac9f31ec4874)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-20 11:17:40 +00:00
Christian Ehrlicher
fc29afbe1a QSqlDriver: return the connection name of the assoicated QSqlDatabase
A QSqlDriver instance is directly bound to a QSqlDatabase object. But
there was no way to get the QSqlDatabase out of a QSqlQuery/QSqlDriver.
Fix it by storing the connection name also in the driver during
creation and add a getter for it.

[ChangeLog][QtSql][QSqlDriver] Added connectionName() which returns the
connection name of the associated QSqlDatabase instance.

Task-number: QTBUG-123603
Change-Id: If78b85413cf6ca965ff6bf9f3600cb54169b5569
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 5b07e3de3fe5335d9338c65ca40cfe656a389167)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-20 11:17:39 +00:00
Eskil Abrahamsen Blomfeldt
ed1032975e Include right bearing in width of layouts wrapping on spaces
When we're calculating the width of the layout, we include the
right bearing of the last character in the text line if it is
negative (i.e. it exceeds the advance width). We do this by
storing the last glyph that has been verified to fit in the
line, so that we can retrieve its right bearing when we find
a break.

However, when we were wrapping on spaces this previous glyph
would always be a space, and the right bearing would
subsequently be 0. But then the trailing spaces would be
trimmed and the right bearing of the actual last glyph
would not be recorded and never added to the text width.

This caused a failure in tst_qquicktext on Windows with both
DirectWrite and Freetype: This was purely unlucky, because
the metrics of the Tahoma font happened to be such that the
right bearing on the 'k' was enough to cause a line to
overflow. Since we didn't account for it when setting the
width, we ended up with unexpected line breaks, causing the
test to fail.

This did not happen with GDI, since it rounded the right
bearing of the character down to 0 (which was actually
visible in the layout, in that the k was painted a fraction
of a pixel outside the text layout's width).

In addition, QTBUG-130313 was causing us to pick a different
font when resolving the non-existent font requested by the test,
so therefore the bug was not found immediately when moving to
DirectWrite as the default but only when QTBUG-130313 was fixed.

We fix this by
  1. When adding a chunk of whitespace, we record the previous
     non-whitespace glyph that has been verified to fit.
  2. When adding a chunk of non-whitespace, we only record the
     previous glyph verified to fit *if* it is not whitespace.
	 Otherwise we keep whatever we recorded before adding the
	 spaces.

Pick-to: 6.8
Fixes: QTBUG-132075
Change-Id: I8d9a2f3197068f5f93520d217a6bb89633644e95
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
(cherry picked from commit 250117086ff15bba79df8f0e15ee66192edc9ea9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-20 07:24:35 +00:00
Eskil Abrahamsen Blomfeldt
51ed0b024b doc: Clarify usage of QFontMetricsF instead of QFontMetrics
A common source of issues is that people do not consider that
fonts can have fractional metrics and use QFontMetrics for UI
purposes, causing bounds and eliding to be inaccurate.

This is not very surprising, since the class name sounds very
much like what you should prefer by default and the docs
didn't even contain links to the QFontMetricsF class.

It might make sense to deprecate the class, since it really
does not serve any useful purpose, but for now we at least
document the issue up-front so that users can easily find
the alternative.

Pick-to: 6.8 6.5
Task-number: QTBUG-132102
Change-Id: I69756c561e5dee448a9d0a7d85af1a9b15ff1ae3
Reviewed-by: Nodir Temirkhodjaev <nodir.temir@gmail.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9a6036dea2cfe0cec555a503445aed93fed3d985)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-20 07:24:18 +00:00
Yuhang Zhao
d1c0eb2291 Windows theme: don't refresh anything unless theme really changed
Refreshing the global theme may be expensive for large scale applications, and even if Windows sent corresponding message,
it may be triggered by many reasons, not just the system theme,
so no matter what we'd better add an extra check.

Change-Id: I70847aa54fb4af37c81855a62330a4bce31ff104
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 9b924a4907a4a2b27ee52e807fd419caf219f655)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-20 07:24:11 +00:00
Ivan Solovev
b2bb9ef0f1 Refactor hasCompareThreeWay check
Use structs derived from std::false_type and std::true_type instead
of boolean constants. This allows us to make use of std::conjunction_v
and std::disjunciton_v in the conditions, thus making use of
short-circuit evaluation and saving unnecessary template
instantiations.

Still keep the constexpr bool *_v constant for the cases when we need
a signle check only.

Amends 678e9f614bc5a05d2ff16cf916397998e7cdfca1.

Pick-to: 6.8
Change-Id: If2ab48ef910e97f241f5922d4108a271bc532f3a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8784ea16a6bc66ac481d5cbf2dd1ece2d57a836b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-20 07:23:29 +00:00
Tim Blechmann
9e22277d28 Cocoa: emit config error when using 15.0 as deployment target
QCocoaScreen uses removed APIs, which cause the code no fail compilation
with CMAKE_OSX_DEPLOYMENT_TARGET=15.0.
Adding a compile-time check to detect this early.

Task-number: QTBUG-128900
Pick-to: 6.8 6.5
Change-Id: I7eeb60f5769af6b1622efd1e0637e85a038b7930
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit b6f3695a80f5abfbcfb0ebb5b03358b8e7bbbaf9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-20 07:23:12 +00:00
Topi Reinio
3b4a7d4881 Doc: Set trademarks page in global configuration
The new \tm command appends a trademark symbol and links to the
trademark documentation page if `navigation.trademarkspage` variable
is set. As we have such a page in qtdoc repository, set the variable
in the global configuration. This works as all Qt module docs have a
dependency to the `qtdoc` documentation set.

Pick-to: 6.8
Task-number: QTBUG-124393
Change-Id: Iabc6e7e5afe5114eac79947f0feb512458f1c4da
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit 429f565017f7213a91eb0cf43966b2148e0bb651)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-20 07:23:04 +00:00
Volker Hilsheimer
43ab4d5c7b QPainterStateGuard: make movable, add test coverage
There's no real reason not to be able to move a state guard.

Since a moved-from QPainterStateGuard must not have a restore-
level count, we have to implement the move-constructor explicily.
Add a test case, which verifies that we don't end up with an
un-balanced save/restore count, and that verifies that we would
trigger the Q_ASSERT if we do.

Address comment from header review,
amends 9ecf47a8a8d11227ecf192246d7df7c2c4dc9105.

Task-number: QTBUG-132090
Change-Id: I1db135bf48c0fa0a7bac4fdae7b7263c356b5eb6
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
(cherry picked from commit ec3a5f4994a2bafc65fa8e01fb0861219580f622)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-19 22:31:05 +00:00
Thiago Macieira
55a46ec005 QCommandLineParser: include the positional arguments' sizes in --help
We were mostly ignoring them because it looks like most people's options
were longer than their positional arguments. The rest must have just
accepted the enforced wrapping.

But if you have very short options like single-letter only ones or none
at all, the positional argument wrapping is unnecessarily short.

[ChangeLog][QtCore][QCommandLineParser] Made it so the positional
argument descriptions are taken into account in the aligning of text for
helpText().

Pick-to: 6.8
Fixes: QTBUG-131716
Change-Id: Ib1eee62c7cf4462f6a26fffdec233ba849ebf158
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 8928b0fbb9ca4caf9b63a32b3d2a73a6da096755)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-19 20:42:53 +00:00
Assam Boudjelthia
f10b13e469 Android: document androidtestrunner tool
Add documentation and usage of androidtestrunner tool.

Pick-to: 6.8
Fixes: QTBUG-84330
Change-Id: I03aa67ebf0ba807f20595547f2598d905080a878
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
(cherry picked from commit 5735d7ac861fe99a71d8044977e5f487c401ca12)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-19 20:10:38 +00:00
Tor Arne Vestbø
5051e2b97b Extend blacklisting of tst_QWidget::showMinimizedKeepsFocus to macOS 15
It's flaky on all version.

Pick-to: 6.8
Change-Id: I01b2f0877efc100578c55d69e9f9ed65c02b2aab
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 1ce019815ba62245fd8ae6e8fb5e47f77621c3be)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-19 20:10:38 +00:00
Ahmad Samir
d5cff9be0e QDecompressHelper: add comment for translators in readBrotli()
Spotted by Friedemann Kleint in code review.

Amends 763c47e055376bf6dbd4cd8fe1603b88aa3b72f0.

Change-Id: I3092c51964c167da30b6d1400ab2ba1e2f4df829
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit d983a402a5c7106935439c95d08eaadbf0b26b60)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-19 20:10:38 +00:00
Eirik Aavitsland
a994bc80fe Update bundled libjpeg-turbo to version 3.1.0
[ChangeLog][Third-Party Code] libjpeg-turbo was updated to version 3.1.0

Pick-to: 6.8 6.5 5.15
Change-Id: I321ae095b4ed826ceb940cbf13a63ec1a836acb3
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 1a5afe625be1ed936d2fc4da98ed1c8fa574ee7b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-19 20:10:37 +00:00
Joerg Bornemann
8c3e5bcd21 Rename qscopedpointer.cpp -> qscopedpointer.qdoc
It only contains qdoc blocks and wasn't even listed in SOURCES.

Also changed the license to be in line with QUIP-18.

Pick-to: 6.8 6.5
Change-Id: I2c90300ddfd47c3f693dc84cb86f326fa185dd84
Reviewed-by: Lucie Gerard <lucie.gerard@qt.io>
(cherry picked from commit 1cdf813e221b5aa133bc85cb928e329ef1dea896)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-19 12:54:39 +00:00
Joerg Bornemann
9834571282 CMake: Split off private module config packages
[ChangeLog][CMake] Private Qt modules have been split off into separate
Qt6FooPrivate CMake config packages. A call to find_package(Qt6Foo) will
now implicitly find_package(Qt6FooPrivate). It's not an error if
Qt6FooPrivate isn't available as it may be the case on certain Linux
distros that split their Qt module packages into private and public
parts.

For every public module Qt6Foo that has an associated Qt6FooPrivate
module, create a separate Qt6FooPrivate CMake config package.

Let Qt6FooPrivate find Qt6Foo. This is a required dependency.

Let Qt6Foo find Qt6FooPrivate if it's available. A message of log level
VERBOSE is issued if Qt6FooPrivate is not found.

Implementation notes: In QtModuleConfig.cmake.in, we pull in the private
module. This is not part of the *Dependencies.cmake file, because

1. The Qt6FooPrivate package references the Qt6::Foo target, therefore
it must be available. And Qt6FooDependencies.cmake is loaded before
creating targets.

2. The dependency needs to be optional, and we don't have facilities for
optional dependencies in Qt6FooDependencies yet.

3. We'd have to avoid recursion, because of the Qt6FooPrivate -> Qt6Foo
dependency.

Fixes: QTBUG-87776
Change-Id: I8f23f07da7ca76486f87b759e197174c11e13534
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit fbbf4ace0188b9718b6d7808021c0b887fd52d9f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-19 11:11:45 +00:00
Marc Mutz
072f2a2241 QXmlStreamReader: use QOffsetStringArray::viewAt()
This auto-computes the string's length without a NUL-byte scan, and
also fixes a GCC 14 unity-build C++23 warning:

  In function ‘constexpr qsizetype QtPrivate::lengthHelperPointer(const Char*) [with Char = char]’,
    inlined from ‘constexpr qsizetype QtPrivate::lengthHelperPointer(const Char*) [with Char = char]’ at qbytearrayview.h:69:28,
    inlined from ‘constexpr QLatin1String::QLatin1String(const char*)’ at qlatin1stringview.h:52:62,
    inlined from ‘constexpr QLatin1StringView contextString(QXmlStreamReaderPrivate::XmlContext)’ at qxmlstream.cpp:814:90,
    inlined from ‘void QXmlStreamReaderPrivate::checkToken()’ at qxmlstream.cpp:4018:85:
  qbytearrayview.h:77:16: warning: ‘strlen’ argument missing terminating nul [-Wstringop-overread]
     77 |     while (data[i] != Char(0))
        |            ~~~~^
  In file included from unity_0_cxx.cxx:412:
  qxmlstream.cpp: In member function ‘void QXmlStreamReaderPrivate::checkToken()’:
  qxmlstream.cpp:769:23: note: referenced argument declared here
    769 | static constexpr auto QXmlStreamReader_XmlContextString = qOffsetStringArray(
        |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Amends c4301be7d5f94852e1b17f2c2989d5ca807855d4, which was picked to
5.15, but didn't use QOffsetStringArray there (and unity-builds exist
only since 6.5), so only picking to 6.5.

Pick-to: 6.8 6.5
Change-Id: Ib50369aed6e8248fb88f43c7569c8a435c2b152e
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 44366d07dca047f096d1366c43ba549c97150074)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-19 11:11:43 +00:00
Marc Mutz
da9ff584d1 Protect QT_ENABLE_STRICT_MODE_UP_TO against predefined individual opt-outs [6.9]
Since some of the Qt opt-outs are defined project-wide by the
buildsystem these days (e.g. QT_NO_QSNPRINF, ...), a module that
attempts to use QT_ENABLE_STRICT_MODE_UP_TO will hit warnings
regarding re-definition of these macros (definition on the compiler
command line, redefinition by qtconfigmacros.h).

To fix, guard the #define QT_NO_FOO's with #ifndef QT_NO_FOO.

Amends bd7d54249e3f2b6a9dd6b759c892d7c97d26c0aa (which was also picked
to 6.8).

Pick-to: 6.8
Change-Id: I88276c9ed01edde1495105cf5bd1e07b1fd244f4
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 752de4a0aabc305af16251a55edf247e043b1b18)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-19 10:44:24 +00:00
Marc Mutz
d328e8eaaf Protect QT_ENABLE_STRICT_MODE_UP_TO against predefined individual opt-outs [6.8]
Since some of the Qt opt-outs are defined project-wide by the
buildsystem these days (e.g. QT_NO_FOREACH, QT_NO_JAVA_STYLE_ITERATOR,
...), a module that attempts to use QT_ENABLE_STRICT_MODE_UP_TO will
hit warnings regarding re-definition of these macros (definition on
the compiler command line, redefinition by qtconfigmacros.h).

To fix, guard the #define QT_NO_FOO's with #ifndef QT_NO_FOO.

Amends 3a6c8e02b6d1b0574da52b0087092d0c74aa92c1.

Pick-to: 6.8
Change-Id: I457457d1e60dbd9362b987157ba089adc67d1d6b
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 0f416cbaaba46ddb039bbf33e1d70dbe80821d57)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-19 10:44:17 +00:00
Marc Mutz
6eb41440cd QTextStream: port from QScopedPointer to unique_ptr
In preparation of adding QT_NO_SCOPED_PONTER, which would be rather
pointless for users if public headers continued to mention the type.

Pick-to: 6.8
Task-number: QTBUG-132213
Change-Id: I6539e83158ab34e4fa4bd22b6d0ac5629a3b6db9
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b815c6f7fd71086c97fe6e9aa9472154be5fcc57)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-19 10:44:15 +00:00
Robert Löhning
e63884c593 QRadialGradient: Fix crash on huge x values
Credit to OSS-Fuzz

Fixes: QTBUG-130992
Pick-to: 6.8
Change-Id: Iefaa6964966f6828bc23a603f085d283189f1a3b
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 42bd879e2bc6e0d8370d320cca17df36ea68d570)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2024-12-18 22:08:02 +01:00
Christian Ehrlicher
3c0f08ab70 QBoxLayout: don't crash on passing invalid index
Passing an invalid index gives an assertion in debug mode and crashes in
release mode due to an out-of-bounds access. Fix it by appending the
given widget (same as passing a negative index which is documented).

Pick-to: 6.8 6.5 6.2
Fixes: QTBUG-130275
Change-Id: Id0c245e185acc36e5d07cea1d22619bb0e9eee07
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 0f9062ec71021c256dba7ee8498f036d7aac0821)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-18 20:17:36 +00:00
Christian Ehrlicher
72f48d0840 Windows11Style: Fix horizontal scrollbar arrows in rtl mode
The arrows for horizontal scrollbars must be swapped in rtl mode.

Pick-to: 6.8
Change-Id: I517fcea19837a6438edc261e066930218b71ce28
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 02920ef05a980d9bb670e1f8a4b84e0b6cef13c1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-18 20:17:36 +00:00
Mårten Nordheim
ab667d881d Schannel: chop off garbage bytes if encryption fails
Because they would break communication (or loop infinitely) otherwise
since we use the presence of bytes in the returned buffer to know if
there is still something we need to transmit.

Amends 4e60a6b556d91ab797aebb7422666a685a726755

Change-Id: If72c1a142d4567f69d78177250b0218c5ca999fd
Reviewed-by: Even Oscar Andersen <even.oscar.andersen@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 1efcc0df6adab11e7239f5f12a13766a58e2c1ea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-18 20:17:36 +00:00
Topi Reinio
5fa520a77c Doc: Fix usage instructions for the \youtube macro
The example configuration included a space character that caused a
syntax error parsing the .qdocconf.

Replace the hardcoded qhp `QtDoc` project name with a placeholder.

Pick-to: 6.8
Change-Id: Iadf3a50e030f02182016ed9832f4f59d29f82c57
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit 4051ec3356bded10cd7ac66dc1149259bc48d36b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-18 20:17:36 +00:00
Shawn Rutledge
019feea9b1 Always send QContextMenuEvent after the contextMenuEventType event
Both widgets and Qt Quick Controls are unable to avoid accepting the
right-click events (press and/or release) in at least some cases.
In the Windows UI pattern of allowing the user to select something by
pressing (and maybe dragging) with the right button and then getting
a QContextMenuEvent afterwards, it's sensible for the code that does
the selection to accept the mouse events, because that code is only
concerned with selection, not the context menu. And in Controls,
Pane is accepting all mouse events just to prevent propagation to
other controls underneath. (That might not be so great, but we don't
have a better way yet.) In legacy Qt Quick, accepting the event results
in an exclusive grab; so in fact, Pane gets the grab, so we can't use
that either, as a way to distinguish "stop propagation" from "this item
is handling it completely, nothing more needs to be done". So it
doesn't make sense for QWindowPrivate::maybeSynthesizeContextMenuEvent
to check the grabber either.

Amends 357c64a99607456133bfabf86d6b67162717cb29 and
84a5f50c7766c99f62b22bb4388137e0aa8dd13d

Task-number: QTBUG-67331
Task-number: QTBUG-93486
Task-number: QTBUG-132066
Fixes: QTBUG-132073
Change-Id: I822cada05cfef27afe6a44faf170585f027061f7
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 70c61b12efe9d1faf24063b63cf5a69414d45cea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-18 20:17:35 +00:00
Lars Schmertmann
835475873b Avoid linter warning "AndroidGradlePluginVersion"
This is a Qt dependency that the user cannot influence.
We did this in  cfefce57a4ff446305cd1f839e7c5203bac7a6c5
with "GradleDependency"  before. It is a Qt dependency
that the user cannot influence.

Pick-to: 6.8 6.5
Change-Id: I01ef84eab7ab743d5ea9eb15208ef9c567dd2a43
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit ab2a0438ef8b6cc2c73ab0f33d353d00c6599cd9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-18 15:40:50 +00:00
Alexey Edelev
abfaf5189c Remove _qt_internal_find_dependencies
Clean up the dead code according to TODO statement.

Pick-to: 6.8
Change-Id: I9bdf10067d3a1324d584cebc51cf4555f00f717a
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 64435289027d53c9dace16eaa38087369fee6c4c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-18 14:13:05 +00:00
Mårten Nordheim
2aaaf7cf12 QThread: Link to QThreadPool::(set)serviceLevel
QThreadPool's functions already links to the QThread ones, but they didn't
link back.

From the API review.

Change-Id: I02853d8110806f735b748d022a1cfaea5a72d603
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit bbcf47a07d3ec138016d4f997c9b4849598c2f10)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-18 14:13:03 +00:00
Mårten Nordheim
0a4ff045f1 Http2: Ignore RST frames on already-closed streams
Some http servers like to send RST frames whenever they send their response.
The stream is already closed at that point so it's a little weird, but the
RFC doesn't disallow it, so we'll just ignore the frames.

Fixes: QTBUG-132124
Change-Id: Ic26e249437b739830935e2f3feec572687579b21
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 2c71fdf043ca94d1c567f169d51245e2702bec19)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-18 14:13:01 +00:00
Marc Mutz
aac98b795d QDebug: make std::optional stream operator SCARY
Piggy-back on the recently-added, type-erased, std::tuple stream
operator to handle std::optional the same way.

While std::optional doesn't support the Tuple Protocol, and we
therefore can't use putTuple() directly, we can still use
putTupleImplImpl() if we set up its arguments manually.

[ChangeLog][Potentially Source-Incompatible Changes][QDebug] The
std::optional streaming operator is now a member of QDebug, not a free
function. This breaks users that rely on the exact definition of the
operator (e.g. `operator<<(d, opt)`). A backwards-compatible fix is to
call the operator with infix notation (d << opt) only, and to avoid
const QDebug objects.

Change-Id: Ib040d65953ca9d3892aee5bdb597d6d30a9694b1
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 08320bfe2b7387d6f488d405dddf9d3aba6434ec)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-18 10:05:26 +00:00
Marc Mutz
94928669c1 QByteArrayView: add a ctor for arrays of unknown bounds
This appears to not have worked, ever, so add it as a new feature, for
view API symmetry, not as a bug-fix.

The new constructor is available for all compatible byte types,
because it is more like the (ptr) constructor (which is available for
all compatible byte types) than the known-size-array constructor
(which is only available for char).

This does not affect QB/QBV overload sets, since they could exist
ambiguity-free only if one of them is a Q_WEAK_OVERLOAD.

The GHS compiler doesn't like the CanConvert static_asserts, so
comment them out for it. The functionality itself is tested by
the fromArrayWithUnknownSize test.

[ChangeLog][QtCore][QByteArrayView] Made construction from arrays of
unknown size compile. Such arrays will use the const Byte*
constructor, determining the size of the array at runtime.

Task-number: QTBUG-112746
Change-Id: I201033656f123b09644e5de447cd5d7b038e5154
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 54d47f8390cb85c5b0f0ac050b5aa5a934d798b0)
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-12-18 08:07:37 +01:00
Friedemann Kleint
6cd5ea15ef Use QPainterStateGuard in examples
Complements 9ecf47a8a8d11227ecf192246d7df7c2c4dc9105.

Change-Id: I65456f8fd34bf9d316b72c4286e1b15789309f7c
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 1dc15c11db88f96a916258acea80a86bfa7c87cd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-17 21:18:54 +00:00
Volker Hilsheimer
3339990b4b QPainterStateGuard: make InitialState enum scoped
Address comment from header review,
amends 9ecf47a8a8d11227ecf192246d7df7c2c4dc9105.

Task-number: QTBUG-132090
Change-Id: Idddca104b93ee23f4bac8621f1087a0ae7a1fe24
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit ec011141b8d17a2edc58e0d5b6ebb0f1632fff90)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-17 21:18:54 +00:00
Christian Ehrlicher
0dd2561d54 QStyleSheetStyle: Fix resetting fonts for subwidgets
When a compound widget is styled with a font through a property and the
default styling has no font settings, the font was not reset to the
parent font but left it the styled state.
Fix it by not resolving the current font when the style rule has no font
settings - use the parent font directly instead.

Fixes: QTBUG-131685
Pick-to: 6.8
Change-Id: I8e79423cfeff24143cd051b282503c4565125b4d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 5731fe051e48e7a256ef31ae93cfb89ce8d871cc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-17 21:18:54 +00:00
Volker Hilsheimer
a8b8a6fd6d QPainterStateGuard: document that restore() asserts when already at 0
Address comment from header review, amends
9ecf47a8a8d11227ecf192246d7df7c2c4dc9105.

Task-number: QTBUG-132090
Change-Id: Ie6eed6f83fcdde0f90514b6016a65905505073e0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 8ae4e3efdf80b658f8de19b13bfbea68e1dbd875)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-17 18:20:00 +00:00
Wladimir Leuschner
ad16cd816a WindowsQPA: Draw custom titlebar with QPainter
- Draw custom titlebars that are requested by setting the
  Qt::ExpandedClientAreaHint with QPainter instead of GdiPlus.
- Draw the application icon, in case it was set, for the custom titlebar
- Add DPI awareness to the custom titlebar

Change-Id: I276e7d8948e5a436f1835d96b59756b7237f63d2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 438aa1524ee99fd636dc02a7181857ade71bb101)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-17 15:14:12 +00:00
Timur Pocheptsov
c39a944e74 Revert "qnsview_drag: only ignore key modifier while dragging 'within the application'"
This reverts commit 4332cb313469de1525afe3cddd792d7bc7e08a14.
The original idea of distinguishing between context (outside/within application)
is not working anymore - it's always outside (except the moment when
a mouse pressed inside the window, which is immediately followed by
'outside application' context). So in fact we never ignore key
modifiers.

Fixes: QTBUG-132091
Pick-to: 6.8
Change-Id: I560a48ccf8f8ee1a55f812be6af18b1dd7e25c78
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 7740ac36d27740ff9204cc2626f58620b7e214cb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-17 14:16:23 +00:00
Ivan Solovev
cc2213ab27 Change QCommandLineParser::showMessageAndExit() argument order
Looking at other similar Qt APIs, the type argument usually comes first.
The typical related examples can be QMessageBox() constructor taking
QIcon as a first parameter, and qFormatLogMessage() function, taking
message type as a first parameter.

This patch changes the order of arguments, so that MessageType enum
comes as a first argument.

Amends bad618606d64e943e3fa78e7d1dbc8e1fab55480.

Found in Qt 6.9 API review.

Change-Id: Ibbdef755a8676a2c556fe7f1c95009ad51320b98
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 56114f4d1ed6ec26ff59a596caf09f5b4e0f5d68)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-17 14:16:23 +00:00
Ivan Solovev
e69e53de8e Add docs to the new QCommandLineParser::MessageType enum
As a drive-by: move the \since command in the showMessageAndExit() docs
to the right place.

Amends bad618606d64e943e3fa78e7d1dbc8e1fab55480.

Change-Id: I4e6e6d63929029879867624e4007941edfca9cd9
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 6692beace9bb5f461d71935e500e1c6ccfa97fd1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-17 14:16:23 +00:00
Bartlomiej Moskal
6e3d2ad44f Android: Fix for multi-ABI build in androiddeployqt
7499fd0229d63f969bf6ca58d3b764b96395bed2 commit cleans up the localLibs
to not add dependencies to the libs.xml file as they will not be
satisfied.

Mentioned change created a regression with multi-ABI build. It happens
because in qtDependencies[ARCH] container, some libs just have different
atchitecture prefix.

This commit remove architecture prefix when checking libs in
qtDependencies container.

Fixes: QTBUG-131707
Pick-to: 6.8
Change-Id: Iae54779bfa4bd143ec35353604724d8ec4e35ef2
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit e59308c5119caac5d4f1024c7d8147e9887cb246)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-17 14:16:23 +00:00
Ivan Solovev
7c332839e0 Specify an underlying type for QCommandLineParser::MessageType
And also add a trailing comma to the last element of the enum to
minimize future diffs.

Amends bad618606d64e943e3fa78e7d1dbc8e1fab55480.

Found in Qt 6.9 API review.

Change-Id: I1a30c344967005c9abc73e59980e56626e09cd7c
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 14cc2591ac06dbcee01c2b110e014db2993d7a1e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-17 14:16:23 +00:00
Tor Arne Vestbø
9610a7cbdc QCocoaDrag: Only update m_lastView when it actually changes
The underlying QObjCWeakPointer used to track the view requires
a bit of bookkeeping, so avoid updating its value unless the
view actually changes.

Pick-to: 6.8
Change-Id: I6a1aeaf0e6e0eb221d55de00c8f30259832e58fa
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 2e80e74f37980f62bb915983e61d6734fb416bcd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-17 14:16:23 +00:00
Tor Arne Vestbø
c8ae8244b4 QObjCWeakPointer: Clear existing associated object on assignment
If the existing m_object is the same as the incoming object the
call to objc_setAssociatedObject in trackObjectLifetime will
release the existing WeakPointerLifetimeTracker after assigning
a new one, which means we'd clear the QObjCWeakPointer's object.

We now reset the state up front.

Fixes: QTBUG-132256
Pick-to: 6.8
Change-Id: If2c08840d465ae6d190c87a4720a537fe9caa8dc
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 92012333d112dbdf2926117ec3bb123bd30ed9fc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-17 14:16:22 +00:00
Christian Ehrlicher
9b2e444811 QAbstractItemView: use 'int' as datatype for updateThreshold
... to sync it with the rest of the api.
This amends ff339819925ab550c48b53d9baaba43e5adebfaa.

Task-number: QTBUG-124173
Change-Id: I0ed4681bf7d3717f84a7e888affb0c8cae877c35
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 15a1ae90f5b6da3ffd50acda63ddd33ca14227f4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-17 10:52:59 +00:00
Marc Mutz
ee69826054 qthreadstorage.h: fix position of namespace macros
The file contains two implementations of the class template, one for
QT_CONFIG(thread) and one for without. Both are in the QT_NAMESPACE,
but each provided their own QT_{BEGIN,END}_NAMESPACE macro pair.

This is unneeded and may throw off scripts which use the macros as
insertion positions (like includemocs, which, however, operates on
.cpp files, not headers).

To fix, move the namespace macro pair to be around the #if
QT_CONFIG(thread) block.

Pick-to: 6.8 6.5
Change-Id: I56c1f9a4ef7df0fba54c72d8a213fa92573b826c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8553ffd8d147ecf6a713d12a360027b477dd59c8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-17 10:08:46 +00:00
Yuhang Zhao
3c0986a34c Windows: Fix title bar size calculation
The title bar calculation is terribly wrong and was
missed during review.

Change-Id: I0c7a860e747465e6a5e4d8aa5415a9701cf170fd
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit f6af3a581642170f0f4fe0d0563851715e045391)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-17 07:58:48 +00:00
Marc Mutz
9e86f73f82 QStringView: refuse construction from QStringRef
When QStringRef was moved out of QtCore, it was also incorrectly
removed from the if_compatible_container constraint, causing
QStringView{sr} to still match the general container QStringView ctor
overload, which doesn't preserve null'ness if data() doesn't return
null. By refusing to provide a constructor from QStringRef, we force
the compiler to use QStringRef's implicit conversion operators
instead.

This transitively affects QAnyStringView in the same way.

The tests can, naturally, only be in qt5compat, so define a macro to
communicate to tst_QStringRef whether it compiles against a fixed
QtCore or not.

Fixes: QTBUG-122797
Fixes: QTBUG-122798
Pick-to: 6.8 6.5
Change-Id: I64b75a8e421d2b6185615e3288ce3ad7fd8f15f9
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit a0e65398483729259cf58781949133c6055fdc7c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-16 20:44:29 +00:00
Volker Hilsheimer
cdfd686714 QSqlQueryModel test: don't copy a QSqlQuery
Move the query into the model, and use a local scope to make sure that
we don't use the moved-from query later.

Change-Id: I9d216e770733af8b0771280276dba0775209a802
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Dheerendra Purohit <dheerendra@pthinks.com>
(cherry picked from commit af760da54190d96b315ea8edeec00c86871af0d8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-16 20:18:13 +00:00
Tor Arne Vestbø
78051d03ca Document that QPlatformTheme::standardPixmap should always be a 1x pixmap
This reverts 59bbfb17db563d7e62b9f3158dab3cc6e7e68acd and
c853054910552f5fef04797222dde0d29a0c340d, as that approach
was causing issues for QCommonStyle::iconFromWindowsTheme,
for example in situations where the system has a 1x and 2.5x
screen, and the user requests a 16x16 pixmap or icon via
QStyle::standardPixmap or QStyle::standardIcon. In that
situation our smallest pixmap is 40x40, and we need to
downscale, causing blurred results on a 1x screen.

Change-Id: Ifa6e15d37d15954df689253c32eaa779885c567b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d884abaf8bdc1be74ee52306948c0be1986d738d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-16 20:13:30 +00:00
Christian Ehrlicher
eab71ff6b0 Windows11Style: adjust subline color in editable widgets in dark mode
The color of the subline in editable widgets was black in light and dark
mode. Fix it to use white in dark mode to make it visible. Move it out
into own helper function since it's used in at least three places.

Pick-to: 6.8
Task-nubmer: QTBUG-131585
Fixes: QTBUG-131586
Change-Id: Icca2b142a1ce0c3d7f722baa6d3635bae5950e1c
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 66d42b62b6f01205cf1db72e56ecb5166554e373)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-16 20:13:28 +00:00
Christian Ehrlicher
07ad8c8444 QStyleOptionViewItem: document 'widget' and 'locale' member
These two members were added during Qt4 times but never documented.

Pick-to: 6.8 6.5
Change-Id: Ife4abfc6d8883f4c26ce5b95d5c0cfd3adcbd6bf
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
(cherry picked from commit a90d9f4823bd6baf4cb660a942c2b1695441dbbd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-16 19:37:58 +00:00
Eskil Abrahamsen Blomfeldt
501f78855e Fix DirectWrite subpixel antialiasing on BGR screens
On monitors where the subpixel arrangement is blue, green, red,
our DirectWrite rendering would give the wrong subppixel
antialiasing, causing color fringes on text.

Like we do with Freetype, we determine subpixel arrangement of the
primary screen and use this as the default.

Pick-to: 6.8
Change-Id: I9ce7025449106a2376bd0ed02ce07b59c79438bd
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit d5cef74d8d71458500f979c0d31a7241b3fef9db)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-16 19:37:56 +00:00
Eskil Abrahamsen Blomfeldt
bfb80b7b45 Support variation selector when emoji segmenter is disabled
This amends cb2633468413d8c2a9e28d4c4a10b25e90dd3116.

The patch excluded the ad hoc parsing of variation selector
except when Qt was built without the emoji segmenter. The
reasoning being that the emoji parsing handles this correctly
now.

However, when setting the QT_DISABLE_EMOJI_SEGMENTER variable
in the environment, this is supposed to work as a fail safe
which gives you the original behavior, in case there are
regressions. Therefore, the variation selector handling needs
to be run also when this environment variable is set.

Change-Id: I2669d29016a552775461aad13e50459baecdc26f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit aaf7437db3a520ab14220a46cf9427cb9a8d915c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-16 19:37:55 +00:00
Eskil Abrahamsen Blomfeldt
f5e2166bbd DirectWrite: Remove ad hoc font resolution through GDI
In b8612eaa2a17e12e31ee28141cff1fb43e54c00e, we added a fail safe
where failure to find the font name through DirectWrite would
try loading it through GDI instead and if that was successful we
would register the family with the database after all.

However, the code assumed that CreateFontIndirect() would return
NULL if the font did not exist. It does not do this, but instead
selecting the HFONT on the HDC will give us a suitable alternative
instead. The result would be that any missing font family would
be registered with the font database through this mechanism, even
if it really didn't exist.

This code was added in an early version of the patch, however,
and it should not actually be needed anymore, since we in later
versions of the same patch also added logic to populate the
GDI-compatible family names
(DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES etc.). This should
take care of backwards compatibility with the GDI names for fonts.

Since the code has been reported to cause problems on some systems,
it's safest to just remove this hack.

Pick-to: 6.8
Task-number: QTBUG-130313
Change-Id: I7eca893d17796d9cac07391b7b947d28dd7cd920
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 355f54f7d5dd300c73bf203f12e24305d0e227c1)
2024-12-16 15:24:24 +01:00
Andy Shaw
9988cd2469 SQLite: Fix attrition file to have right version number
Pick-to: 6.8 6.5 5.15
Change-Id: I9fea5c8d19209c44b16916645e600735de929d80
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 311ac55f118dc88add297853318cd0cfd7c1c0d5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-16 07:13:13 +00:00
Assam Boudjelthia
440dcaca27 Android: handle quotes in hard-coded namespace in build.gradle
Remove quotes from the namespace values if they're set
directly to build.gradle.

Fixes: QTBUG-132150
Pick-to: 6.8
Change-Id: I7f5e132c2600bf5079850c99dc500b1dff7e6a96
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 60f78212379ba2b4a7a9bfadc5088a60309e923c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 18:29:03 +00:00
Magdalena Stojek
7ab145a9ef Output both global and local data tags in benchmark result header
Modified QPlainTestLogger::printBenchmarkResultsHeader() to
concatenate and display both global and local data tags, in
the benchmark result header, in the format `global:local`.
If only one tag is available, it is printed alone.

Pick-to: 6.8 6.5
Fixes: QTBUG-127522
Change-Id: Ic9f3c712ef3f6858aad2546b80d8867ce860b644
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
(cherry picked from commit 95f02adf756d1ae485f39a060c6f23a5af3f64ee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 18:04:39 +00:00
Michael Weghorn
b5ba125fa0 QMenu: Accept accelerators typed on keypad
Add Qt::KeypadModifier (and the combination with Qt::AltModifier) to the
modifiers that may be set in a key event in order to trigger a menu
action via its accelerator.

Otherwise, an action that has a number set as the accelerator (e.g.
using text "&1 Exit"), cannot be triggered by typing the corresponding
number on the keypad.

Fixes: QTBUG-73390
Pick-to: 6.8
Change-Id: I0fa63b0c5f23823c61e159fcc72f7245215f8aae
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit ca4334bc966c7e5f9997f98b83afe37eb8b1d3ba)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 17:20:11 +00:00
Christian Ehrlicher
c437c6a4f6 Style: pass widget to styleHint() where appropriate
QStyle::styleHint() take the QWidget as optional third parameter. Add
this to calls to styleHint() where appropriate.

Fixes: QTBUG-2501
Pick-to: 6.8
Change-Id: Id4e4158cc889236064f2f618495608736607d457
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit aa341ecca816e3503a834ffde0ec6cb817139427)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 16:46:27 +00:00
Thiago Macieira
ff303c5cd9 QMutex/FreeBSD: mark the functions as noexcept as it always has futex
See qfutex_freebsd_p.h.

Pick-to: 6.8
Change-Id: I7e7bbb8387ae2e7b0c39fffd65c7b03e3a65a853
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit c1bc98da02f0f9335e10f45cc5df4c7e3afcee31)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 16:40:35 +00:00
Fabian Kosmale
510f8005bc moc: Always indentify as moc
External tools might rely on the output of "moc --version" to identify
moc, and, depending on how robust their parsing is, could break if the
reported name does not equal "moc".

Explicitly set the application name to moc, so that even if the moc
binary gets renamed and invoked via a symlink, it will still correctly
identify itself.

This might help with both binaries from the Qt Company's installer, as
well as with distros which rename moc to moc6.

Pick-to: 6.8 6.5
Task-number: QLS-1605
Change-Id: Id85e2ffa17d445213da0b37e7bd038d7b68e2c2a
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 47be32b761ea6e1f2c1bfa9dd9eb38846ce2fd45)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 16:40:35 +00:00
Thiago Macieira
e9509291ae QSharedMemorySystemV: fix shm vs sem typo
Fixes: QTBUG-132053
Pick-to: 6.8
Change-Id: Ia4f2bdc8edff91020f13fffd79261a9feaf2f496
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 902058e750e67bbfb166db576c538b7add9be08f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 16:40:35 +00:00
Thiago Macieira
7664b826db QMetaType: remove the temporary QMetaTypeTypeFlags compatibility
Amends 44876fb45e702c2554fca98ed19af57feb1c0511.

Change-Id: I5ea354bcb6847e996081fffd012130562999d5c4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit e48fe10e541c6dec9db4226f8ad02728de7b0e02)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 16:40:34 +00:00
Ivan Solovev
8bd0625f54 [docs] Add QSpan details to overview of C++20 features
Document that QSpan exists because we cannot use std::span, and
explicitly point to the differences between QSpan and std::span.

Task-number: QTBUG-128837
Pick-to: 6.8
Change-Id: I54f406e3306ee1da136107323887f0c87f94ff9b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 083ebfa1a5cb16b0b62ae5b5855a602b2f9ba818)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 16:40:34 +00:00
Eirik Aavitsland
4d009678ce Fix in-place conversion of certain QImage formats
In the copying/transcription of the generic converter to the generic
in-place converter, a test for Format_RGB32 destination format was
mistakenly replaced with test of source format. The result was that a
suboptimal pixel store function was selected, and the resulting image
data could end up with non-0xff in the unused alpha field.

Task-number: QTBUG-132051
Pick-to: 6.8
Change-Id: If3ebf5fdd7ab6e377c8ad479ea38ce665f922b7c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 0ace5ba0357b1614b47cb38a16f4afb2fe8e62db)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 16:40:34 +00:00
Edward Welbourne
e2a0ef30da Fix assertion failure on parsing Feb 29 in a non-leap year
If there's no way to resolve an actual date with the data parsed, then
the date-text given is invalid, so don't try to fix it up.

Pick-to: 6.8 6.5
Fixes: QTBUG-132115
Change-Id: Ic6821bd01394d4dba1be1d25806c372800f8176b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 72519aeb237a4085aeb6290b0b4088c690fad106)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 16:40:34 +00:00
Mårten Nordheim
d53feb3da2 QHash: fix small performance regression when detaching with resize
There are two QHashPrivate::Data constructors (and two overloads of
::detached()). Initially the Data ctor that takes a new size always
assumed a resize was happening, and any place where there _may_ be a
resize we would usually detach then rehash.

In an effort to avoid the detach+rehash and instead call detach(d, size)
without the performance overhead of rehashing the call to
reallocationHelper() in this overload of the ctor was changed to verify
that a rehash was actually needed. This had the unfortunate side-effect
of making the compiler no longer inline the reallocationHelper()
function, and it no longer expanded the if-expression with the constant
so it was doing a tight copy-loop with a potential branch in the middle.

In this patch we revert that and make the bool a template argument to
highlight that it should be a constant for better performance (but also
leaving a comment.) Also mark it Q_ALWAYS_INLINE, it has two uses and
they both take advantage of the inlining + expanding the expression.

In theory this might have had an impact on QHash::reserve() calls,
though this code is only relevant when reserve() would cause growth so
the performance regression would hopefully be small compared to all the
other work that would also be needed.

Reverts 45c137d797a85c694897e8b1c5099abacc16e2f5

Pick-to: 6.8
Change-Id: I0d2076a9ded8ca816c54d6ce42d472a23bcbc9fd
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6c8b6acc894e47a37c4fb443316d9c40d35a144c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 16:40:33 +00:00
Edward Welbourne
7baf9d06b5 Fix typos in qstring.cpp (noticed while reviewing other changes)
Pick-to: 6.8
Change-Id: Ief8a9c429b5cdf424e0c3a57d15b1fcb4fdc963c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5d5c8d277af77cba069b805074551254c0f0d9c7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 16:40:33 +00:00
Mårten Nordheim
9d7fabb6c2 QHash: call the different detached() overloads depending on resize
Instead of using just the detached() overload taking a new size, call
the two un-sized one when not resizing. The unsized overload is faster
because it is inlining the reallocationHelper() function and expanding
a branch by way of a constant.

And drop the call to rehash in the !isDetached case, if we enter this
branch we willfully 'attach' the detach guard to keep the key and values
alive.

Follow-up change will fix the sized detach() to use a constant again.

Amends d9ad2251d9fff85a18ce5afc62bcb1230cd2820d

Change-Id: Ia1640766b898610d12b5df20d83cefe5ca2d4c36
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ac2b0b958e97c41b38c42c0789d91de724d567ce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 16:40:33 +00:00
Marc Mutz
51bfc9da41 Q{Any,Utf8}StringView: fix construction from arrays of unknown size
Like QStringView's, these classes' documentation promised
is_constructible<View,Char[]>, but failed to deliver, because neither
the (const Pointer&) nor the (const Container &) compile for arrays of
unkonwn bounds, and the (const Char*) one is just a QDoc fake.

Apply the same fix as for QStringView: Add a ctor specifically for
arrays of unknown bound, delegating to the (ptr) overload.

The GHS compiler doesn't like the CanConvert static_asserts, so
comment them out for it. The functionality itself is tested by
the from*ArrayWithUnknownSize tests.

[ChangeLog][QtCore][QUtf8StringView/QAnyStringView] Made construction
from arrays of unknown size compile. Such arrays will use the const
Char* constructor, determining the size of the array at runtime.

Pick-to: 6.8 6.5
Fixes: QTBUG-112746
Change-Id: I7acdcae3c5bdf80a0bed673e621d53ef34a92a1e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 734bd05d0a6d37d6488cf8d1b2b9f79b9329d966)
2024-12-13 14:31:08 +01:00
Marc Mutz
1f0dc7635e QLatin1StringView: put qstringfwd.h in control of Q_L1S_VIEW_IS_PRIMARY
Less duplication, matches what we do for q_no_char8_t namespaces, too.

Amends 94addad4dd1c89df9c6820d34b9a90424456c492.

Pick-to: 6.8 6.5
Change-Id: I5d98babcb66d1196d3aed31c33289a1b11212a3d
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 2d2ee569421338dbc07a479a7df2531bd37f0ebe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 11:27:53 +00:00
Marc Mutz
137da0326a QStringView: use qstringfwd.h
... instead of fwd-declaring a bunch of stuff manually.

Also move the fake QDoc decalaration of a "class QUtf8StringView"
over.

Pick-to: 6.8 6.5
Change-Id: I80bc3240d69f69602c127fc0e8fe694dd46765f1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 8404c21152ed3e28f8e00d683a494a8e1e25a69a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 11:27:47 +00:00
Ulf Hermann
60d28c8c7c Android: Fix some warnings
Use a static logging category where possible, and check the return value
of QFile::open.

Change-Id: Ieda9f7874d1b88d9bfeb593243eb867d0c274e9f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit e0ef713a2c6a74fe574481e98f0a582819418ed0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 11:27:42 +00:00
Marc Mutz
e076767bfd qstringfwd.h: don't include qglobal.h
qstringfwd.h is supposed to be a lean header, dragging in all of
qglobal.h perverts the purpose.

This also helps with certain circular-dependency issues that
appeared when attempting to use this header in other low-level
headers.

Amends abe3b4c9b947de5e55085b37840e0d1d6f3aae42.

[ChangeLog][Potentially Source-Incompatible Changes][QtCore] The
qstringfwd.h header no longer includes qglobal.h. A
backwards-compatible fix is to include qglobal.h yourself instead of
relying on the transitive include.

Pick-to: 6.8 6.5
Change-Id: I1726fccfd13b3a058abaf800c1bbf02c320143a4
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 5def8ff180c67f288bdc6e3c05b96940aeae37c0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 11:27:41 +00:00
Kai Köhne
c76b845d90 Doc: Fix links to QIODeviceBase:: flags
Pick-to: 6.8
Task-number: QTBUG-131484
Change-Id: Iee545986d4fb4765086fecce6532092d4b691ae8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d3dad28a51743bb408dee1cf997646a89eb6693b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 09:10:52 +00:00
Kai Köhne
604dcc714a Doc: Improve QTemporaryFile::open() descriptions
Explain the behavior of open() in detail, including the edge
cases (reopening a file). Fix links to QIODeviceBase::OpenMode
flags. Use explicit links to make linking more robust. Use
the same parameter name 'mode' as in the base class.

Pick-to: 6.8
Task-number: QTBUG-131484
Change-Id: I5d01b3bb48a7a439b93c144e6d38482607de8d33
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit adaf1fb107ceb7003313ceb67605f986b74763b1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 09:10:46 +00:00
Kai Köhne
b70e61788f Doc: Improve QProcess setStandardOutputFile description
Fix links to OpenMode flags. While at it, make links explicit so
that future changes breaking implicit linking will cause errors.

Pick-to: 6.8
Task-number: QTBUG-131484
Change-Id: I20b80014eadcbcba6ebebab1ff4db4c345dd434a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4e85a4f401118f2f7330b673e45b4a0399825ef3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 09:10:39 +00:00
Kai Köhne
5d2f40a14b Doc: Improve QBuffer::open description
Explain the method, instead of just linking to the base method.

Call the argument 'mode' instead of 'flags', like it is done in
the base class.

Force the mentioned QIODeviceBase flags to be links. Use fully
qualified name for the first flag mentioned, but use the short form
for the rest to improve readability.

Pick-to: 6.8
Task-number: QTBUG-131484
Change-Id: I8e9668ffc095ec261e2be54a2dcf16a32e4cb441
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 334460407b7cde1cdab5cfe5abe00175893749c3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 09:10:33 +00:00
Kai Köhne
eb44663eaa Doc: Improve QFile::open description
Force the mentioned QIODeviceBase flags to be links. Use fully
qualified name for the first flag mentioned, but use the short form for
the rest to improve readability.

Mark true and false to be written in code style.

Task-number: QTBUG-131484
Pick-to: 6.8
Change-Id: Iebb0f9c6df382327bc5980e9e06c11deb6658291
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 647bee67150dedbd2a9fd2ddcd265d535e8fd8cf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 09:10:27 +00:00
Marc Mutz
83e18b6540 qstringfwd.h: add missing QString fwd decl
qstringfwd.h should probably fwd declare QString, too :o

Amends abe3b4c9b947de5e55085b37840e0d1d6f3aae42.

Pick-to: 6.8 6.5
Change-Id: I80558c92d1144ead0aade410a8b1810713fed701
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit bc4105c843f666eaeaaa44b5a1f897ffa5824ec7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 20:10:54 +00:00
Marc Mutz
df2f31b9bf qsocketnotifier.cpp: un-break -unity-build
qsocketnotifier.cpp is using a #define to activate a second overload
of QSocketNotifier's activated() signal.

In unity-builds, this overload becomes visible to other TUs and breaks
new-style connect()s¹. In PCH builds, the define comes too late (the
qsocketnotifier.h header was already included by the pch header,
without the define).

Fix by adding qsocketnotifier.cpp to NO_PCH_SOURCES (thereby to
NO_UNITY_BUILD_SOURCES, too).

¹ and the signal's use of QPrivateSignal makes disambiguation by
  qOverload(), or assignment to a function pointer, impossible.

Amends 487dd80bce9c6006f349ccb09222e1c308200f0a(!).

Pick-to: 6.8 6.5 5.15
Change-Id: I40ca3b90f7ecc3116ae78dc952583efa299bcedb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit a38cebfe23674bb459eed6bbbcac965ebf2b6075)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 20:07:29 +00:00
Marc Mutz
e8605372ba qsettings.cpp: really un-break -unity-build
The use of Space was still ambiguous. Says GCC 14:

  qsettings.cpp: In static member function ‘static bool QConfFileSettingsPrivate::readIniLine(QByteArrayView, qsizetype&, qsizetype&, qsizetype&, qsizetype&)’:
  qsettings.cpp:1564:82: error: reference to ‘Space’ is ambiguous
   1564 |     while (lineStart < dataLen && (charTraits[uint(uchar(data.at(lineStart)))] & Space))
        |                                                                                  ^~~~~
  In file included from unity_0_cxx.cxx:277:
  qjsonparser.cpp:217:5: note: candidates are: ‘<unnamed enum> Space’
    217 |     Space = 0x20,
        |     ^~~~~
  qsettings.cpp:1523:8: note:                 ‘SettingsImpl::<unnamed enum> SettingsImpl::Space’
   1523 | enum { Space = 0x1, Special = 0x2 };
        |        ^~~~~
  qsettings.cpp:1605:71: error: reference to ‘Space’ is ambiguous
   1605 |                 while (i < dataLen && charTraits[uchar(data.at(i))] & Space)
        |                                                                       ^~~~~
  qjsonparser.cpp:217:5: note: candidates are: ‘<unnamed enum> Space’
    217 |     Space = 0x20,
        |     ^~~~~
  qsettings.cpp:1523:8: note:                 ‘SettingsImpl::<unnamed enum> SettingsImpl::Space’
   1523 | enum { Space = 0x1, Special = 0x2 };
        |        ^~~~~

Fix by making Space and Special local aliases (contexpr variables)
instead of importing the whole SettingsImpl namespace.

Amends 4ff65f0e5615b1132ec13c6eeba3647162d8dd0f.

Pick-to: 6.8 6.5
Change-Id: I9e8f2422885121fb02938261fbae6231e62ae46d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 057defe283f1db5fa9dfb1d8183b94d441c3707b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 20:07:22 +00:00
Marc Mutz
00f6df326f qresource.cpp: fix -unity-build
GCC 14 complains:

  In file included from unity_0_cxx.cxx:121:
  qresource.cpp:283:7: error: ‘QResourcePrivate’ has a field ‘QList<{anonymous}::QResourceRoot*> QResourcePrivate::related’ whose type has internal linkage [-Werror=subobject-linkage]
    283 | class QResourcePrivate {
        |       ^~~~~~~~~~~~~~~~

(Hot-)fix by adding qresource.cpp to NO_UNITY_BUILD_SOURCES.

Amends fe6dda9bb9310878b408b2421f60acb7135bd8ba.

Pick-to: 6.8
Task-number: QTBUG-132114
Change-Id: Ic414d1cf9e4dad94d4263b3657d31df896c4e417
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 57fab6a1c2df8f52b25f6db4017bb3acfa8e0526)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 20:07:16 +00:00
Marc Mutz
06a209384a tst_QString: extend arg() tests with enums w/o explicit underlying_type
The QtDeclarative code causing QTBUG-131906 hits UB, because it tries
to store -666 in an enum {A, B}, which has a valid range of [0,1],
therefore its underlying_type is uint, yet, as per [conv.prom]/3¹,
integer-promotes to _int_ instead, so in Qt 6.8 would cause the
arg(int) overload to be called, outputting -666, while in Qt 6.9, it's
treated (correctly) as an unsigned value, outputting -666's two's
complement, a positive value.

Add a version of the scenario that does not cause UB.

¹ Thanks to Ahmad Samir for digging up the pertinent legalese.

Task-number: QTBUG-131906
Pick-to: 6.8 6.5
Change-Id: Iba1a04de523a0b4cd1c87deea40c643cf16df14f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit e64fd05fecae291c9d7358d2e47d7170995af256)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 20:07:12 +00:00
Thiago Macieira
b143215c54 QString: update docs to prefer "UTF-32" over "UCS-4"
They are now the same, but the name UTF-32 is preferred over UCS-4.

The original ISO-10646 UCS-4 encoding was allowed to use all 31-bit code
units, from 0 to 0x7FFFFFFF[1] including those above 0x10FFFF, which
correspond to UTF-8's five- and six-byte sequences. Unicode doesn't
allow that and restricts the UTF to the range possible in UTF-16.

Renaming the functions is left as an exercise for the reader.

[1] https://en.wikipedia.org/wiki/UTF-32#History

Pick-to: 6.8
Change-Id: I2f29db62b974cb689585fffd9a6434ae252a7651
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 973d0c4c5160200c188f81da5df064510315f22d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 19:38:25 +00:00
Marc Mutz
31e3012296 tst_QStringView: verify that char16_t[] args aren't ambiguous for QS/QSV overloads
They are not.

Pick-to: 6.8
Task-number: QTBUG-112746
Change-Id: I2a20d68543f5914690acbcb4f214b1d98681de6a
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 67990c16a6b631c1d809d1ad656fc941293b3f83)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 19:38:23 +00:00
Thiago Macieira
bb91219b26 QString::fromUcs4: use std::char_traits or wcslen() to find the size
... when the user passes size = -1. std::char_traits<char32_t>::length()
doesn't appear to be an any better implementation than our simple loop,
but maybe some compiler will optimize it.

wcslen() is usually optimized in the C libraries, even for Unix
platforms that hardly ever use it (it's used as a fallback in qustrlen()
for non-x86 Windows systems).

Pick-to: 6.8
Change-Id: Ia143270869a3a7cf5754fffdc17e500fc454397b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit b98cf4fc4afaf55145c34ba06d61fec38fadc25d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 19:38:19 +00:00
Marc Mutz
2dfc0cb6f6 QStringView: fix construction from arrays of unknown size
The original idea (8b5aa7b6c40d70a7ec15b3ea485f28a142fb247c) of the
separation of array and pointer ctors was to determine string literal
sizes at compile-time in C++11's limited constexpr semantics.

But when the scanning for NUL characters was added to the array ctor
in 107ff4c1d6b5da2cb11c65b2bd9106817f7fdb02, the distinction between
the two ctors became meaningless, because we were able to assume
post-C++11 constexpr to make the Char(0) scan a compile-time action.

Finally, 9e1dc1e8a9fda1a7576cc6377c8a36decff631eb removed the array
ctor in favor of the generic Container ctor. I didn't check whether
the old code handled arrays of unknown size, as in

    extern const char16_t str[];
    QStringView sv = str;
    ~~~
    const char16_t str[] = "str";

but std::size() (and therefore if_compatible_container) surely bails
on such arrays, and if_compatible_pointer also SFINAEs out. As a
consequence, such arrays cannot be used to construct QStringViews atm.

Fix by adding a new constructor for arrays of unknown size, delegating
to the existing pointer overload.

The GHS compiler doesn't like the CanConvert static_asserts, so
comment them out for it. The functionality itself is tested by
the from*ArrayWithUnknownSize tests.

[ChangeLog][QtCore][QStringView] Made construction from arrays of
unknown size compile. Such arrays will use the const Char*
constructor, determining the size of the array at runtime.

Pick-to: 6.8 6.5
Task-number: QTBUG-112746
Change-Id: Ifdb217350d93d38f081c99f14661975491d32076
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 56faffd92bf0ac459a921ec043a6f3b3dba51acc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 19:38:16 +00:00
Ulf Hermann
2a512fd901 Use inline namespaces rather than "using" for logging categories
Amends commit fa4bd30caa079a3b1e5eac1bb4f17365f456b8f9.

Fixes: QTBUG-132111
Change-Id: Iad7969a1841b8cea162e4b0e6624d02313618ef1
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 529ebb31702e8465a9ba42f4c56c749cb7bf7b75)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 19:38:16 +00:00
Marc Mutz
443bdb9620 tst_QAnyStringView: complete Char[] CanConvert sets
Other view tests test Char[N] and const Char[N] separately. Do the
same here.

For many Char types, the array CanConvert test was missing
completely. Add them.

Pick-to: 6.8 6.5
Change-Id: I1d0b6de394d548554a547f190e74cb8cead6ecd4
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 0bbbbfc78beb2393ceea0de0fa85942f71d0a2ed)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 18:21:54 +00:00
Ahmad Samir
149150ab47 QtSql: fix GCC -Wextra-semi warnings after member function definitions
Pick-to: 6.8
Change-Id: I5b65f543d7a36386181e493d8b9ce0267132d686
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 291c762802a2f5e1edb6bd9a842663ca5689323a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 18:21:51 +00:00
Marc Mutz
29e2695676 tst_QStringApiSymmetry: test QByteArray(weak)/QByteArrayView overloading
Adding it here since this test case already has all the infrastructure
for the overload test.

Pick-to: 6.8 6.5
Change-Id: I2d7fff9d2d82fed3db2446690a354f939c9a37fc
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 140dac92f2a8ee1f54843f69be4026900a049ee7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 18:21:48 +00:00
Ahmad Samir
dbaef86144 Fix GCC -Wextra-semi warnings with Q* macros
Namely, Q_ENUM, Q_DECLAR_FLAGS, Q_FLAG, Q_DECLARE_EQUALITY_COMPARABLE.

The sanitize-commit (from qtrepotools repo) git hook already warns about
these.

Pick-to: 6.8
Change-Id: If53f446c7c19856c4a5be1e0b0156e1892871dae
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 8d3601dfe8e6a89cbf0ab0ff8089e232f52c21d2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 18:21:44 +00:00
Marc Mutz
9bcbeea2ad tst_QByteArrayView: check conversion from various QSpans
This is supposed to work, so check it.

Pick-to: 6.8
Change-Id: I201033656f123b09644e5de447cd5d7b038e5155
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 8a3ffe7044249bcfb5185bd87a9713685d48de7b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 18:21:41 +00:00
Ivan Solovev
7044c32963 Fix docs for QSet (in)equality operators
The missing '&' prevented qdoc from generating the docs.

Amends f9f3bf79dccbfcabbd5c59c39f9f018d71b7549f.

Change-Id: I1d8d7a4e2f4c46c4c365cb5a5e38877837881c45
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 03389d47902347e858bbafc990de3ab988c07acf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 18:21:39 +00:00
Ahmad Samir
8472fc2573 Fix GCC -Wextra-semi after member function definitions
Fixes: QTBUG-132101
Pick-to: 6.8
Change-Id: Ia2e13bdaf11c639c5590639717b5d31140352c44
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6b951f6c0c09b7d7b473a3951e7b6cec41dbec73)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 18:21:37 +00:00
Volker Hilsheimer
3de6c570fb QFontIconEngine: if we can't find the named glyph, try ligatures
Use QTextLayout to layout and shape the text, which will respect
ligatures. Many icon fonts might not name their icons, but have a
replacement ligature for the actual icon name replacing the text with
the respective glyph.

So if for the name of the icon we get a single glyph run with a single
glyph in it, use that to render the icon.

Change-Id: If0e5c528c3ac4cccdbb7df5fb7fd32ca232f2a66
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit d10e9174fecb91b5c366d57aeb19e6410522a807)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 14:28:37 +00:00
Volker Hilsheimer
8b4a8b1e10 QFontIconEngine: always initialize with a non-merging font
The icon engine needs to be able to rely on glyph indices belonging to
the correct font, and we generally don't want the overhead of iterating
through potential fallbacks if a named glyph or unicode code point
wasn't found in the font.

Assert in the QFontIconEngine constructor that the font we get has the
NoFontMerging strategy bit set.

Amends 2af58490b3d33aab8d08610939fe2b7cab4c469c.

Change-Id: Ib38324aebbeda956c8dd053969d6cf08f7ef3c35
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 9d47233d2cbbae1aa32240688fcc7a8c08c585d3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 14:28:34 +00:00
Tatiana Borisova
609d34d702 [QDomNodePrivate] delete unnecessary pointer check from the statement
- prev pointer never can be null here, so the check can be deleted.

Ammends 948599e7b71f59fd9c9c0f7f3d1987ec93a23490

Pick-to: 6.8
Change-Id: Ie194f5f0432f6da5f6471328193112c970f623b6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit d991572a45b2bbdcd43e59586f88487837a2927c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 14:27:27 +00:00
Eirik Aavitsland
49cf61f641 QWidget::mapTo()/mapFrom(): Do not crash if parent argument is invalid
These functions iterate through the parent hierarchy until the widget
given as argument is found. If never found, the code would assert (in
debug mode) or just silently crash (in release mode).

No need to bring down the entire application just because some widget
coordinate calculation is off. Instead, just emit a qWarning and
return cleanly.

Task-number: QTBUG-132072
Pick-to: 6.8
Change-Id: I4d13f46037cdcf855f76e040f941a8a7050ab12b
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 73221d263823d50e525858d613ce93769698454a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 14:27:25 +00:00
Piotr Wierciński
80e581d91b wasm: Link with FETCH library only for MAIN_MODULE
For dynamic linking only the main module should
link with libraries like "FETCH".
When side modules are linking to libraries as well,
it leads to linking errors.

Change-Id: I83e37add867f1ce2cbcab4801f49266a288a9ceb
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit b7419557b1b0cc1a87aa91131329b65aee44ec34)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 13:17:02 +00:00
Tor Arne Vestbø
b3c60bd11f iOS: Iterate accessible interface to find window
Many subclasses of QAccessibleInterface implement window(), but
some don't, and the documentation states that the backend (us)
will traverse ancestors until it finds one with a window.

We were not doing that for iOS, which caused a crash for
QAccessibleTabButton, which doesn't have a window.

In case we ever hit the code path where we can't find a
window we also skip adding the nil element to the array
in createAccessibleElement, as that causes an exception.

Amends 7a512d1267442e646bb7942291197b2b03f4d1cd

Pick-to: 6.8 6.5
Change-Id: I9b758423956e845a01b014022f4d3ab6306be94e
Reviewed-by: Doris Verria <doris.verria@qt.io>
(cherry picked from commit 6689921b9da3780676a416324eafcac98ab211a3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-11 10:49:23 +00:00
Shawn Rutledge
8a7ee8d522 Widgets: ignore unhandled right mouse button presses
In many places this was already done; but there was some old code
remaining where mousePressEvent() simply returned without ignoring the
unhandled event.

Task-number: QTBUG-93486
Task-number: QTBUG-132066
Change-Id: I4a876980b7ef88ee478fa8cfd9f68b5be5b217a2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit a1175255150d27d50f9690d5f8685b31269d9fa1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-11 09:33:35 +00:00
Ivan Solovev
d0a3db5d93 [doc] Clean-up QSpan docs
QSpan docs use \target commands together with the section headers, to
simplify linking to certain parts of the docs. This approach has its
own drawbacks, though, because the \target link is rendered as-is.
This patch improves usage of the \target commands, making the links
look better.
It does the following changes:
* Moves the \target commands before the related \section2 commands, so
  that the section header is visible when following the \target's link.
* Replaces the \target links with the actual section names in the \sa
  and other places of the docs where the links do not have the custom
  text, because otherwise the target names are actually visible in the
  docs instead of the section headers.

Amends 03e78e5d624d9752d76c7448d58c9d9d15a4dc18,
70dc8d3103fade380caec96f7531432cd8e8adb6, and
ef5ac956c755daa9ea84dabfa1314d104e5c62e4.

Pick-to: 6.8
Change-Id: I045824683f342079e33e89e3ee6f8e2e27a0acf5
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 10c844f0533daf657a1cbbbb96651e20e5d603ec)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-11 00:51:17 +00:00
Marc Mutz
67adc2227d tst_QStringView: add missing CanConvert from char16_t/wchar_t arrays
QChar[N] and ushort[N] are being checked, it's unclear why char16_t[N]
and wchar_t[N] were missing.

Add them.

Pick-to: 6.8 6.5 5.15
Change-Id: I9a2df2a75886b950e8c2bdec843e3e693e536f86
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 89401858696d63b8a13c945d5db63856a3b6f5ba)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-11 00:06:27 +00:00
Marc Mutz
0c054f6844 Confirm QLatin1StringView can be constructed over arrays of unknown bounds
It can (unlike the other views).

Pick-to: 6.8 6.5 5.15
Task-number: QTBUG-112746
Change-Id: Id976429611c53f1c707de1d989c454507b8f4773
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 01f0305dc6f751d3eb4d1681a2f8f9f3165b547c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-11 00:06:21 +00:00
Shawn Rutledge
f329dd4e16 QWidgetWindow: send QContextMenuEvent even after accepted mouse press
It would be more consistent if we could rely on the accepted state of
the original QMouseEvent to decide whether to follow up with a
QContextMenuEvent; but not all Qt widgets call ignore() on unhandled
mouse events, both in Qt and in external libraries and applications
(including some from KDE). So we should at least wait until Qt 7 to
make this a requirement. It seems sensible to move the check into
QWindow::event() rather than trying to distinguish the window type in
maybeSynthesizeContextMenuEvent(). We merely output a categorized log
message to indicate when the legacy behavior is in effect.

Amends 84a5f50c7766c99f62b22bb4388137e0aa8dd13d

[ChangeLog][QtWidgets] If your QWidget subclass depends on receiving
QContextMenuEvent, and also handles mouse events directly, we
recommend that you call ignore() on unhandled mouse events (such as
right-button events). In Qt 7, we plan to stop sending
QContextMenuEvent if the triggering mouse event is accepted.

Fixes: QTBUG-132066
Change-Id: I454813dab4c387112f161fc28a0ee94570013afa
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 357c64a99607456133bfabf86d6b67162717cb29)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-10 23:51:13 +00:00
Christian Ehrlicher
75cb14deb8 SQLite: Update SQLite to v3.47.2
[ChangeLog][Third-Party Code] Updated SQLite to v3.47.2

Pick-to: 6.8 6.5 5.15
Change-Id: I3f40198db02c7f9599189ec2a0001f1c294616c8
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit f3d5bdf4bcfe26a17b1b3de07a345586c37263c0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-10 19:58:41 +00:00
Dheerendra Purohit
a77b11c548 QToolBar: Update implicit icon size if style changes
Add logic in QToolBar::changeEvent() to update icon size set via
stylesheet.

Fixes: QTBUG-45949
Pick-to: 6.8
Change-Id: I7fce830a969af8774116f0229153668252b55598
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 18733355689fc3ea336631b9c5ff17e3e983fb28)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-10 17:26:03 +00:00
Lars Schmertmann
43f4706ee8 Android: Fix typo in the documentation of the default log pattern
Pick-to: 6.8 6.5
Task-number: QTBUG-94708
Change-Id: I845f193f1b98219be205b8615f817f3315f4d149
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 3bec93738ea88b6f2f50f1b5eeb2237f6f43c0b6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-10 17:26:03 +00:00
Marc Mutz
5c3fd55beb QSpan: document slice() and chop()
Needed to use a weird combination of \c and \a here, as qdoc on
one hand insists that all parameters be documented, and OTOH doesn't
support \a within \c.

Writing anything else than the equivalent code in \c to appease qdoc
would be childish. Equivalent code is the best-possible documentation,
as it leaves no question unanswered.

Task-number: QTBUG-131672
Change-Id: I512872360b7eb212001723f2ba12d4c6eac0b6b0
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 0afe31fa51a26d12be21c1b9c6e886abb9775441)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-10 17:26:02 +00:00
Edward Welbourne
66da88f428 Fix typo in QTZ constructor docs
There is no fromSecondsAfterUtc(), I was thinking of
fromSecondsAheadOfUtc().

Pick-to: 6.8 6.5
Fixes: QTBUG-131913
Change-Id: I6a89a27d678d23043819b93d5e4120d01002da4a
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 2bdce97480ed66f0e8e9528fbc8f4f9c3d8487bf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-10 17:26:02 +00:00
Yuhang Zhao
7c3723b2a9 Minor improvements of windows style
1. Make some global constants constexpr.
2. Make some file-scope global constants static.
3. Use QStringLiteral instead of plain const char*
4. Add "u" to QStringLiteral's content.

Pick-to: 6.8
Change-Id: Icbc105366ba40e970b256fe3da41231a6fb5064b
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit ad06099b93d79a954d133d6822517d4d0a10adbc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-10 08:26:00 +00:00
Wladimir Leuschner
1a737083f1 QWindows11Style: Override alternate base color in darkmode
The alternate base color in darkmode was wrongly set to the accent color
instead of a lighter color. This patch overrides the alternate base
color for the QWindows11Style.

Fixes: QTBUG-131976
Pick-to: 6.8
Change-Id: Ie8f50b0042ca7bf746224275abc0cd255df7a4ad
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 79aa4269bcbbedef8206d79318c199df7c8a3c9f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-09 21:54:52 +00:00
Allan Sandfeld Jensen
901731ad78 Add primary RGB color points getter
[ChangeLog][QtGui][QColorSpace] Added primary points getter and setter

Change-Id: Ia4e412b3e63584cf88fa632e5c1d47618d07ebf1
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit bde2292247bf4849852355c0dcc71f97c9daace9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-09 19:46:45 +00:00
1376 changed files with 296510 additions and 243551 deletions

View File

@ -24,9 +24,9 @@ SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR GPL-3.0-only"
path = ["bin/*", "coin/**","libexec/*","**_clang-format", "**.cmake", "**.conf", "**.cmake.in",
"**.prf", "libexec/qt-internal-configure-*", "config.tests/.qmake.conf",
"**.pro", "**.pri", "**.yaml", "cmake/**.in", "cmake/ios/LaunchScreen.storyboard",
"cmake/**md", "**.yml", "**.dynlist",
"cmake/**md", "**.yml", "**.dynlist", "cmake/**.plist",
"src/corelib/global/qconfig.cpp.in", "src/corelib/Qt6CoreConfigureFileTemplate.in",
"**.cfg"]
"**.cfg", "**/Makefile", "**/CMakeLists.txt", "**.qrc"]
precedence = "closest"
comment = "build system"
SPDX-FileCopyrightText = "Copyright (C) 2024 The Qt Company Ltd."
@ -45,23 +45,36 @@ SPDX-FileCopyrightText = "Copyright (C) 2024 The Qt Company Ltd."
SPDX-License-Identifier = "BSD-3-Clause"
[[annotations]]
path = ["**/snippets/**", "**/doc/**/images/**", "examples/**"]
path = ["**/snippets/**", "examples/**", "src/tools/qlalr/examples/**"]
comment = "this must be after the build system table because example and snippets take precedence over build system"
precedence = "closest"
SPDX-FileCopyrightText = "Copyright (C) 2024 The Qt Company Ltd."
SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR BSD-3-Clause"
[[annotations]]
path = ["tests/manual/examples/**", "**/snippets/**"]
precedence = "closest"
SPDX-FileCopyrightText = "Copyright (C) 2024 The Qt Company Ltd."
SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR BSD-3-Clause"
[[annotations]]
path = ["**/README*", "src/plugins/**/README*", "examples/**/README*", "tests/**/README*",
"src/widgets/doc/snippets/common-table-model/README", "cmake/README.md",
"lib/README", "coin/instructions/README.md", "src/3rdparty/README",
"**.qdocconf", "**.qdocinc", "config_help.txt",
"doc/global/template/style/*"]
"doc/global/template/style/*", "**/doc/**/images/**"]
comment = "documentation"
precedence = "closest"
SPDX-FileCopyrightText = "Copyright (C) 2024 The Qt Company Ltd."
SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only"
[[annotations]]
path = ["src/gui/doc/snippets/textdocument-images/images.qrc"]
precedence = "closest"
comment = "falls under **/doc/**/images/**, which is wrong"
SPDX-FileCopyrightText = "Copyright (C) 2024 The Qt Company Ltd."
SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR BSD-3-Clause"
[[annotations]]
path = ["src/assets/icons/**.png", "src/assets/icons/**.svg", "src/android/**.xml",
"src/gui/**.xml",
@ -73,6 +86,13 @@ precedence = "closest"
SPDX-FileCopyrightText = "Copyright (C) 2024 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"
[[annotations]]
path = ["tests/auto/tools/rcc/data/legal/legal.qrc"]
precedence = "override"
comment = "license in file not referring to the file itself"
SPDX-FileCopyrightText = "Copyright (C) 2024 The Qt Company Ltd."
SPDX-License-Identifier = "BSD-3-Clause"
[[annotations]]
path = ["**/qt_attribution.json"]
precedence = "override"

View File

@ -120,7 +120,7 @@ list(APPEND CMAKE_REQUIRED_LIBRARIES "${EGL_LIBRARY}")
list(APPEND CMAKE_REQUIRED_INCLUDES "${EGL_INCLUDE_DIR}")
list(APPEND CMAKE_REQUIRED_DEFINITIONS "${EGL_DEFINITIONS}")
find_package(PlatformGraphics)
find_package(PlatformGraphics QUIET)
if(TARGET PlatformGraphics::PlatformGraphics)
platform_graphics_extend_check_cxx_source_required_variables()
endif()

View File

@ -21,7 +21,7 @@ else()
set(_includes "${CMAKE_REQUIRED_INCLUDES}")
list(APPEND CMAKE_REQUIRED_INCLUDES "${GLESv2_INCLUDE_DIR}")
find_package(PlatformGraphics)
find_package(PlatformGraphics QUIET)
if(TARGET PlatformGraphics::PlatformGraphics)
platform_graphics_extend_check_cxx_source_required_variables()
endif()

View File

@ -9,6 +9,6 @@ $<1: >
Name: @pkgconfig_name@
Description: @pkgconfig_description@
Version: @PROJECT_VERSION@
Libs: $<$<NOT:@is_interface_library@>:-L${libdir} -l@pkgconfig_file@> @link_options@
Libs: @link_options@
Cflags: @include_dirs@ @compile_defs@
Requires: $<JOIN:$<REMOVE_DUPLICATES:@target_requires@>, >

View File

@ -379,7 +379,7 @@ function(qt_internal_add_3rdparty_library target)
${__qt_internal_sbom_multi_args}
)
_qt_internal_extend_sbom(${target} ${sbom_args})
qt_internal_extend_qt_entity_sbom(${target} ${sbom_args})
endif()
qt_add_list_file_finalizer(qt_internal_finalize_3rdparty_library ${target})

View File

@ -154,7 +154,7 @@ function(qt_internal_add_app target)
${__qt_internal_sbom_multi_args}
)
_qt_internal_extend_sbom(${target} ${sbom_args})
qt_internal_extend_qt_entity_sbom(${target} ${sbom_args})
endif()
qt_add_list_file_finalizer(qt_internal_finalize_app ${target})

View File

@ -152,7 +152,12 @@ function(qt_auto_detect_android)
endfunction()
function(qt_auto_detect_vcpkg)
if(QT_USE_VCPKG AND DEFINED ENV{VCPKG_ROOT})
if(QT_USE_VCPKG)
if(NOT DEFINED ENV{VCPKG_ROOT})
message(FATAL_ERROR
"Usage of vcpkg was requested but the environment variable VCPKG_ROOT is not set."
)
endif()
set(vcpkg_toolchain_file "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake")
get_filename_component(vcpkg_toolchain_file "${vcpkg_toolchain_file}" ABSOLUTE)

View File

@ -214,3 +214,53 @@ function(qt_make_output_file infile prefix suffix source_dir binary_dir result)
file(MAKE_DIRECTORY "${outpath}")
set("${result}" "${outpath}/${prefix}${outfilename}${suffix}" PARENT_SCOPE)
endfunction()
# Work around AUTOGEN issue when a library is added as a dependency more than once, and the autogen
# library dependency results in being discarded. To mitigate that, add all autogen dependencies
# manually, based on the passed in dependencies.
# CMake 4.0+ has a fix, so we don't need the extra logic.
# See https://gitlab.kitware.com/cmake/cmake/-/issues/26700
function(qt_internal_work_around_autogen_discarded_dependencies target)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 4.0
OR QT_NO_AUTOGEN_DISCARDED_DEPENDENCIES_WORKAROUND)
return()
endif()
set(libraries ${ARGN})
set(final_libraries "")
foreach(lib IN LISTS libraries)
# Skip non-target dependencies.
if(NOT TARGET "${lib}")
continue()
endif()
# Resolve alias targets, because AUTOGEN_TARGET_DEPENDS doesn't seem to handle them.
get_target_property(aliased_target "${lib}" ALIASED_TARGET)
if(aliased_target)
set(lib "${aliased_target}")
endif()
# Skip imported targets, they don't have sync_headers targets.
get_target_property(imported "${lib}" IMPORTED)
if(imported)
continue()
endif()
# Resolve Qt private modules to their public counterparts.
get_target_property(is_private_module "${lib}" _qt_is_private_module)
get_target_property(public_module_target "${lib}" _qt_public_module_target_name)
if(is_private_module AND public_module_target)
set(lib "${public_module_target}")
endif()
# Another TARGET check, just in case.
if(TARGET "${lib}")
list(APPEND final_libraries "${lib}")
endif()
endforeach()
if(final_libraries)
set_property(TARGET ${target} APPEND PROPERTY AUTOGEN_TARGET_DEPENDS "${final_libraries}")
endif()
endfunction()

View File

@ -187,7 +187,7 @@ function(qt_run_config_test_architecture)
list(APPEND QT_BASE_CONFIGURE_TESTS_VARS_TO_EXPORT TEST_buildAbi)
set(QT_BASE_CONFIGURE_TESTS_VARS_TO_EXPORT ${QT_BASE_CONFIGURE_TESTS_VARS_TO_EXPORT} CACHE INTERNAL "Test variables that should be exported")
list(JOIN _sub_architecture " " subarch_summary)
list(JOIN sub_architecture_${first_arch} " " subarch_summary)
set_property(GLOBAL PROPERTY qt_configure_subarch_summary "${subarch_summary}")
endfunction()

View File

@ -366,7 +366,15 @@ if(APPLE)
DESTINATION "${__GlobalConfig_build_dir}/${platform_shortname}"
)
if(IOS)
if(MACOS)
# Test entitlements
qt_copy_or_install(FILES "cmake/${platform_shortname}/test.entitlements.plist"
DESTINATION "${__GlobalConfig_install_dir}/${platform_shortname}"
)
file(COPY "cmake/${platform_shortname}/test.entitlements.plist"
DESTINATION "${__GlobalConfig_build_dir}/${platform_shortname}"
)
elseif(IOS)
qt_copy_or_install(FILES "cmake/ios/LaunchScreen.storyboard"
DESTINATION "${__GlobalConfig_install_dir}/ios"
)
@ -378,9 +386,23 @@ if(APPLE)
elseif(WASM)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/util/wasm/wasmtestrunner/qt-wasmtestrunner.py"
"${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/qt-wasmtestrunner.py" @ONLY)
qt_install(PROGRAMS "${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/qt-wasmtestrunner.py"
DESTINATION "${INSTALL_LIBEXECDIR}")
if(QT_FEATURE_shared)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/util/wasm/preload/preload_qml_imports.py"
"${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/preload_qml_imports.py" COPYONLY)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/util/wasm/preload/preload_qt_plugins.py"
"${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/preload_qt_plugins.py" COPYONLY)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/util/wasm/preload/generate_default_preloads.sh.in"
"${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/generate_default_preloads.sh.in" COPYONLY)
qt_install(PROGRAMS "${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/preload_qml_imports.py"
DESTINATION "${INSTALL_LIBEXECDIR}")
qt_install(PROGRAMS "${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/preload_qt_plugins.py"
DESTINATION "${INSTALL_LIBEXECDIR}")
qt_install(PROGRAMS "${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/generate_default_preloads.sh.in"
DESTINATION "${INSTALL_LIBEXECDIR}")
endif()
endif()
# Install CI support files to libexec.

View File

@ -246,6 +246,7 @@ function(qt_internal_get_qt_build_private_files_to_install out_var)
QtGenerateLibPri.cmake
QtGenerateVersionScript.cmake
QtModuleConfig.cmake.in
QtModuleConfigPrivate.cmake.in
QtModuleDependencies.cmake.in
QtModuleHeadersCheck.cmake
QtModuleToolsConfig.cmake.in
@ -292,8 +293,18 @@ function(qt_internal_get_qt_build_public_helpers out_var)
QtPublicGitHelpers
QtPublicPluginHelpers
QtPublicPluginHelpers_v2
QtPublicSbomAttributionHelpers
QtPublicSbomCpeHelpers
QtPublicSbomDepHelpers
QtPublicSbomFileHelpers
QtPublicSbomGenerationHelpers
QtPublicSbomHelpers
QtPublicSbomLicenseHelpers
QtPublicSbomOpsHelpers
QtPublicSbomPurlHelpers
QtPublicSbomPythonHelpers
QtPublicSbomQtEntityHelpers
QtPublicSbomSystemDepHelpers
QtPublicTargetHelpers
QtPublicTestHelpers
QtPublicToolHelpers

View File

@ -344,17 +344,9 @@ endfunction()
macro(qt_internal_setup_sbom)
qt_internal_compute_sbom_default(_qt_generate_sbom_default)
option(QT_GENERATE_SBOM "Generate SBOM documents in SPDX v2.3 tag:value format."
"${_qt_generate_sbom_default}")
option(QT_SBOM_GENERATE_JSON
"Generate SBOM documents in SPDX v2.3 JSON format if dependencies are available" ON)
option(QT_SBOM_REQUIRE_GENERATE_JSON
"Error out if JSON SBOM generation dependencies are not found." OFF)
option(QT_SBOM_VERIFY "Verify generated SBOM documents." ON)
option(QT_SBOM_REQUIRE_VERIFY
"Error out if SBOM verification dependencies are not found." OFF)
_qt_internal_setup_sbom(
GENERATE_SBOM_DEFAULT "${_qt_generate_sbom_default}"
)
endmacro()
macro(qt_internal_setup_build_examples)

View File

@ -202,6 +202,15 @@ macro(qt_internal_setup_configure_install_paths)
"Module description files directory")
qt_configure_process_path(INSTALL_SBOMDIR "${INSTALL_ARCHDATADIR}/sbom"
"SBOM [PREFIX/sbom]")
# INSTALL_PUBLICBINDIR is processed only if it is not empty
# See usage in qt_internal_generate_user_facing_tools_info
if(NOT "${INSTALL_PUBLICBINDIR}" STREQUAL "")
# A default value is not needed because it is always manually defined
# but as per the documentation it is typically `bin`
qt_configure_process_path(INSTALL_PUBLICBINDIR "bin"
"Symlinked user-facing executables")
endif()
endmacro()
macro(qt_internal_set_cmake_install_libdir)

View File

@ -178,6 +178,10 @@ function(qt_internal_configure_qt)
-skip qtactiveqt,qtimageformats,qtlanguageserver,qtsvg
--
-DWARNINGS_ARE_ERRORS=OFF
# When 6.x.y version bumps are not merged in DAG-dependency order, this avoids
# blocking integrations due to mismatch of qtools package version and any of its
# dependencies.
-DQT_NO_PACKAGE_VERSION_INCOMPATIBLE_WARNING=ON
--log-level STATUS
--fresh
-GNinja

View File

@ -169,9 +169,8 @@ function(qt_internal_force_allow_unsuitable_cmake_version_for_building_qt out_va
# Temporarily allow any version when building in Qt's CI, so we can decouple the provisioning
# of the minimum CMake version from the bump of the minimum CMake version.
# The COIN_UNIQUE_JOB_ID env var is set in Qt's CI for both build and test work items.
# Current state is that this check is enabled.
# TODO: Disable it once provisioning is merged.
set(allow_any_version_in_ci TRUE)
# Current state is that this check is disabled.
set(allow_any_version_in_ci FALSE)
if(allow_any_version_in_ci AND DEFINED ENV{COIN_UNIQUE_JOB_ID})
set(allow_any_version TRUE)

View File

@ -105,7 +105,7 @@ if(MSVC)
if(NOT CLANG)
# -Ob3 was introduced in Visual Studio 2019 version 16.0
# However clang-cl can't recognize it.
string(APPEND QT_CFLAGS_OPTIMIZE " -Ob3 ")
string(APPEND QT_CFLAGS_OPTIMIZE " -Ob3")
endif()
set(QT_CFLAGS_OPTIMIZE_DEBUG "-Od")
set(QT_CFLAGS_OPTIMIZE_SIZE "-O1")

View File

@ -128,7 +128,12 @@ if(QT_DISABLE_NO_DEFAULT_PATH_IN_QT_PACKAGES)
set(__qt_use_no_default_path_for_qt_packages "")
endif()
foreach(module ${@INSTALL_CMAKE_NAMESPACE@_FIND_COMPONENTS})
set(__qt_umbrella_find_components ${@INSTALL_CMAKE_NAMESPACE@_FIND_COMPONENTS})
__qt_internal_handle_find_all_qt_module_packages(__qt_umbrella_find_components
COMPONENTS ${__qt_umbrella_find_components}
)
foreach(module ${__qt_umbrella_find_components})
if(NOT "${QT_HOST_PATH}" STREQUAL ""
AND "${module}" MATCHES "Tools$"
AND NOT "${module}" MATCHES "UiTools$"

View File

@ -16,6 +16,43 @@ function(qt_internal_add_doc_tool_dependency doc_target tool_name)
endif()
endfunction()
# Adds custom build and install targets to generate documentation for a documentation project
# identified by a cmake target and a path to a .qdocconf file.
#
# Creates custom targets of the form:
# - generate_docs_${target}
# - prepare_docs_${target}
# - html_docs_${target}
# - install_html_docs_${target}
# - etc.
#
# The first two arguments to the function should be <target> <path-to-qdocconf>.
#
# Additional options are:
# INDEX_DIRECTORIES - a list of index directories to pass to qdoc.
#
# DEFINES - extra environment variable assignments of the form ENV_VAR=VALUE, which should be set
# during qdoc execution.
#
# QDOC_EXTRA_ARGS - extra command-line arguments to pass to qdoc in both prepare and generate
# phases.
#
# QDOC_PREPARE_EXTRA_ARGS - extra command-line arguments to pass to qdoc in the prepare phase.
#
# QDOC_GENERATE_EXTRA_ARGS - extra command-line arguments to pass to qdoc in the generate phase.
#
# SHOW_INTERNAL - if set, the --showinternal option is passed to qdoc.
#
# Additional environment variables considered:
# QT_INSTALL_DOCS - directory path where the qt docs were expected to be installed, used for
# linking to other built docs. If not set, defaults to the qtbase or qt5 build directory, or the
# install directory extracted from the BuildInternals package.
#
# QT_QDOC_EXTRA_ARGS, QT_QDOC_PREPARE_EXTRA_ARGS, QT_QDOC_GENERATE_EXTRA_ARGS - same as the options
# but can be set as either environment or cmake variables.
#
# QT_QDOC_SHOW_INTERNAL - same as the option but can be set as either an environment or
# cmake variable.
function(qt_internal_add_docs)
if(NOT QT_BUILD_DOCS)
return()
@ -23,39 +60,67 @@ function(qt_internal_add_docs)
if(${ARGC} EQUAL 1)
# Function called from old generated CMakeLists.txt that was missing the target parameter
if(QT_FEATURE_developer_build)
message(AUTHOR_WARNING
"qt_internal_add_docs called with old signature. Skipping doc generation.")
endif()
return()
endif()
set(error_msg "qt_add_docs called with wrong number of arguments. ")
list(APPEND error_msg
"Should be qt_add_docs\(target_name qdocconf "
"\[INDEX_DIRECTORIES EXTRA_INDEX_DIRS_LIST_TO_ENABLE_QDOC_RESOLVE_LINKS\]\)")
if(NOT ${ARGC} GREATER_EQUAL 2)
message(FATAL_ERROR ${error_msg})
return()
message(FATAL_ERROR
"qt_internal_add_docs called with a wrong number of arguments. "
"The call should be qt_internal_add_docs\(<target> <path-to-qdocconf> [other-options])"
)
endif()
set(target ${ARGV0})
set(doc_project ${ARGV1})
set(qdoc_conf_path ${ARGV1})
set(opt_args
SHOW_INTERNAL
)
set(single_args "")
set(multi_args
INDEX_DIRECTORIES
DEFINES
QDOC_EXTRA_ARGS
QDOC_PREPARE_EXTRA_ARGS
QDOC_GENERATE_EXTRA_ARGS
)
cmake_parse_arguments(PARSE_ARGV 2 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
set(qdoc_extra_args "")
# Check if there are more than 2 arguments and pass them
# as extra --indexdir arguments to qdoc in prepare and
# The INDEX_DIRECTORIES key should enable passing a list of index
# directories as extra command-line arguments to qdoc, in prepare and
# generate phases.
if (${ARGC} GREATER 2)
# The INDEX_DIRECTORIES key should enable passing a list of index
# directories as extra command-line arguments to qdoc.
set(qdocExtraArgs "INDEX_DIRECTORIES;DEFINES")
cmake_parse_arguments(PARSE_ARGV 2 arg "" "" "${qdocExtraArgs}")
if(arg_UNPARSED_ARGUMENTS)
message(FATAL_ERROR ${error_msg})
return()
endif()
if(arg_INDEX_DIRECTORIES)
foreach(index_directory ${arg_INDEX_DIRECTORIES})
list(APPEND qdoc_extra_args "--indexdir" ${index_directory})
endforeach()
endif()
if(arg_INDEX_DIRECTORIES)
foreach(index_directory ${arg_INDEX_DIRECTORIES})
list(APPEND qdoc_extra_args "--indexdir" ${index_directory})
endforeach()
endif()
set(show_internal_env FALSE)
if(DEFINED ENV{QT_QDOC_SHOW_INTERNAL})
set(show_internal_env $ENV{QT_QDOC_SHOW_INTERNAL})
endif()
if(arg_SHOW_INTERNAL OR QT_QDOC_SHOW_INTERNAL OR show_internal_env)
list(APPEND qdoc_extra_args "--showinternal")
endif()
if(arg_QDOC_EXTRA_ARGS)
list(APPEND qdoc_extra_args ${arg_QDOC_EXTRA_ARGS})
endif()
if(QT_QDOC_EXTRA_ARGS)
list(APPEND qdoc_extra_args ${QT_QDOC_EXTRA_ARGS})
endif()
if(DEFINED ENV{QT_QDOC_EXTRA_ARGS})
list(APPEND qdoc_extra_args $ENV{QT_QDOC_EXTRA_ARGS})
endif()
# If a target is not built (which can happen for tools when crosscompiling), we shouldn't try
# to generate docs.
@ -77,7 +142,8 @@ function(qt_internal_add_docs)
set(doc_tools_libexec "${QtBase_BINARY_DIR}/${INSTALL_LIBEXECDIR}")
else()
set(doc_tools_bin "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_BINDIR}")
set(doc_tools_libexec "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_LIBEXECDIR}")
set(doc_tools_libexec
"${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_LIBEXECDIR}")
endif()
if(CMAKE_HOST_WIN32)
@ -121,15 +187,18 @@ function(qt_internal_add_docs)
set(include_path_args "")
endif()
get_filename_component(doc_target "${doc_project}" NAME_WLE)
get_filename_component(doc_target "${qdoc_conf_path}" NAME_WLE)
if (QT_WILL_INSTALL)
set(qdoc_output_dir "${CMAKE_BINARY_DIR}/${INSTALL_DOCDIR}/${doc_target}")
set(qdoc_qch_output_dir "${CMAKE_BINARY_DIR}/${INSTALL_DOCDIR}")
set(index_dir "${CMAKE_BINARY_DIR}/${INSTALL_DOCDIR}")
else()
set(qdoc_output_dir "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_DOCDIR}/${doc_target}")
set(qdoc_qch_output_dir "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_DOCDIR}")
set(index_dir "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_DOCDIR}")
set(qdoc_output_dir
"${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_DOCDIR}/${doc_target}")
set(qdoc_qch_output_dir
"${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_DOCDIR}")
set(index_dir
"${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_DOCDIR}")
endif()
# qtattributionsscanner
@ -144,7 +213,7 @@ function(qt_internal_add_docs)
# prepare docs target
set(prepare_qdoc_args
-outputdir "${qdoc_output_dir}"
"${target_source_dir}/${doc_project}"
"${target_source_dir}/${qdoc_conf_path}"
-prepare
-indexdir "${index_dir}"
-no-link-errors
@ -157,6 +226,18 @@ function(qt_internal_add_docs)
)
endif()
if(arg_QDOC_PREPARE_EXTRA_ARGS)
list(APPEND prepare_qdoc_args ${arg_QDOC_PREPARE_EXTRA_ARGS})
endif()
if(QT_QDOC_PREPARE_EXTRA_ARGS)
list(APPEND prepare_qdoc_args ${QT_QDOC_PREPARE_EXTRA_ARGS})
endif()
if(DEFINED ENV{QT_QDOC_PREPARE_EXTRA_ARGS})
list(APPEND prepare_qdoc_args $ENV{QT_QDOC_PREPARE_EXTRA_ARGS})
endif()
if(DEFINED ENV{QT_INSTALL_DOCS})
if(NOT EXISTS "$ENV{QT_INSTALL_DOCS}")
message(FATAL_ERROR
@ -167,7 +248,8 @@ function(qt_internal_add_docs)
elseif(QT_SUPERBUILD OR "${PROJECT_NAME}" STREQUAL "QtBase")
set(qt_install_docs_env "${QtBase_BINARY_DIR}/${INSTALL_DOCDIR}")
else()
set(qt_install_docs_env "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_DOCDIR}")
set(qt_install_docs_env
"${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_DOCDIR}")
endif()
set(qdoc_env_args
@ -198,7 +280,7 @@ function(qt_internal_add_docs)
# generate docs target
set(generate_qdoc_args
-outputdir "${qdoc_output_dir}"
"${target_source_dir}/${doc_project}"
"${target_source_dir}/${qdoc_conf_path}"
-generate
-indexdir "${index_dir}"
"${include_path_args}"
@ -210,6 +292,18 @@ function(qt_internal_add_docs)
)
endif()
if(arg_QDOC_GENERATE_EXTRA_ARGS)
list(APPEND generate_qdoc_args ${arg_QDOC_GENERATE_EXTRA_ARGS})
endif()
if(QT_QDOC_GENERATE_EXTRA_ARGS)
list(APPEND generate_qdoc_args ${QT_QDOC_GENERATE_EXTRA_ARGS})
endif()
if(DEFINED ENV{QT_QDOC_GENERATE_EXTRA_ARGS})
list(APPEND generate_qdoc_args $ENV{QT_QDOC_GENERATE_EXTRA_ARGS})
endif()
foreach(target_prefix generate_top_level_docs generate_repo_docs generate_docs)
set(depends_arg "")
if(tool_dependencies_enabled)

View File

@ -71,7 +71,12 @@ function(qt_internal_add_executable name)
endif()
endif()
if(arg_QT_APP AND QT_FEATURE_debug_and_release AND CMAKE_VERSION VERSION_GREATER_EQUAL "3.19.0")
get_cmake_property(is_multi_config GENERATOR_IS_MULTI_CONFIG)
if(arg_QT_APP
AND QT_FEATURE_debug_and_release
AND CMAKE_VERSION VERSION_GREATER_EQUAL "3.19.0"
AND is_multi_config
)
set_property(TARGET "${name}"
PROPERTY EXCLUDE_FROM_ALL "$<NOT:$<CONFIG:${QT_MULTI_CONFIG_FIRST_CONFIG}>>")
endif()
@ -252,23 +257,6 @@ function(qt_internal_add_executable name)
qt_internal_install_pdb_files(${name} "${arg_INSTALL_DIRECTORY}")
endif()
if(QT_GENERATE_SBOM)
set(sbom_args "")
_qt_internal_forward_function_args(
FORWARD_APPEND
FORWARD_PREFIX arg
FORWARD_OUT_VAR sbom_args
FORWARD_OPTIONS
${__qt_internal_sbom_optional_args}
FORWARD_SINGLE
${__qt_internal_sbom_single_args}
FORWARD_MULTI
${__qt_internal_sbom_multi_args}
)
_qt_internal_extend_sbom(${name} ${sbom_args})
endif()
qt_add_list_file_finalizer(qt_internal_finalize_executable "${name}")
endfunction()

View File

@ -353,6 +353,15 @@ function(qt_feature_check_and_save_user_provided_value
set("FEATURE_${feature}" "${result}" CACHE BOOL "${label}")
endif()
# Check for potential typo
get_property(original_name GLOBAL PROPERTY "QT_FEATURE_ORIGINAL_NAME_${feature}")
if(NOT original_name STREQUAL feature AND DEFINED "FEATURE_${original_name}")
unset("FEATURE_${original_name}" CACHE)
qt_configure_add_report_error(
"FEATURE_${original_name} does not exist. Consider using: FEATURE_${feature}"
)
endif()
set("${resultVar}" "${result}" PARENT_SCOPE)
endfunction()

View File

@ -387,6 +387,8 @@ endfunction()
# dep_target_name = EntryPointPrivate
# This is just a convenience function that deals with Qt targets and their associated packages
# instead of raw package names.
#
# Deprecated since 6.9.
function(qt_record_extra_qt_package_dependency main_target_name dep_target_name
dep_package_version)
# EntryPointPrivate -> Qt6EntryPointPrivate.
@ -571,17 +573,26 @@ function(qt_internal_get_package_name_of_target target package_name_out_var)
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)
# This function collects the list of Qt targets a library depend on,
# along with their version info, for usage in ${target}Dependencies.cmake file
# Multi-value Arguments:
# PUBLIC
# public dependencies
# PRIVATE
# private dependencies
function(qt_internal_register_target_dependencies target)
cmake_parse_arguments(PARSE_ARGV 1 arg "" "" "PUBLIC;PRIVATE")
get_target_property(target_deps "${target}" _qt_target_deps)
if(NOT target_deps)
set(target_deps "")
endif()
get_target_property(target_type ${target} TYPE)
set(lib_list ${public_libs})
set(lib_list "")
if(arg_PUBLIC)
set(lib_list "${arg_PUBLIC}")
endif()
get_target_property(target_type ${target} TYPE)
set(target_is_shared FALSE)
set(target_is_static FALSE)
if(target_type STREQUAL "SHARED_LIBRARY")
@ -595,8 +606,8 @@ function(qt_register_target_dependencies target public_libs private_libs)
#
# Private static library dependencies will become $<LINK_ONLY:> dependencies in
# INTERFACE_LINK_LIBRARIES.
if(target_is_static)
list(APPEND lib_list ${private_libs})
if(target_is_static AND arg_PRIVATE)
list(APPEND lib_list ${arg_PRIVATE})
endif()
foreach(lib IN LISTS lib_list)
@ -622,8 +633,8 @@ function(qt_register_target_dependencies target public_libs private_libs)
# See QTBUG-86533 for some details.
# We filter out static libraries and common platform targets, but include both SHARED and
# INTERFACE libraries. INTERFACE libraries in most cases will be FooPrivate libraries.
if(target_is_shared AND private_libs)
foreach(lib IN LISTS private_libs)
if(target_is_shared AND arg_PRIVATE)
foreach(lib IN LISTS arg_PRIVATE)
set(lib_namespaced "${lib}")
if("${lib}" MATCHES "^Qt::(.*)")
set(lib "${CMAKE_MATCH_1}")

View File

@ -465,21 +465,21 @@ endfunction()
function(qt_internal_print_optimization_flags_values_helper languages configs target_link_types)
foreach(lang ${languages})
set(flag_var_name "CMAKE_${lang}_FLAGS")
message(STATUS "${flag_var_name}: ${${flag_var_name}}")
message(STATUS "${flag_var_name}: '${${flag_var_name}}'")
foreach(config ${configs})
set(flag_var_name "CMAKE_${lang}_FLAGS_${config}")
message(STATUS "${flag_var_name}: ${${flag_var_name}}")
message(STATUS "${flag_var_name}: '${${flag_var_name}}'")
endforeach()
endforeach()
foreach(t ${target_link_types})
set(flag_var_name "CMAKE_${t}_LINKER_FLAGS")
message(STATUS "${flag_var_name}: ${${flag_var_name}}")
message(STATUS "${flag_var_name}: '${${flag_var_name}}'")
foreach(config ${configs})
set(flag_var_name "CMAKE_${t}_LINKER_FLAGS_${config}")
message(STATUS "${flag_var_name}: ${${flag_var_name}}")
message(STATUS "${flag_var_name}: '${${flag_var_name}}'")
endforeach()
endforeach()
endfunction()

View File

@ -38,6 +38,7 @@ macro(qt_find_apple_system_frameworks)
qt_internal_find_apple_system_framework(FWEventKit EventKit)
qt_internal_find_apple_system_framework(FWHealthKit HealthKit)
qt_internal_find_apple_system_framework(FWUniformTypeIdentifiers UniformTypeIdentifiers)
qt_internal_find_apple_system_framework(FWOpenGL OpenGL)
endif()
endmacro()
@ -169,7 +170,7 @@ function(qt_internal_generate_fake_framework_header target)
file(GENERATE OUTPUT "${fake_header}" CONTENT "// ignore this file\n"
CONDITION "$<CONFIG:${main_config}>")
target_sources(${target} PRIVATE "${fake_header}")
set_source_files_properties("${fake_header}" PROPERTIES GENERATED ON)
_qt_internal_set_source_file_generated(SOURCES "${fake_header}")
set_property(TARGET ${target} APPEND PROPERTY PUBLIC_HEADER "${fake_header}")
endfunction()

View File

@ -10,7 +10,8 @@ function(qt_get_library_name_without_prefix_and_suffix out_var file_path)
if(NOT file_path MATCHES "^-") # not a linker flag
get_filename_component(basename "${file_path}" NAME_WE)
get_filename_component(ext "${file_path}" EXT)
if(NOT ext) # seems like a library name without prefix and suffix
if(NOT ext AND NOT IS_ABSOLUTE "${file_path}")
# seems like a library name without prefix and suffix
set(${out_var} "${file_path}" PARENT_SCOPE)
return()
endif()

View File

@ -93,12 +93,11 @@ handle_type(cpp EXTENSIONS .c .cc .cpp .cxx .h .hh .hxx .hpp MODULES Core TEMPLA
handle_type(qml EXTENSIONS .qml .js .mjs MODULES Gui Qml Quick TEMPLATE
"\n\nqt_add_qml_module(${project_name}
URI ${project_name}
OUTPUT_DIRECTORY qml
VERSION 1.0
RESOURCE_PREFIX /qt/qml
QML_FILES
@files@
)"
)
set_property(TARGET ${project_name} PROPERTY RUNTIME_OUTPUT_NAME \"${project_name}app\")
"
)
handle_type(ui EXTENSIONS .ui MODULES Gui Widgets DEPENDS cpp TEMPLATE
@ -162,7 +161,7 @@ set(content
project(${project_name} LANGUAGES CXX)
find_package(Qt6 REQUIRED COMPONENTS ${packages_string})
qt_standard_project_setup()"
qt_standard_project_setup(REQUIRES 6.8)"
)
set(has_useful_sources FALSE)

View File

@ -14,3 +14,4 @@ set(QT@PROJECT_VERSION_MAJOR@_INSTALL_PLUGINS "@INSTALL_PLUGINSDIR@")
set(QT@PROJECT_VERSION_MAJOR@_INSTALL_QML "@INSTALL_QMLDIR@")
set(QT@PROJECT_VERSION_MAJOR@_INSTALL_TESTS "@INSTALL_TESTSDIR@")
set(QT@PROJECT_VERSION_MAJOR@_INSTALL_TRANSLATIONS "@INSTALL_TRANSLATIONSDIR@")
set(QT@PROJECT_VERSION_MAJOR@_INSTALL_DESCRIPTIONSDIR "@INSTALL_DESCRIPTIONSDIR@")

View File

@ -77,7 +77,7 @@ function(qt_internal_set_warnings_are_errors_flags target target_scope)
# 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>>")
set(cxx_only_genex "$<COMPILE_LANGUAGE:CXX,OBJCXX>")
set(final_condition_genex "$<AND:${warnings_are_errors_enabled_genex},${cxx_only_genex}>")
set(flags_generator_expression "$<${final_condition_genex}:${flags}>")

View File

@ -29,10 +29,67 @@ endif()
if (NOT QT_NO_CREATE_TARGETS AND @INSTALL_CMAKE_NAMESPACE@@target@_FOUND)
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@AdditionalTargetInfo.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@AdditionalTargetInfo.cmake"
OPTIONAL)
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@ExtraProperties.cmake"
OPTIONAL)
endif()
# Find the private module counterpart.
# For now, always load the private module. In a future Qt version we plan to require users to
# find_package the private module explicitly.
set(__qt_@target@_always_load_private_module ON)
set(__qt_@target@_save_QT_NO_PRIVATE_MODULE_WARNING ${QT_NO_PRIVATE_MODULE_WARNING})
set(QT_NO_PRIVATE_MODULE_WARNING ON)
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@-build.cmake" OPTIONAL)
if (@INSTALL_CMAKE_NAMESPACE@@target@_FOUND
AND NOT @INSTALL_CMAKE_NAMESPACE@@target_private@_FOUND
AND NOT @arg_NO_PRIVATE_MODULE@
AND (
__qt_@target@_always_load_private_module
OR DEFINED QT_REPO_MODULE_VERSION
OR QT_FIND_PRIVATE_MODULES
)
)
if("${_qt_cmake_dir}" STREQUAL "")
set(_qt_cmake_dir "${QT_TOOLCHAIN_RELOCATABLE_CMAKE_DIR}")
endif()
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_package(@INSTALL_CMAKE_NAMESPACE@@target_private@ "@PROJECT_VERSION@" EXACT
QUIET
CONFIG
PATHS
${QT_BUILD_CMAKE_PREFIX_PATH}
"${CMAKE_CURRENT_LIST_DIR}/.."
"${_qt_cmake_dir}"
${_qt_additional_packages_prefix_paths}
${__qt_use_no_default_path_for_qt_packages}
)
if(NOT @INSTALL_CMAKE_NAMESPACE@@target_private@_FOUND)
get_property(@INSTALL_CMAKE_NAMESPACE@@target_private@_warning_shown GLOBAL PROPERTY
@INSTALL_CMAKE_NAMESPACE@@target_private@_warning_shown
)
if(NOT @INSTALL_CMAKE_NAMESPACE@@target_private@_warning_shown)
message(VERBOSE
"The private module package '@INSTALL_CMAKE_NAMESPACE@@target_private@' "
"could not be found. It possibly needs to be installed separately with your "
"package manager."
)
set_property(GLOBAL PROPERTY
@INSTALL_CMAKE_NAMESPACE@@target_private@_warning_shown ON
)
endif()
endif()
endif()
set(QT_NO_PRIVATE_MODULE_WARNING ${__qt_@target@_save_QT_NO_PRIVATE_MODULE_WARNING})
unset(__qt_@target@_save_QT_NO_PRIVATE_MODULE_WARNING)
unset(__qt_@target@_always_load_private_module)
if (NOT QT_NO_CREATE_TARGETS AND @INSTALL_CMAKE_NAMESPACE@@target@_FOUND)
# DEPRECATED
# Provide old style variables for includes, compile definitions, etc.
# These variables are deprecated and only provided on a best-effort basis to facilitate porting.
@ -120,18 +177,28 @@ if (TARGET @QT_CMAKE_EXPORT_NAMESPACE@::@target@)
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Plugins.cmake")
endif()
list(APPEND QT_ALL_MODULES_FOUND_VIA_FIND_PACKAGE "@target@")
if(NOT "@target@" IN_LIST QT_ALL_MODULES_FOUND_VIA_FIND_PACKAGE)
list(APPEND QT_ALL_MODULES_FOUND_VIA_FIND_PACKAGE "@target@")
list(APPEND QT_ALL_MODULES_VERSIONED_FOUND_VIA_FIND_PACKAGE
"@INSTALL_CMAKE_NAMESPACE@::@target@")
endif()
get_target_property(_qt_module_target_type "@INSTALL_CMAKE_NAMESPACE@::@target@" TYPE)
if(NOT _qt_module_target_type STREQUAL "INTERFACE_LIBRARY")
get_target_property(_qt_module_plugin_types
@INSTALL_CMAKE_NAMESPACE@::@target@ MODULE_PLUGIN_TYPES)
if(_qt_module_plugin_types)
list(APPEND QT_ALL_PLUGIN_TYPES_FOUND_VIA_FIND_PACKAGE "${_qt_module_plugin_types}")
foreach(_qt_module_plugin_type IN LISTS _qt_module_plugin_types)
if(NOT "${_qt_module_plugin_type}"
IN_LIST QT_ALL_PLUGIN_TYPES_FOUND_VIA_FIND_PACKAGE)
list(APPEND QT_ALL_PLUGIN_TYPES_FOUND_VIA_FIND_PACKAGE
"${_qt_module_plugin_type}")
endif()
endforeach()
unset(_qt_module_plugin_type)
endif()
endif()
# Load Module's BuildInternals should any exist
if (@INSTALL_CMAKE_NAMESPACE@BuildInternals_DIR AND
EXISTS "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@BuildInternals.cmake")

View File

@ -0,0 +1,64 @@
# Copyright (C) 2024 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
@PACKAGE_INIT@
cmake_minimum_required(VERSION @min_new_policy_version@...@max_new_policy_version@)
include(CMakeFindDependencyMacro)
# Find required dependencies, if any.
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target_private@Dependencies.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target_private@Dependencies.cmake")
_qt_internal_suggest_dependency_debugging(@target_private@
__qt_@target_private@_pkg ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE)
endif()
# If *ConfigDependencies.cmake exists, the variable value will be defined there.
# Don't override it in that case.
if(NOT DEFINED "@INSTALL_CMAKE_NAMESPACE@@target_private@_FOUND")
set("@INSTALL_CMAKE_NAMESPACE@@target_private@_FOUND" TRUE)
endif()
if(NOT DEFINED QT_REPO_MODULE_VERSION
AND NOT QT_NO_PRIVATE_MODULE_WARNING
AND NOT __qt_private_module_@target_private@_warning_shown)
message(WARNING
"This project is using headers of the @target_private@ module and will therefore be tied "
"to this specific Qt module build version. "
"Running this project against other versions of the Qt modules may crash at any arbitrary "
"point. This is not a bug, but a result of using Qt internals. You have been warned! "
"\nYou can disable this warning by setting QT_NO_PRIVATE_MODULE_WARNING to ON."
)
set(__qt_private_module_@target_private@_warning_shown TRUE)
endif()
if(NOT QT_NO_CREATE_TARGETS AND @INSTALL_CMAKE_NAMESPACE@@target_private@_FOUND)
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target_private@Targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target_private@AdditionalTargetInfo.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target_private@ExtraProperties.cmake"
OPTIONAL)
endif()
if(TARGET @QT_CMAKE_EXPORT_NAMESPACE@::@target_private@)
if(NOT QT_NO_CREATE_VERSIONLESS_TARGETS)
if(CMAKE_VERSION VERSION_LESS 3.18 OR QT_USE_OLD_VERSION_LESS_TARGETS)
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target_private@VersionlessTargets.cmake")
else()
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target_private@VersionlessAliasTargets.cmake")
endif()
endif()
else()
set(@INSTALL_CMAKE_NAMESPACE@@target_private@_FOUND FALSE)
if(NOT DEFINED @INSTALL_CMAKE_NAMESPACE@@target_private@_NOT_FOUND_MESSAGE)
set(@INSTALL_CMAKE_NAMESPACE@@target_private@_NOT_FOUND_MESSAGE
"Target \"@QT_CMAKE_EXPORT_NAMESPACE@::@target_private@\" was not found.")
if(QT_NO_CREATE_TARGETS)
string(APPEND @INSTALL_CMAKE_NAMESPACE@@target_private@_NOT_FOUND_MESSAGE
"Possibly due to QT_NO_CREATE_TARGETS being set to TRUE and thus "
"${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target_private@Targets.cmake was not "
"included to define the target.")
endif()
endif()
endif()

View File

@ -32,16 +32,20 @@ endif()
set(__qt_@target@_third_party_deps "@third_party_deps@")
@third_party_deps_extra_info@
_qt_internal_find_third_party_dependencies("@target@" __qt_@target@_third_party_deps)
unset(__qt_@target@_third_party_deps)
# Find Qt tool package.
set(__qt_@target@_tool_deps "@main_module_tool_deps@")
_qt_internal_find_tool_dependencies("@target@" __qt_@target@_tool_deps)
unset(__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_qt_dependencies("@target@" __qt_@target@_target_deps
__qt_@target@_find_dependency_paths)
unset(__qt_@target@_target_deps)
unset(__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

@ -81,7 +81,6 @@ endfunction()
# Options:
# NO_ADDITIONAL_TARGET_INFO
# Don't generate a Qt6*AdditionalTargetInfo.cmake file.
# The caller is responsible for creating one.
#
# MODULE_INTERFACE_NAME
# The custom name of the module interface. This name is used as a part of the include paths
@ -251,10 +250,9 @@ function(qt_internal_add_module target)
set(module_config_private_header "qt${arg_CONFIG_MODULE_NAME}-config_p.h")
# qt<module>-config.h/-config_p.h header files are not marked as GENERATED automatically
# for old CMake versions. Set the property explicitly here.
set_source_files_properties("${module_config_header}" "${module_config_private_header}"
PROPERTIES
GENERATED TRUE
SKIP_AUTOGEN TRUE
_qt_internal_set_source_file_generated(
SOURCES "${module_config_header}" "${module_config_private_header}"
SKIP_AUTOGEN
)
# Module define needs to take into account the config module name.
@ -327,7 +325,7 @@ function(qt_internal_add_module target)
set_target_properties(${target_private} PROPERTIES
_qt_config_module_name ${arg_CONFIG_MODULE_NAME}_private
_qt_package_version "${PROJECT_VERSION}"
_qt_package_name "${INSTALL_CMAKE_NAMESPACE}${target}"
_qt_package_name "${INSTALL_CMAKE_NAMESPACE}${target}Private"
_qt_is_private_module TRUE
_qt_public_module_target_name "${target}"
)
@ -340,6 +338,9 @@ function(qt_internal_add_module target)
)
set_property(TARGET "${target_private}" APPEND PROPERTY
EXPORT_PROPERTIES "${export_properties}")
# Let find_package(Qt6FooPrivate) also find_package(Qt6Foo).
qt_internal_register_target_dependencies("${target_private}" PUBLIC "Qt::${target}")
endif()
# FIXME: This workaround is needed because the deployment logic
@ -442,7 +443,7 @@ function(qt_internal_add_module target)
set(module_depends_header
"${module_build_interface_include_dir}/${module_include_name}Depends")
set_source_files_properties("${module_depends_header}" PROPERTIES GENERATED TRUE)
_qt_internal_set_source_file_generated(SOURCES "${module_depends_header}")
set_target_properties(${target} PROPERTIES _qt_module_depends_header
"${module_depends_header}")
if(NOT arg_HEADER_MODULE)
@ -691,6 +692,12 @@ function(qt_internal_add_module target)
set(path_suffix "${INSTALL_CMAKE_NAMESPACE}${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})
if(NOT arg_NO_PRIVATE_MODULE)
set(path_suffix "${INSTALL_CMAKE_NAMESPACE}${target_private}")
qt_path_join(private_config_build_dir ${QT_CONFIG_BUILD_DIR} ${path_suffix})
qt_path_join(private_config_install_dir ${QT_CONFIG_INSTALL_DIR} ${path_suffix})
endif()
unset(path_suffix)
set(extra_cmake_files)
set(extra_cmake_includes)
@ -739,9 +746,17 @@ set(QT_ALLOW_MISSING_TOOLS_PACKAGES TRUE)")
endif()
foreach(cmake_file IN LISTS arg_EXTRA_CMAKE_FILES)
get_filename_component(basename ${cmake_file} NAME)
file(COPY ${cmake_file} DESTINATION ${config_build_dir})
list(APPEND extra_cmake_files "${config_build_dir}/${basename}")
get_source_file_property(install_path ${cmake_file} QT_INSTALL_PATH)
if(NOT install_path)
# Sanitize the install_path from `NOTFOUND` to ""
set(install_path "")
endif()
file(COPY ${cmake_file} DESTINATION "${config_build_dir}/${install_path}")
qt_install(FILES
${cmake_file}
DESTINATION "${config_install_dir}/${install_path}"
COMPONENT Devel
)
# Make sure touched extra cmake files cause a reconfigure, so they get re-copied.
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${cmake_file}")
@ -781,10 +796,16 @@ set(QT_ALLOW_MISSING_TOOLS_PACKAGES TRUE)")
qt_internal_get_min_new_policy_cmake_version(min_new_policy_version)
qt_internal_get_max_new_policy_cmake_version(max_new_policy_version)
configure_package_config_file(
"${QT_CMAKE_DIR}/QtModuleConfig.cmake.in"
"${config_build_dir}/${INSTALL_CMAKE_NAMESPACE}${target}Config.cmake"
INSTALL_DESTINATION "${config_install_dir}"
if(is_static_lib)
set(write_basic_module_package_args IS_STATIC_LIB)
else()
set(write_basic_module_package_args "")
endif()
qt_internal_write_basic_module_package("${target}" "${target_private}"
${write_basic_module_package_args}
CONFIG_BUILD_DIR ${config_build_dir}
CONFIG_INSTALL_DIR ${config_install_dir}
)
if (EXISTS "${CMAKE_CURRENT_LIST_DIR}/${INSTALL_CMAKE_NAMESPACE}${target}BuildInternals.cmake")
@ -794,38 +815,45 @@ set(QT_ALLOW_MISSING_TOOLS_PACKAGES TRUE)")
list(APPEND extra_cmake_files "${config_build_dir}/${INSTALL_CMAKE_NAMESPACE}${target}BuildInternals.cmake")
endif()
write_basic_package_version_file(
"${config_build_dir}/${INSTALL_CMAKE_NAMESPACE}${target}ConfigVersionImpl.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)
qt_internal_write_qt_package_version_file(
"${INSTALL_CMAKE_NAMESPACE}${target}"
"${config_build_dir}/${INSTALL_CMAKE_NAMESPACE}${target}ConfigVersion.cmake"
)
qt_install(FILES
"${config_build_dir}/${INSTALL_CMAKE_NAMESPACE}${target}Config.cmake"
"${config_build_dir}/${INSTALL_CMAKE_NAMESPACE}${target}ConfigVersion.cmake"
"${config_build_dir}/${INSTALL_CMAKE_NAMESPACE}${target}ConfigVersionImpl.cmake"
${extra_cmake_files}
DESTINATION "${config_install_dir}"
COMPONENT Devel
)
file(COPY ${extra_cmake_files} DESTINATION "${config_build_dir}")
set(exported_targets ${target})
if(NOT ${arg_NO_PRIVATE_MODULE})
list(APPEND exported_targets ${target_private})
if(NOT arg_NO_PRIVATE_MODULE)
qt_internal_write_basic_module_package("${target}" "${target_private}"
${write_basic_module_package_args}
PRIVATE
CONFIG_BUILD_DIR ${private_config_build_dir}
CONFIG_INSTALL_DIR ${private_config_install_dir}
)
endif()
set(export_name "${INSTALL_CMAKE_NAMESPACE}${target}Targets")
qt_install(TARGETS ${exported_targets}
EXPORT ${export_name}
RUNTIME DESTINATION ${INSTALL_BINDIR}
LIBRARY DESTINATION ${INSTALL_LIBDIR}
ARCHIVE DESTINATION ${INSTALL_LIBDIR}
FRAMEWORK DESTINATION ${INSTALL_LIBDIR}
file(COPY ${extra_cmake_files} DESTINATION "${config_build_dir}")
set(targets_to_export ${target})
if(NOT ${arg_NO_PRIVATE_MODULE})
list(APPEND targets_to_export ${target_private})
endif()
_qt_internal_forward_function_args(
FORWARD_PREFIX arg
FORWARD_OUT_VAR export_module_args
FORWARD_OPTIONS NO_ADDITIONAL_TARGET_INFO
)
qt_internal_export_module(${target}
${export_module_args}
CONFIG_BUILD_DIR ${config_build_dir}
CONFIG_INSTALL_DIR ${config_install_dir}
)
if(NOT arg_NO_PRIVATE_MODULE)
qt_internal_export_module(${target_private}
${export_module_args}
CONFIG_BUILD_DIR ${private_config_build_dir}
CONFIG_INSTALL_DIR ${private_config_install_dir}
)
endif()
if(BUILD_SHARED_LIBS)
qt_apply_rpaths(TARGET "${target}" INSTALL_PATH "${INSTALL_LIBDIR}" RELATIVE_RPATH)
@ -839,29 +867,6 @@ set(QT_ALLOW_MISSING_TOOLS_PACKAGES TRUE)")
QT_ANDROID_MODULE_INSTALL_DIR ${INSTALL_LIBDIR})
endif()
qt_install(EXPORT ${export_name}
NAMESPACE ${QT_CMAKE_EXPORT_NAMESPACE}::
DESTINATION ${config_install_dir})
if(NOT arg_NO_ADDITIONAL_TARGET_INFO)
qt_internal_export_additional_targets_file(
TARGETS ${exported_targets}
EXPORT_NAME_PREFIX ${INSTALL_CMAKE_NAMESPACE}${target}
CONFIG_INSTALL_DIR "${config_install_dir}")
endif()
qt_internal_export_modern_cmake_config_targets_file(
TARGETS ${exported_targets}
EXPORT_NAME_PREFIX ${INSTALL_CMAKE_NAMESPACE}${target}
CONFIG_BUILD_DIR "${config_build_dir}"
CONFIG_INSTALL_DIR "${config_install_dir}"
)
qt_internal_export_genex_properties(TARGETS ${target}
EXPORT_NAME_PREFIX ${INSTALL_CMAKE_NAMESPACE}${target}
CONFIG_INSTALL_DIR "${config_install_dir}"
)
### fixme: cmake is missing a built-in variable for this. We want to apply it only to modules and plugins
# that belong to Qt.
if(NOT arg_HEADER_MODULE)
@ -980,12 +985,125 @@ set(QT_ALLOW_MISSING_TOOLS_PACKAGES TRUE)")
${__qt_internal_sbom_multi_args}
)
_qt_internal_extend_sbom(${target} ${sbom_args})
qt_internal_extend_qt_entity_sbom(${target} ${sbom_args})
endif()
qt_add_list_file_finalizer(qt_finalize_module ${target} ${arg_INTERNAL_MODULE} ${arg_NO_PRIVATE_MODULE})
endfunction()
# Write and install the basic Qt6Foo and Qt6FooPrivate packages.
#
# If PRIVATE is specified, write Qt6FooPrivate.
# Otherwise write its public counterpart.
function(qt_internal_write_basic_module_package target target_private)
set(no_value_options
IS_STATIC_LIB
PRIVATE
)
set(single_value_options
CONFIG_BUILD_DIR
CONFIG_INSTALL_DIR
)
set(multi_value_options "")
cmake_parse_arguments(PARSE_ARGV 0 arg
"${no_value_options}" "${single_value_options}" "${multi_value_options}"
)
if(arg_PRIVATE)
set(package_name "${INSTALL_CMAKE_NAMESPACE}${target_private}")
set(module_config_input_file "QtModuleConfigPrivate.cmake.in")
else()
set(package_name "${INSTALL_CMAKE_NAMESPACE}${target}")
set(module_config_input_file "QtModuleConfig.cmake.in")
endif()
if(arg_IS_STATIC_LIB AND NOT arg_PRIVATE AND CMAKE_VERSION VERSION_LESS "3.26")
# We auto-load the private module package from the public module package if we have a static
# Qt module and CMake's version is < 3.26. This is needed for the case "Qt6Foo links against
# Qt6BarPrivate", because CMake generates a check for the target Qt6::BarPrivate in
# Qt6FooTargets.cmake. Once we can require CMake 3.26, we can simply link against
# $<BUILD_LOCAL_INTERFACE:Qt6BarPrivate> in qt_internal_extend_target.
#
# For older CMake versions, we create an additional CMake file that's optionally included by
# Qt6FooConfig.cmake to work around the lack of BUILD_LOCAL_INTERFACE.
file(CONFIGURE
OUTPUT "${arg_CONFIG_BUILD_DIR}/${package_name}-build.cmake"
CONTENT "# This file marks this directory as part of Qt's build tree.
set(__qt_${target}_always_load_private_module ON)
"
)
endif()
configure_package_config_file(
"${QT_CMAKE_DIR}/${module_config_input_file}"
"${arg_CONFIG_BUILD_DIR}/${package_name}Config.cmake"
INSTALL_DESTINATION "${arg_CONFIG_INSTALL_DIR}"
)
write_basic_package_version_file(
"${arg_CONFIG_BUILD_DIR}/${package_name}ConfigVersionImpl.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)
qt_internal_write_qt_package_version_file(
"${package_name}"
"${arg_CONFIG_BUILD_DIR}/${package_name}ConfigVersion.cmake"
)
qt_install(FILES
"${arg_CONFIG_BUILD_DIR}/${package_name}Config.cmake"
"${arg_CONFIG_BUILD_DIR}/${package_name}ConfigVersion.cmake"
"${arg_CONFIG_BUILD_DIR}/${package_name}ConfigVersionImpl.cmake"
DESTINATION "${arg_CONFIG_INSTALL_DIR}"
COMPONENT Devel
)
endfunction()
function(qt_internal_export_module target)
set(no_value_options
NO_ADDITIONAL_TARGET_INFO
)
set(single_value_options
CONFIG_BUILD_DIR
CONFIG_INSTALL_DIR
)
set(multi_value_options "")
cmake_parse_arguments(PARSE_ARGV 1 arg
"${no_value_options}" "${single_value_options}" "${multi_value_options}"
)
_qt_internal_validate_all_args_are_parsed(arg)
set(export_name "${INSTALL_CMAKE_NAMESPACE}${target}Targets")
qt_install(TARGETS ${target}
EXPORT ${export_name}
RUNTIME DESTINATION ${INSTALL_BINDIR}
LIBRARY DESTINATION ${INSTALL_LIBDIR}
ARCHIVE DESTINATION ${INSTALL_LIBDIR}
FRAMEWORK DESTINATION ${INSTALL_LIBDIR}
)
qt_install(EXPORT ${export_name}
NAMESPACE ${QT_CMAKE_EXPORT_NAMESPACE}::
DESTINATION ${arg_CONFIG_INSTALL_DIR})
if(NOT arg_NO_ADDITIONAL_TARGET_INFO)
qt_internal_export_additional_targets_file(
TARGETS ${target}
EXPORT_NAME_PREFIX ${INSTALL_CMAKE_NAMESPACE}${target}
CONFIG_INSTALL_DIR "${arg_CONFIG_INSTALL_DIR}")
endif()
qt_internal_export_modern_cmake_config_targets_file(
TARGETS ${target}
EXPORT_NAME_PREFIX ${INSTALL_CMAKE_NAMESPACE}${target}
CONFIG_BUILD_DIR "${arg_CONFIG_BUILD_DIR}"
CONFIG_INSTALL_DIR "${arg_CONFIG_INSTALL_DIR}"
)
qt_internal_export_genex_properties(TARGETS ${target}
EXPORT_NAME_PREFIX ${INSTALL_CMAKE_NAMESPACE}${target}
CONFIG_INSTALL_DIR "${arg_CONFIG_INSTALL_DIR}"
)
endfunction()
function(qt_internal_apply_apple_privacy_manifest target)
# Avoid "INTERFACE_LIBRARY targets may only have whitelisted properties" error on CMake < 3.17.
get_target_property(target_type ${target} TYPE)
@ -1231,7 +1349,12 @@ function(qt_describe_module target)
qt_path_join(install_dir ${QT_INSTALL_DIR} ${path_suffix})
set(descfile_in "${QT_CMAKE_DIR}/ModuleDescription.json.in")
# IMPORTANT: If you adjust the file name not to be the exact target name and thus the CMake
# package name, it needs to consider also the code in QtConfig.cmake.in that globs the json
# files.
set(descfile_out "${build_dir}/${target}.json")
string(TOLOWER "${PROJECT_NAME}" lower_case_project_name)
set(extra_module_information "")
set(platforms_information "")
@ -1379,6 +1502,11 @@ function(qt_internal_generate_cpp_global_exports target module_define_infix)
set(${out_public_header} "${generated_header_path}" PARENT_SCOPE)
target_sources(${target} PRIVATE "${generated_header_path}")
_qt_internal_set_source_file_generated(
SOURCES "${generated_header_path}"
CONFIGURE_GENERATED
)
# `GENERATED` property is set in order to be processed by `qt_internal_collect_module_headers`
set_source_files_properties("${generated_header_path}" PROPERTIES GENERATED TRUE)
endfunction()

View File

@ -2,15 +2,10 @@
# SPDX-License-Identifier: BSD-3-Clause
# Find "ModuleTools" dependencies, which are other ModuleTools packages.
set(@INSTALL_CMAKE_NAMESPACE@@target@_FOUND FALSE)
set(__qt_@target@_tool_deps "@package_deps@")
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)
if (NOT ${__qt_@target@_pkg}_FOUND)
find_dependency(${__qt_@target@_pkg} ${__qt_@target@_version})
endif()
endforeach()
set(@INSTALL_CMAKE_NAMESPACE@@target@_FOUND TRUE)
set(__qt_@target@_tool_third_party_deps "@third_party_deps@")
_qt_internal_find_third_party_dependencies("@target@" __qt_@target@_tool_third_party_deps)
set(__qt_@target@_tool_deps "@package_deps@")
_qt_internal_find_tool_dependencies("@target@" __qt_@target@_tool_deps)

View File

@ -22,8 +22,7 @@ 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" OR ANDROID)
if(NOT UNIX AND NOT MINGW OR CMAKE_VERSION VERSION_LESS "3.20" OR ANDROID)
return()
endif()
if(NOT BUILD_SHARED_LIBS)
@ -34,7 +33,6 @@ function(qt_internal_generate_pkg_config_file module)
set(pkgconfig_name "${QT_CMAKE_EXPORT_NAMESPACE} ${module}")
set(pkgconfig_description "Qt ${module} module")
set(target "${QT_CMAKE_EXPORT_NAMESPACE}::${module}")
set(is_interface_library "$<STREQUAL:$<TARGET_PROPERTY:${target},TYPE>,INTERFACE_LIBRARY>")
# The flags macro expanded this variables so it's better to set them at
# their corresponding PkgConfig string.
set(includedir "\${includedir}")
@ -50,6 +48,12 @@ function(qt_internal_generate_pkg_config_file module)
get_target_property(loose_include_dirs ${target} INTERFACE_INCLUDE_DIRECTORIES)
list(TRANSFORM loose_include_dirs REPLACE "${INSTALL_INCLUDEDIR}" "\${includedir}")
list(TRANSFORM loose_include_dirs REPLACE "${INSTALL_MKSPECSDIR}" "\${mkspecsdir}")
if(QT_FEATURE_framework)
# Update the include path for framework headers which are located in INSTALL_LIBDIR,
# e.g. this results in -I${libdir}/Qt*.framework/Headers for Qt6*.pc file.
set(libdir "\${libdir}")
list(TRANSFORM loose_include_dirs REPLACE "${INSTALL_LIBDIR}" "\${libdir}")
endif()
# Remove genex wrapping around gc_sections flag because we can't evaluate genexes like
# $<CXX_COMPILER_ID> in file(GENERATE). And given that .pc files don't support dynamic
@ -69,6 +73,17 @@ function(qt_internal_generate_pkg_config_file module)
set(contains_mkspecs TRUE)
endif()
get_target_property(type ${target} TYPE)
if(NOT type STREQUAL "INTERFACE_LIBRARY")
get_target_property(is_framework ${target} FRAMEWORK)
if(is_framework)
qt_internal_get_framework_info(fw ${target})
string(PREPEND link_options "-F\${libdir} -framework ${fw_name} ")
else()
string(PREPEND link_options "-L\${libdir} -l${pkgconfig_file} ")
endif()
endif()
# TODO: Handle macOS framework builds
qt_internal_collect_direct_target_dependencies(${target} loose_target_requires)
foreach(dep IN LISTS loose_target_requires)

View File

@ -23,37 +23,10 @@ if (NOT IS_DIRECTORY "${ANDROID_SDK_ROOT}")
message(FATAL_ERROR "Could not find ANDROID_SDK_ROOT or path is not a directory: ${ANDROID_SDK_ROOT}")
endif()
function(qt_internal_sort_android_platforms out_var)
if(CMAKE_VERSION GREATER_EQUAL 3.18)
set(platforms ${ARGN})
list(SORT platforms COMPARE NATURAL)
else()
# Simulate natural sorting:
# - prepend every platform with its version as three digits, zero-padded
# - regular sort
# - remove the padded version prefix
set(platforms)
foreach(platform IN LISTS ARGN)
set(version "000")
if(platform MATCHES ".*-([0-9]+)$")
set(version ${CMAKE_MATCH_1})
string(LENGTH "${version}" version_length)
math(EXPR padding_length "3 - ${version_length}")
string(REPEAT "0" ${padding_length} padding)
string(PREPEND version ${padding})
endif()
list(APPEND platforms "${version}~${platform}")
endforeach()
list(SORT platforms)
list(TRANSFORM platforms REPLACE "^.*~" "")
endif()
set("${out_var}" "${platforms}" PARENT_SCOPE)
endfunction()
# This variable specifies the API level used for building Java code, it can be the same as Qt for
# Android's maximum supported Android version or higher.
if(NOT QT_ANDROID_API_USED_FOR_JAVA)
set(QT_ANDROID_API_USED_FOR_JAVA "android-34")
set(QT_ANDROID_API_USED_FOR_JAVA "android-35")
endif()
set(jar_location "${ANDROID_SDK_ROOT}/platforms/${QT_ANDROID_API_USED_FOR_JAVA}/android.jar")

View File

@ -29,8 +29,12 @@ if (NOT QT_NO_CREATE_TARGETS)
# 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")
else()
set(@target@_FOUND TRUE)
endif()
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@AdditionalTargetInfo.cmake")
if(@target@_FOUND)
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@AdditionalTargetInfo.cmake")
endif()
endif()

View File

@ -1,11 +1,12 @@
# Copyright (C) 2024 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
set(@target@_FOUND FALSE)
set(@target@_FOUND TRUE)
# note: _third_party_deps example: "ICU\\;FALSE\\;1.0\\;i18n uc data;ZLIB\\;FALSE\\;\\;"
set(__qt_@target@_third_party_deps "@third_party_deps@")
_qt_internal_find_third_party_dependencies("@target@" __qt_@target@_third_party_deps)
unset(__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)
@ -17,5 +18,9 @@ set(__qt_@target@_target_deps "@target_deps@")
set(__qt_@target@_find_dependency_paths "@find_dependency_paths@")
_qt_internal_find_qt_dependencies("@target@" __qt_@target@_target_deps
__qt_@target@_find_dependency_paths)
unset(__qt_@target@_target_deps)
unset(__qt_@target@_find_dependency_paths)
set(@target@_FOUND TRUE)
if(__qt_${target}_missing_deps)
set(@target@_FOUND FALSE)
endif()

View File

@ -229,8 +229,6 @@ function(qt_internal_add_plugin target)
__qt_internal_add_interface_plugin_target(${qt_module_target} ${target})
endif()
set(plugin_target_versioned "${QT_CMAKE_EXPORT_NAMESPACE}::${target}")
get_target_property(type "${plugin_target_versioned}" TYPE)
qt_internal_add_autogen_sync_header_dependencies(${target} ${qt_module_target})
endif()
@ -337,7 +335,15 @@ function(qt_internal_add_plugin target)
endif()
endforeach()
qt_register_target_dependencies("${target}" "${arg_PUBLIC_LIBRARIES}" "${qt_libs_private}")
set(qt_register_target_dependencies_args "")
if(arg_PUBLIC_LIBRARIES)
list(APPEND qt_register_target_dependencies_args PUBLIC ${arg_PUBLIC_LIBRARIES})
endif()
if(qt_libs_private)
list(APPEND qt_register_target_dependencies_args PRIVATE ${qt_libs_private})
endif()
qt_internal_register_target_dependencies("${target}"
${qt_register_target_dependencies_args})
if(target_type STREQUAL STATIC_LIBRARY)
if(qt_module_target)
@ -470,7 +476,7 @@ endif()"
${__qt_internal_sbom_multi_args}
)
_qt_internal_extend_sbom(${target} ${sbom_args})
qt_internal_extend_qt_entity_sbom(${target} ${sbom_args})
endif()
qt_add_list_file_finalizer(qt_finalize_plugin ${target} ${finalizer_extra_args})

View File

@ -29,7 +29,7 @@ macro(qt_collect_third_party_deps target)
endif()
unset(_target_is_static)
foreach(dep ${${depends_var}} ${optional_public_depends} ${extra_third_party_deps})
foreach(dep ${${depends_var}} ${extra_third_party_deps})
# Gather third party packages that should be found when using the Qt module.
# Also handle nolink target dependencies.
string(REGEX REPLACE "_nolink$" "" base_dep "${dep}")
@ -48,9 +48,6 @@ macro(qt_collect_third_party_deps target)
if(dep_seen EQUAL -1 AND package_name)
list(APPEND third_party_deps_seen ${dep})
get_target_property(package_is_optional ${dep} INTERFACE_QT_PACKAGE_IS_OPTIONAL)
if(NOT package_is_optional AND dep IN_LIST optional_public_depends)
set(package_is_optional TRUE)
endif()
get_target_property(package_version ${dep} INTERFACE_QT_PACKAGE_VERSION)
if(NOT package_version)
set(package_version "")
@ -143,6 +140,13 @@ function(qt_internal_remove_qt_dependency_duplicates out_deps deps)
endfunction()
function(qt_internal_create_module_depends_file target)
set(no_value_options "")
set(single_value_options "")
set(multi_value_options "")
cmake_parse_arguments(PARSE_ARGV 1 arg
"${no_value_options}" "${single_value_options}" "${multi_value_options}"
)
get_target_property(target_type "${target}" TYPE)
set(is_interface_lib FALSE)
if(target_type STREQUAL "INTERFACE_LIBRARY")
@ -156,11 +160,6 @@ function(qt_internal_create_module_depends_file target)
get_target_property(public_depends "${target}" INTERFACE_LINK_LIBRARIES)
unset(optional_public_depends)
if(TARGET "${target}Private")
get_target_property(optional_public_depends "${target}Private" INTERFACE_LINK_LIBRARIES)
endif()
# Used for collecting Qt module dependencies that should be find_package()'d in
# ModuleDependencies.cmake.
get_target_property(target_deps "${target}" _qt_target_deps)
@ -168,8 +167,11 @@ function(qt_internal_create_module_depends_file target)
set(qt_module_dependencies "")
if(NOT is_interface_lib)
# TODO: deprecated code path. QT_EXTRA_PACKAGE_DEPENDENCIES shouldn't be used for the Qt
# packages.
get_target_property(extra_depends "${target}" QT_EXTRA_PACKAGE_DEPENDENCIES)
endif()
if(NOT extra_depends MATCHES "-NOTFOUND$")
list(APPEND target_deps "${extra_depends}")
endif()
@ -337,7 +339,6 @@ function(qt_internal_create_plugin_depends_file target)
get_target_property(depends "${target}" LINK_LIBRARIES)
get_target_property(public_depends "${target}" INTERFACE_LINK_LIBRARIES)
get_target_property(target_deps "${target}" _qt_target_deps)
unset(optional_public_depends)
set(target_deps_seen "")
@ -398,7 +399,6 @@ function(qt_internal_create_qt6_dependencies_file)
set(actual_target Platform)
get_target_property(public_depends "${actual_target}" INTERFACE_LINK_LIBRARIES)
unset(depends)
unset(optional_public_depends)
set(third_party_deps "")
set(third_party_deps_seen "")
@ -467,6 +467,9 @@ function(qt_internal_create_depends_files)
foreach (target ${repo_known_modules})
qt_internal_create_module_depends_file(${target})
if(TARGET "${target}Private")
qt_internal_create_module_depends_file(${target}Private)
endif()
endforeach()
foreach (target ${QT_KNOWN_PLUGINS})
@ -494,67 +497,8 @@ function(qt_internal_create_plugins_auto_inclusion_files)
if(QT_MODULE STREQUAL "Qml")
set(QT_MODULE_PLUGIN_INCLUDES "${QT_MODULE_PLUGIN_INCLUDES}
# Qml plugin targets might have dependencies on other qml plugin targets, but the Targets.cmake
# files are included in the order that file(GLOB) returns, which means certain targets that are
# referenced might not have been created yet, and \${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
# might be set to a message saying those targets don't exist.
#
# Postpone checking of which targets don't exist until all Qml PluginConfig.cmake files have been
# included, by including all the files one more time and checking for errors at each step.
#
# TODO: Find a better way to deal with this, perhaps by using find_package() instead of include
# for the Qml PluginConfig.cmake files.
# Distributions should probably change this default.
if(NOT DEFINED QT_SKIP_AUTO_QML_PLUGIN_INCLUSION)
set(QT_SKIP_AUTO_QML_PLUGIN_INCLUSION OFF)
endif()
set(__qt_qml_plugins_config_file_list \"\")
set(__qt_qml_plugins_glob_prefixes \"\${CMAKE_CURRENT_LIST_DIR}\")
# Allow passing additional prefixes where we will glob for PluginConfig.cmake files.
if(QT_ADDITIONAL_QML_PLUGIN_GLOB_PREFIXES)
foreach(__qt_qml_plugin_glob_prefix IN LISTS QT_ADDITIONAL_QML_PLUGIN_GLOB_PREFIXES)
if(__qt_qml_plugin_glob_prefix)
list(APPEND __qt_qml_plugins_glob_prefixes \"\${__qt_qml_plugin_glob_prefix}\")
endif()
endforeach()
endif()
list(REMOVE_DUPLICATES __qt_qml_plugins_glob_prefixes)
foreach(__qt_qml_plugin_glob_prefix IN LISTS __qt_qml_plugins_glob_prefixes)
file(GLOB __qt_qml_plugins_glob_config_file_list
\"\${__qt_qml_plugin_glob_prefix}/QmlPlugins/${INSTALL_CMAKE_NAMESPACE}*Config.cmake\")
if(__qt_qml_plugins_glob_config_file_list)
list(APPEND __qt_qml_plugins_config_file_list \${__qt_qml_plugins_glob_config_file_list})
endif()
endforeach()
if (__qt_qml_plugins_config_file_list AND NOT QT_SKIP_AUTO_QML_PLUGIN_INCLUSION)
# First round of inclusions ensure all qml plugin targets are brought into scope.
foreach(__qt_qml_plugin_config_file \${__qt_qml_plugins_config_file_list})
include(\${__qt_qml_plugin_config_file})
# Temporarily unset any failure markers and mark the Qml package as found.
unset(\${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE)
set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND TRUE)
endforeach()
# For the second round of inclusions, check and bail out early if there are errors.
foreach(__qt_qml_plugin_config_file \${__qt_qml_plugins_config_file_list})
include(\${__qt_qml_plugin_config_file})
if(\${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE)
string(APPEND \${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
\"\nThe message was set in \${__qt_qml_plugin_config_file} \")
set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
return()
endif()
endforeach()
endif()")
__qt_internal_include_qml_plugin_packages()
")
endif()
get_target_property(module_plugin_types "${QT_MODULE}" MODULE_PLUGIN_TYPES)
@ -584,6 +528,11 @@ function(qt_generate_install_prefixes out_var)
INSTALL_PLUGINSDIR INSTALL_LIBEXECDIR INSTALL_QMLDIR INSTALL_DATADIR INSTALL_DOCDIR
INSTALL_TRANSLATIONSDIR INSTALL_SYSCONFDIR INSTALL_EXAMPLESDIR INSTALL_TESTSDIR
INSTALL_DESCRIPTIONSDIR INSTALL_SBOMDIR)
# INSTALL_PUBLICBINDIR is processed only if it is not empty
# See usage in qt_internal_generate_user_facing_tools_info
if(NOT "${INSTALL_PUBLICBINDIR}" STREQUAL "")
list(APPEND vars INSTALL_PUBLICBINDIR)
endif()
foreach(var ${vars})
get_property(docstring CACHE "${var}" PROPERTY HELPSTRING)
@ -921,6 +870,7 @@ function(qt_internal_generate_user_facing_tools_info)
if("${INSTALL_PUBLICBINDIR}" STREQUAL "")
return()
endif()
qt_path_join(tool_link_base_dir "${CMAKE_INSTALL_PREFIX}" "${INSTALL_PUBLICBINDIR}")
get_property(user_facing_tool_targets GLOBAL PROPERTY QT_USER_FACING_TOOL_TARGETS)
set(lines "")
foreach(target ${user_facing_tool_targets})
@ -937,6 +887,7 @@ function(qt_internal_generate_user_facing_tools_info)
endif()
qt_path_join(tool_target_path "${CMAKE_INSTALL_PREFIX}" "${INSTALL_BINDIR}" "${filename}")
qt_path_join(tool_link_path "${INSTALL_PUBLICBINDIR}" "${linkname}${PROJECT_VERSION_MAJOR}")
_qt_internal_relative_path(tool_target_path BASE_DIRECTORY ${tool_link_base_dir})
list(APPEND lines "${tool_target_path} ${tool_link_path}")
endforeach()
string(REPLACE ";" "\n" content "${lines}")

View File

@ -3,7 +3,7 @@
function(qt_update_precompiled_header target precompiled_header)
if (precompiled_header AND BUILD_WITH_PCH)
set_property(TARGET "${target}" APPEND PROPERTY "PRECOMPILE_HEADERS" "$<$<OR:$<COMPILE_LANGUAGE:CXX>,$<COMPILE_LANGUAGE:OBJCXX>>:${precompiled_header}>")
set_property(TARGET "${target}" APPEND PROPERTY "PRECOMPILE_HEADERS" "$<$<COMPILE_LANGUAGE:CXX,OBJCXX>:${precompiled_header}>")
endif()
endfunction()

View File

@ -871,29 +871,27 @@ function(guess_compiler_from_mkspec)
check_whether_to_guess_compiler(guess_c_compiler CC CMAKE_C_COMPILER)
check_whether_to_guess_compiler(guess_cxx_compiler CXX CMAKE_CXX_COMPILER)
if(NOT guess_c_compiler AND NOT guess_cxx_compiler)
return()
endif()
string(REGEX MATCH "(^|;)-DQT_QMAKE_TARGET_MKSPEC=\([^;]+\)" m "${cmake_args}")
set(mkspec ${CMAKE_MATCH_2})
set(c_compiler "")
set(cxx_compiler "")
if(mkspec MATCHES "-clang-msvc$")
set(c_compiler "clang-cl")
set(cxx_compiler "clang-cl")
elseif(mkspec MATCHES "-clang(-|$)" AND NOT mkspec MATCHES "android")
set(c_compiler "clang")
set(cxx_compiler "clang++")
elseif(mkspec MATCHES "-msvc(-|$)")
set(c_compiler "cl")
set(cxx_compiler "cl")
endif()
if(guess_c_compiler AND NOT c_compiler STREQUAL "")
push("-DCMAKE_C_COMPILER=${c_compiler}")
endif()
if(guess_cxx_compiler AND NOT cxx_compiler STREQUAL "")
push("-DCMAKE_CXX_COMPILER=${cxx_compiler}")
if(guess_c_compiler OR guess_cxx_compiler)
set(c_compiler "")
set(cxx_compiler "")
if(mkspec MATCHES "-clang-msvc$")
set(c_compiler "clang-cl")
set(cxx_compiler "clang-cl")
elseif(mkspec MATCHES "-clang(-|$)" AND NOT mkspec MATCHES "android")
set(c_compiler "clang")
set(cxx_compiler "clang++")
elseif(mkspec MATCHES "-msvc(-|$)")
set(c_compiler "cl")
set(cxx_compiler "cl")
endif()
if(guess_c_compiler AND NOT c_compiler STREQUAL "")
push("-DCMAKE_C_COMPILER=${c_compiler}")
endif()
if(guess_cxx_compiler AND NOT cxx_compiler STREQUAL "")
push("-DCMAKE_CXX_COMPILER=${cxx_compiler}")
endif()
endif()
if(mkspec MATCHES "-libc\\+\\+$")
push("-DFEATURE_stdlib_libcpp=ON")

View File

@ -10,7 +10,7 @@ function(_qt_internal_detect_latest_android_platform out_var)
# If list is not empty
if(android_platforms)
qt_internal_sort_android_platforms(android_platforms ${android_platforms})
_qt_internal_sort_android_platforms(android_platforms ${android_platforms})
list(REVERSE android_platforms)
list(GET android_platforms 0 android_platform_latest)
set(${out_var} "${android_platform_latest}" PARENT_SCOPE)
@ -18,3 +18,30 @@ function(_qt_internal_detect_latest_android_platform out_var)
set(${out_var} "${out_var}-NOTFOUND" PARENT_SCOPE)
endif()
endfunction()
function(_qt_internal_sort_android_platforms out_var)
if(CMAKE_VERSION GREATER_EQUAL 3.18)
set(platforms ${ARGN})
list(SORT platforms COMPARE NATURAL)
else()
# Simulate natural sorting:
# - prepend every platform with its version as three digits, zero-padded
# - regular sort
# - remove the padded version prefix
set(platforms)
foreach(platform IN LISTS ARGN)
set(version "000")
if(platform MATCHES ".*-([0-9]+)$")
set(version ${CMAKE_MATCH_1})
string(LENGTH "${version}" version_length)
math(EXPR padding_length "3 - ${version_length}")
string(REPEAT "0" ${padding_length} padding)
string(PREPEND version ${padding})
endif()
list(APPEND platforms "${version}~${platform}")
endforeach()
list(SORT platforms)
list(TRANSFORM platforms REPLACE "^.*~" "")
endif()
set("${out_var}" "${platforms}" PARENT_SCOPE)
endfunction()

View File

@ -97,9 +97,9 @@ function(_qt_internal_handle_ios_launch_screen target)
endif()
endfunction()
function(_qt_internal_find_ios_development_team_id out_var)
function(_qt_internal_find_apple_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)
get_property(team_id_computed GLOBAL PROPERTY _qt_internal_apple_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)
@ -109,17 +109,31 @@ function(_qt_internal_find_ios_development_team_id out_var)
return()
endif()
set_property(GLOBAL PROPERTY _qt_internal_ios_development_team_id_computed "TRUE")
set_property(GLOBAL PROPERTY _qt_internal_apple_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)
# Try Xcode 16.2 format first
_qt_internal_plist_buddy("${xcode_preferences_path}"
COMMANDS "print IDEProvisioningTeamByIdentifier"
EXTRA_ARGS -x
OUTPUT_VARIABLE teams_xml
ERROR_VARIABLE plist_error
)
# Then fall back to older format
if(plist_error OR NOT teams_xml)
_qt_internal_plist_buddy("${xcode_preferences_path}"
COMMANDS "print IDEProvisioningTeams"
EXTRA_ARGS -x
OUTPUT_VARIABLE teams_xml
ERROR_VARIABLE plist_error
)
endif()
# Parsing state.
set(is_free "")
@ -152,6 +166,16 @@ function(_qt_internal_find_ios_development_team_id out_var)
# ...
# </dict>
# </array>
# <key>AAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE</key>
# <array>
# <dict>
# <key>isFreeProvisioningTeam</key>
# <false/>
# <key>teamID</key>
# <string>CCC</string>
# ...
# </dict>
# </array>
#</dict>
#</plist>
if(teams_xml AND NOT plist_error)
@ -270,7 +294,7 @@ function(_qt_internal_get_default_apple_bundle_identifier target out_var)
# 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)
_qt_internal_find_apple_development_team_id(team_id)
if(team_id)
string(SHA1 hash "${team_id}")
string(SUBSTRING "${hash}" 0 8 infix)
@ -378,7 +402,7 @@ function(_qt_internal_set_xcode_development_team_id target)
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)
_qt_internal_find_apple_development_team_id(team_id)
set_target_properties("${target}"
PROPERTIES XCODE_ATTRIBUTE_DEVELOPMENT_TEAM "${team_id}")
endif()
@ -635,10 +659,10 @@ endfunction()
function(_qt_internal_plist_buddy plist_file)
cmake_parse_arguments(PARSE_ARGV 1 arg
"" "OUTPUT_VARIABLE;ERROR_VARIABLE" "COMMANDS")
"" "OUTPUT_VARIABLE;ERROR_VARIABLE;EXTRA_ARGS" "COMMANDS")
foreach(command ${arg_COMMANDS})
execute_process(COMMAND "/usr/libexec/PlistBuddy"
-c "${command}" "${plist_file}"
${arg_EXTRA_ARGS} -c "${command}" "${plist_file}"
OUTPUT_VARIABLE plist_buddy_output
ERROR_VARIABLE plist_buddy_error)
string(STRIP "${plist_buddy_output}" plist_buddy_output)
@ -730,6 +754,25 @@ function(_qt_internal_set_ios_simulator_arch target)
"x86_64")
endfunction()
function(_qt_internal_set_xcode_entrypoint_attribute target entrypoint)
if(CMAKE_XCODE_ATTRIBUTE_LD_ENTRY_POINT
OR QT_NO_SET_XCODE_LD_ENTRY_POINT)
return()
endif()
get_target_property(existing_entrypoint
"${target}" XCODE_ATTRIBUTE_LD_ENTRY_POINT)
if(NOT existing_entrypoint MATCHES "-NOTFOUND")
return()
endif()
set_target_properties("${target}"
PROPERTIES
"XCODE_ATTRIBUTE_LD_ENTRY_POINT"
"${entrypoint}")
endfunction()
# Export Apple platform sdk and xcode version requirements to Qt6ConfigExtras.cmake.
# Always exported, even on non-Apple platforms, so that we can use them when building
# documentation.
@ -844,9 +887,9 @@ function(_qt_internal_get_cached_xcode_version out_var)
set(${out_var} "${xcode_version}" PARENT_SCOPE)
endfunction()
# Warn when the platform SDK or Xcode version are not supported.
# Warn or error out when the platform SDK or Xcode version are not supported.
#
# The warnings are currently only shown when building Qt, not when building user projects
# The messages are currently only shown when building Qt, not when building user projects
# with CMake.
# The warnings ARE shown for qmake user projects.
#
@ -891,11 +934,14 @@ function(_qt_internal_check_apple_sdk_and_xcode_versions)
endif()
# The default differs in different branches.
set(failed_check_should_error FALSE)
set(failed_check_should_error TRUE)
if(failed_check_should_error)
# Allow downgrading the error into a warning.
if(QT_FORCE_WARN_APPLE_SDK_AND_XCODE_CHECK)
#
# Our cmake build tests might be executed on older not officially supported Xcode or SDK
# versions in the CI. Downgrade the error in this case as well.
if(QT_FORCE_WARN_APPLE_SDK_AND_XCODE_CHECK OR QT_INTERNAL_IS_CMAKE_BUILD_TEST)
set(message_type WARNING)
set(extra_message " Due to QT_FORCE_WARN_APPLE_SDK_AND_XCODE_CHECK being ON "
"the build will continue, but it will likely fail. Use at your own risk.")
@ -995,6 +1041,8 @@ function(_qt_internal_finalize_ios_app target)
_qt_internal_set_xcode_targeted_device_family("${target}")
_qt_internal_set_xcode_bitcode_enablement("${target}")
_qt_internal_set_ios_simulator_arch("${target}")
_qt_internal_set_xcode_entrypoint_attribute("${target}" "_qt_main_wrapper")
endfunction()
function(_qt_internal_finalize_macos_app target)

View File

@ -597,6 +597,45 @@ function(_qt_internal_remove_args out_var)
set(${out_var} "${result}" PARENT_SCOPE)
endfunction()
function(__qt_internal_handle_find_all_qt_module_packages out_var)
set(opt_args "")
set(single_args "")
set(multi_args
COMPONENTS
)
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
if(NOT arg_COMPONENTS)
return()
endif()
set(components ${arg_COMPONENTS})
if("ALL_QT_MODULES" IN_LIST components)
list(FIND components "ALL_QT_MODULES" all_qt_modules_index)
list(REMOVE_AT components ${all_qt_modules_index})
# Find the path to dir with module.json files. # We consider each file name to be a
# Qt package (component) name that contains a target with the same name.
set(json_modules_path "${QT6_INSTALL_PREFIX}/${QT6_INSTALL_DESCRIPTIONSDIR}")
file(GLOB json_modules "${json_modules_path}/*.json")
set(all_qt_modules "")
foreach(json_module IN LISTS json_modules)
get_filename_component(module_name "${json_module}" NAME_WE)
list(APPEND all_qt_modules ${module_name})
endforeach()
if(all_qt_modules)
list(INSERT components "${all_qt_modules_index}" ${all_qt_modules})
endif()
endif()
set(${out_var} "${components}" PARENT_SCOPE)
endfunction()
# Append ${ARGN} to ${target}'s ${property_name} property, removing duplicates.
function(_qt_internal_append_to_target_property_without_duplicates target property_name)
get_target_property(property "${target}" "${property_name}")
@ -697,3 +736,57 @@ function(_qt_internal_add_transitive_property target type property)
APPEND PROPERTY TRANSITIVE_${type}_PROPERTIES ${property})
endif()
endfunction()
# Compatibility of `cmake_path(RELATIVE_PATH)`
#
# In order to be compatible with `file(RELATIVE_PATH)`, path normalization of the result is
# always performed, with the trailing slash stripped.
#
# Synopsis
#
# _qt_internal_relative_path(<path-var>
# [BASE_DIRECTORY <input>]
# [OUTPUT_VARIABLE <out-var>]
# )
#
# Arguments
#
# `path-var`
# Equivalent to `cmake_path(RELATIVE_PATH <path-var>)`.
#
# `BASE_DIRECTORY`
# Equivalent to `cmake_path(RELATIVE_PATH BASE_DIRECTORY)`.
#
# `OUTPUT_VARIABLE`
# Equivalent to `cmake_path(RELATIVE_PATH OUTPUT_VARIABLE)`.
function(_qt_internal_relative_path path_var)
set(option_args "")
set(single_args
BASE_DIRECTORY
OUTPUT_VARIABLE
)
set(multi_args "")
cmake_parse_arguments(PARSE_ARGV 1 arg "${option_args}" "${single_args}" "${multi_args}")
if(NOT arg_BASE_DIRECTORY)
set(arg_BASE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
endif()
if(NOT arg_OUTPUT_VARIABLE)
set(arg_OUTPUT_VARIABLE ${path_var})
endif()
if(CMAKE_VERSION VERSION_LESS 3.20)
file(RELATIVE_PATH ${arg_OUTPUT_VARIABLE}
"${arg_BASE_DIRECTORY}"
"${${path_var}}")
else()
cmake_path(RELATIVE_PATH ${path_var}
BASE_DIRECTORY "${arg_BASE_DIRECTORY}"
OUTPUT_VARIABLE ${arg_OUTPUT_VARIABLE}
)
cmake_path(NORMAL_PATH ${arg_OUTPUT_VARIABLE})
string(REGEX REPLACE "/$" "" ${arg_OUTPUT_VARIABLE}
"${${arg_OUTPUT_VARIABLE}}")
endif()
set(${arg_OUTPUT_VARIABLE} "${${arg_OUTPUT_VARIABLE}}" PARENT_SCOPE)
endfunction()

View File

@ -55,9 +55,8 @@ function(__qt_internal_force_allow_unsuitable_cmake_version_for_using_qt out_var
# Temporarily allow any version when using Qt in Qt's CI, so we can decouple the provisioning
# of the minimum CMake version from the bump of the minimum CMake version.
# The COIN_UNIQUE_JOB_ID env var is set in Qt's CI for both build and test work items.
# Current state is that this check is enabled.
# TODO: Disable it once provisioning is merged.
set(allow_any_version_in_ci TRUE)
# Current state is that this check is disabled.
set(allow_any_version_in_ci FALSE)
if(allow_any_version_in_ci AND DEFINED ENV{COIN_UNIQUE_JOB_ID})
set(allow_any_version TRUE)

View File

@ -34,6 +34,9 @@ macro(_qt_internal_find_third_party_dependencies target target_dep_list)
find_package(${__qt_${target}_find_package_args})
else()
find_dependency(${__qt_${target}_find_package_args})
if(NOT ${__qt_${target}_pkg}_FOUND)
list(APPEND __qt_${target}_missing_deps "${__qt_${target}_pkg}")
endif()
endif()
_qt_internal_get_package_components_id(
@ -83,15 +86,15 @@ macro(_qt_internal_find_tool_dependencies target target_dep_list)
"${_qt_additional_host_packages_root_paths}")
endif()
unset(__qt_${target}_find_package_args)
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
list(APPEND __qt_${target}_find_package_args QUIET)
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}
@ -129,39 +132,22 @@ macro(_qt_internal_find_qt_dependencies target target_dep_list find_dependency_p
list(GET __qt_${target}_target_dep 1 __qt_${target}_version)
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()
_qt_internal_save_find_package_context_for_debugging(${target})
find_dependency(${__qt_${target}_pkg} ${__qt_${target}_version}
NAMES
${__qt_${target}_pkg_names}
PATHS
${QT_BUILD_CMAKE_PREFIX_PATH}
${${find_dependency_path_list}}
${_qt_additional_packages_prefix_paths}
${__qt_use_no_default_path_for_qt_packages}
)
if(NOT ${__qt_${target}_pkg}_FOUND)
list(APPEND __qt_${target}_missing_deps "${__qt_${target}_pkg}")
endif()
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.
#

View File

@ -49,6 +49,16 @@ function(_qt_internal_query_git_version)
set(git_version "${version_git_head}+${version_git_branch}")
endif()
if(QT_SBOM_FAKE_GIT_VERSION)
set(version_git_head "fakegithead")
set(version_git_hash "fakegithash")
set(version_git_branch "fakegitbranch")
set(version_git_tag "fakegittag")
set(git_version "${version_git_head}+${version_git_branch}")
_qt_internal_set_git_query_variables()
return()
endif()
if(NOT Git_FOUND)
message(STATUS "Git not found, skipping querying git version.")
_qt_internal_set_git_query_variables()

View File

@ -248,10 +248,7 @@ function(__qt_internal_add_static_plugin_init_object_library
CONTENT "${import_content}"
)
# CMake versions earlier than 3.18.0 can't find the generated file for some reason,
# failing at generation phase.
# Explicitly marking the file as GENERATED fixes the issue.
set_source_files_properties("${generated_qt_plugin_file_name}" PROPERTIES GENERATED TRUE)
_qt_internal_set_source_file_generated(SOURCES "${generated_qt_plugin_file_name}")
__qt_internal_get_static_plugin_init_target_name("${plugin_target}" plugin_init_target)
@ -518,6 +515,20 @@ function(__qt_internal_add_interface_plugin_target plugin_module_target plugin_t
APPEND PROPERTY INTERFACE_QT_PLUGIN_TARGETS ${plugin_target_name_wrapped})
endfunction()
# TODO: Figure out how to do this more reliably, instead of parsing the file name to get
# the target name.
function(__qt_internal_get_target_name_from_plugin_config_file_name
config_file_path
package_prefix_regex
out_var)
string(REGEX REPLACE
"^.*/${QT_CMAKE_EXPORT_NAMESPACE}(${package_prefix_regex})Config.cmake$"
"\\1"
target "${config_file_path}")
set(${out_var} "${target}" PARENT_SCOPE)
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
@ -546,11 +557,14 @@ macro(__qt_internal_include_plugin_packages target)
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}")
__qt_internal_get_target_name_from_plugin_config_file_name(
"${__qt_${target}_plugin_config_file}"
"(.*Plugin)"
__qt_${target}_qt_plugin
)
if(TARGET "${QT_CMAKE_EXPORT_NAMESPACE}::${__qt_${target}_qt_plugin}")
list(APPEND __qt_${target}_plugins ${__qt_${target}_qt_plugin})
__qt_internal_add_interface_plugin_target(${__qt_${target}_plugin_module_target}
@ -581,10 +595,34 @@ macro(__qt_internal_include_plugin_packages target)
continue()
endif()
list(APPEND "QT_ALL_PLUGINS_FOUND_BY_FIND_PACKAGE_${__plugin_type}" "${plugin_target}")
set(plugin_target_versioned "${QT_CMAKE_EXPORT_NAMESPACE}::${plugin_target}")
if(NOT "${plugin_target}"
IN_LIST QT_ALL_PLUGINS_FOUND_VIA_FIND_PACKAGE)
# Old compatibility name.
# TODO: Remove once all usages are ported.
list(APPEND QT_ALL_PLUGINS_FOUND_BY_FIND_PACKAGE "${plugin_target}")
# New name consistent with other such variables.
list(APPEND QT_ALL_PLUGINS_FOUND_VIA_FIND_PACKAGE "${plugin_target}")
list(APPEND QT_ALL_PLUGINS_VERSIONED_FOUND_VIA_FIND_PACKAGE
"${plugin_target_versioned}")
endif()
if(NOT "${plugin_target}" IN_LIST QT_ALL_PLUGINS_FOUND_VIA_FIND_PACKAGE_${__plugin_type})
# Old compatibility name.
# TODO: Remove once all usages are ported.
list(APPEND QT_ALL_PLUGINS_FOUND_BY_FIND_PACKAGE_${__plugin_type} "${plugin_target}")
# New name consistent with other such variables.
list(APPEND QT_ALL_PLUGINS_FOUND_VIA_FIND_PACKAGE_${__plugin_type} "${plugin_target}")
list(APPEND
QT_ALL_PLUGINS_VERSIONED_FOUND_VIA_FIND_PACKAGE_${__plugin_type}
"${plugin_target_versioned}")
endif()
# Auto-linkage should be set up only for static plugins.
set(plugin_target_versioned "${QT_CMAKE_EXPORT_NAMESPACE}::${plugin_target}")
get_target_property(type "${plugin_target_versioned}" TYPE)
if(type STREQUAL STATIC_LIBRARY)
__qt_internal_add_static_plugin_linkage(
@ -597,3 +635,87 @@ macro(__qt_internal_include_plugin_packages target)
set_target_properties(
${__qt_${target}_plugin_module_target} PROPERTIES __qt_internal_plugins_added TRUE)
endmacro()
# Include Qt Qml plugin CMake packages that are present under the Qml package directory.
# TODO: Consider moving this to qtdeclarative somehow.
macro(__qt_internal_include_qml_plugin_packages)
# Qml plugin targets might have dependencies on other qml plugin targets, but the Targets.cmake
# files are included in the order that file(GLOB) returns, which means certain targets that are
# referenced might not have been created yet, and ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
# might be set to a message saying those targets don't exist.
#
# Postpone checking of which targets don't exist until all Qml PluginConfig.cmake files have
# been included, by including all the files one more time and checking for errors at each step.
#
# TODO: Find a better way to deal with this, perhaps by using find_package() instead of include
# for the Qml PluginConfig.cmake files.
# Distributions should probably change this default.
if(NOT DEFINED QT_SKIP_AUTO_QML_PLUGIN_INCLUSION)
set(QT_SKIP_AUTO_QML_PLUGIN_INCLUSION OFF)
endif()
set(__qt_qml_plugins_config_file_list "")
set(__qt_qml_plugins_glob_prefixes "${CMAKE_CURRENT_LIST_DIR}")
# Allow passing additional prefixes where we will glob for PluginConfig.cmake files.
if(QT_ADDITIONAL_QML_PLUGIN_GLOB_PREFIXES)
foreach(__qt_qml_plugin_glob_prefix IN LISTS QT_ADDITIONAL_QML_PLUGIN_GLOB_PREFIXES)
if(__qt_qml_plugin_glob_prefix)
list(APPEND __qt_qml_plugins_glob_prefixes "${__qt_qml_plugin_glob_prefix}")
endif()
endforeach()
endif()
list(REMOVE_DUPLICATES __qt_qml_plugins_glob_prefixes)
foreach(__qt_qml_plugin_glob_prefix IN LISTS __qt_qml_plugins_glob_prefixes)
file(GLOB __qt_qml_plugins_glob_config_file_list
"${__qt_qml_plugin_glob_prefix}/QmlPlugins/${INSTALL_CMAKE_NAMESPACE}*Config.cmake")
if(__qt_qml_plugins_glob_config_file_list)
list(APPEND __qt_qml_plugins_config_file_list ${__qt_qml_plugins_glob_config_file_list})
endif()
endforeach()
if (__qt_qml_plugins_config_file_list AND NOT QT_SKIP_AUTO_QML_PLUGIN_INCLUSION)
# First round of inclusions ensure all qml plugin targets are brought into scope.
foreach(__qt_qml_plugin_config_file ${__qt_qml_plugins_config_file_list})
include(${__qt_qml_plugin_config_file})
# Temporarily unset any failure markers and mark the Qml package as found.
unset(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE)
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND TRUE)
endforeach()
# For the second round of inclusions, check and bail out early if there are errors.
foreach(__qt_qml_plugin_config_file ${__qt_qml_plugins_config_file_list})
include(${__qt_qml_plugin_config_file})
__qt_internal_get_target_name_from_plugin_config_file_name(
"${__qt_qml_plugin_config_file}"
"(.*)"
__qt_qml_plugin_target
)
set(__qt_qml_plugin_target_versioned
"${QT_CMAKE_EXPORT_NAMESPACE}::${__qt_qml_plugin_target}")
if(TARGET "${__qt_qml_plugin_target_versioned}"
AND NOT "${__qt_qml_plugin_target}"
IN_LIST QT_ALL_QML_PLUGINS_FOUND_VIA_FIND_PACKAGE)
list(APPEND QT_ALL_QML_PLUGINS_FOUND_VIA_FIND_PACKAGE "${__qt_qml_plugin_target}")
list(APPEND QT_ALL_QML_PLUGINS_VERSIONED_FOUND_VIA_FIND_PACKAGE
"${__qt_qml_plugin_target_versioned}")
endif()
unset(__qt_qml_plugin_target)
unset(__qt_qml_plugin_target_versioned)
if(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE)
string(APPEND ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
"\nThe message was set in ${__qt_qml_plugin_config_file} ")
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
return()
endif()
endforeach()
endif()
endmacro()

View File

@ -0,0 +1,596 @@
# Copyright (C) 2024 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
# Handles attribution information for a target.
#
# If CREATE_SBOM_FOR_EACH_ATTRIBUTION is set, a separate sbom target is created for each parsed
# attribution entry, and the new targets are added as dependencies to the parent target.
#
# If CREATE_SBOM_FOR_EACH_ATTRIBUTION is not set, the information read from the first attribution
# entry is added directly to the parent target, aka the the values are propagated to the outer
# function scope to be read.. The rest of the attribution entries are created as separate targets
# and added as dependencies, as if the option was passed.
#
# Handles multiple attribution files and entries within a file.
# Attribution files can be specified either via directories and direct file paths.
# If ATTRIBUTION_ENTRY_INDEX is set, only that specific attribution entry will be processed
# from the given attribution file.
function(_qt_internal_sbom_handle_qt_attribution_files out_prefix_outer)
if(NOT QT_GENERATE_SBOM)
return()
endif()
if(CMAKE_VERSION LESS_EQUAL "3.19")
message(DEBUG "CMake version is too low, can't parse attribution.json file.")
return()
endif()
set(opt_args "")
set(single_args "")
set(multi_args "")
_qt_internal_get_sbom_specific_options(sbom_opt_args sbom_single_args sbom_multi_args)
list(APPEND opt_args ${sbom_opt_args})
list(APPEND single_args ${sbom_single_args})
list(APPEND multi_args ${sbom_multi_args})
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
set(attribution_files "")
set(attribution_file_count 0)
foreach(attribution_file_path IN LISTS arg_ATTRIBUTION_FILE_PATHS)
get_filename_component(real_path "${attribution_file_path}" REALPATH)
list(APPEND attribution_files "${real_path}")
math(EXPR attribution_file_count "${attribution_file_count} + 1")
endforeach()
foreach(attribution_file_dir_path IN LISTS arg_ATTRIBUTION_FILE_DIR_PATHS)
get_filename_component(real_path
"${attribution_file_dir_path}/qt_attribution.json" REALPATH)
list(APPEND attribution_files "${real_path}")
math(EXPR attribution_file_count "${attribution_file_count} + 1")
endforeach()
# If CREATE_SBOM_FOR_EACH_ATTRIBUTION is set, that means the parent target is likely not a
# 3rd party library, so each attribution entry should create a separate attribution target.
# In which case we don't want to proagate options like CPE to the child attribution targets,
# because the CPE is meant for the parent target.
set(propagate_sbom_options_to_new_attribution_targets TRUE)
if(arg___QT_INTERNAL_HANDLE_QT_ENTITY_ATTRIBUTION_FILES)
_qt_internal_sbom_is_qt_entity_type("${arg_TYPE}" is_qt_entity_type)
if(is_qt_entity_type)
set(arg_CREATE_SBOM_FOR_EACH_ATTRIBUTION TRUE)
endif()
endif()
if(arg_CREATE_SBOM_FOR_EACH_ATTRIBUTION)
set(propagate_sbom_options_to_new_attribution_targets FALSE)
if(NOT arg_ATTRIBUTION_PARENT_TARGET)
message(FATAL_ERROR "ATTRIBUTION_PARENT_TARGET must be set")
endif()
endif()
if(arg_ATTRIBUTION_ENTRY_INDEX AND attribution_file_count GREATER 1)
message(FATAL_ERROR
"ATTRIBUTION_ENTRY_INDEX should only be set if a single attribution "
"file is specified."
)
endif()
set(ids_to_add "")
set(ids_found "")
if(arg_ATTRIBUTION_IDS)
set(ids_to_add ${arg_ATTRIBUTION_IDS})
endif()
set(file_index 0)
set(first_attribution_processed FALSE)
foreach(attribution_file_path IN LISTS attribution_files)
# Collect all processed attribution files to later create a configure-time dependency on
# them so that the SBOM is regenerated (and CMake is re-ran) if they are modified.
set_property(GLOBAL APPEND PROPERTY _qt_internal_project_attribution_files
"${attribution_file_path}")
# Set a unique out_prefix that will not overlap when multiple entries are processed.
set(out_prefix_file "${out_prefix_outer}_${file_index}")
# Get the number of entries in the attribution file.
_qt_internal_sbom_read_qt_attribution(${out_prefix_file}
GET_ATTRIBUTION_ENTRY_COUNT
OUT_VAR_VALUE attribution_entry_count
FILE_PATH "${attribution_file_path}"
)
# If a specific entry was specified, we will only process it from the file.
if(NOT "${arg_ATTRIBUTION_ENTRY_INDEX}" STREQUAL "")
set(entry_index ${arg_ATTRIBUTION_ENTRY_INDEX})
else()
set(entry_index 0)
endif()
# Go through each entry in the attribution file.
while("${entry_index}" LESS "${${out_prefix_file}_attribution_entry_count}")
# If this is the first entry to be processed, or if CREATE_SBOM_FOR_EACH_ATTRIBUTION
# is not set, we read the attribution file entry directly, and propagate the values
# to the parent scope.
if(NOT first_attribution_processed AND NOT arg_CREATE_SBOM_FOR_EACH_ATTRIBUTION)
# Set a prefix without indices, so that the parent scope add_sbom call can
# refer to the values directly with the outer prefix, without any index infix.
set(out_prefix "${out_prefix_outer}")
_qt_internal_sbom_read_qt_attribution(${out_prefix}
GET_DEFAULT_KEYS
ENTRY_INDEX "${entry_index}"
OUT_VAR_ASSIGNED_VARIABLE_NAMES variable_names
FILE_PATH "${attribution_file_path}"
)
# Check if we need to filter for specific ids.
if(ids_to_add AND ${out_prefix}_attribution_id)
if("${${out_prefix}_attribution_id}" IN_LIST ids_to_add)
list(APPEND ids_found "${${out_prefix}_attribution_id}")
else()
# Skip to next entry.
math(EXPR entry_index "${entry_index} + 1")
continue()
endif()
endif()
# Propagate the values to the outer scope.
foreach(variable_name IN LISTS variable_names)
set(${out_prefix}_${variable_name} "${${out_prefix}_${variable_name}}"
PARENT_SCOPE)
endforeach()
get_filename_component(relative_attribution_file_path
"${attribution_file_path}" REALPATH)
set(${out_prefix}_chosen_attribution_file_path "${relative_attribution_file_path}"
PARENT_SCOPE)
set(${out_prefix}_chosen_attribution_entry_index "${entry_index}"
PARENT_SCOPE)
set(first_attribution_processed TRUE)
if(NOT "${arg_ATTRIBUTION_ENTRY_INDEX}" STREQUAL "")
# We had a specific index to process, so break right after processing it.
break()
endif()
else()
# We are processing the second or later entry, or CREATE_SBOM_FOR_EACH_ATTRIBUTION
# was set. Instead of directly reading all the keys from the attribution file,
# we get the Id, and create a new sbom target for the entry.
# That will recursively call this function with a specific attribution file path
# and index, to process the specific entry.
set(out_prefix "${out_prefix_outer}_${file_index}_${entry_index}")
# Get the attribution id.
_qt_internal_sbom_read_qt_attribution(${out_prefix}
GET_KEY
KEY Id
OUT_VAR_VALUE attribution_id
ENTRY_INDEX "${entry_index}"
FILE_PATH "${attribution_file_path}"
)
# Check if we need to filter for specific ids
if(ids_to_add AND ${out_prefix}_attribution_id)
if("${${out_prefix}_attribution_id}" IN_LIST ids_to_add)
list(APPEND ids_found "${${out_prefix}_attribution_id}")
else()
# Skip to next entry.
math(EXPR entry_index "${entry_index} + 1")
continue()
endif()
endif()
# If no Id was retrieved, just add a numeric one, to make the sbom target
# unique.
set(attribution_target "${arg_ATTRIBUTION_PARENT_TARGET}_Attribution_")
if(NOT ${out_prefix}_attribution_id)
string(APPEND attribution_target "${file_index}_${entry_index}")
else()
string(APPEND attribution_target "${${out_prefix}_attribution_id}")
endif()
# Sanitize the target name, to avoid issues with slashes and other unsupported chars
# in target names.
string(REGEX REPLACE "[^a-zA-Z0-9_-]" "_"
attribution_target "${attribution_target}")
set(sbom_args "")
# Always propagate the package supplier, because we assume the supplier for 3rd
# party libs is the same as the current project supplier.
# Also propagate the internal qt entity type values like CPE, supplier, PURL
# handling options, attribution file values, if set.
_qt_internal_forward_function_args(
FORWARD_APPEND
FORWARD_PREFIX arg
FORWARD_OUT_VAR sbom_args
FORWARD_OPTIONS
USE_ATTRIBUTION_FILES
__QT_INTERNAL_HANDLE_QT_ENTITY_TYPE_CPE
__QT_INTERNAL_HANDLE_QT_ENTITY_TYPE_SUPPLIER
__QT_INTERNAL_HANDLE_QT_ENTITY_TYPE_PURL
__QT_INTERNAL_HANDLE_QT_ENTITY_ATTRIBUTION_FILES
FORWARD_SINGLE
SUPPLIER
)
if(propagate_sbom_options_to_new_attribution_targets)
# Filter out the attributtion options, they will be passed mnaually
# depending on which file and index is currently being processed.
_qt_internal_get_sbom_specific_options(
sbom_opt_args sbom_single_args sbom_multi_args)
list(REMOVE_ITEM sbom_opt_args
NO_CURRENT_DIR_ATTRIBUTION
CREATE_SBOM_FOR_EACH_ATTRIBUTION
)
list(REMOVE_ITEM sbom_single_args ATTRIBUTION_ENTRY_INDEX)
list(REMOVE_ITEM sbom_multi_args
ATTRIBUTION_IDS
ATTRIBUTION_FILE_PATHS
ATTRIBUTION_FILE_DIR_PATHS
)
# Also filter out the FRIENDLY_PACKAGE_NAME option, otherwise we'd try to
# file(GENERATE) multiple times with the same file name, but different content.
list(REMOVE_ITEM sbom_single_args FRIENDLY_PACKAGE_NAME)
_qt_internal_forward_function_args(
FORWARD_APPEND
FORWARD_PREFIX arg
FORWARD_OUT_VAR sbom_args
FORWARD_OPTIONS
${sbom_opt_args}
FORWARD_SINGLE
${sbom_single_args}
FORWARD_MULTI
${sbom_multi_args}
)
endif()
# Create another sbom target with the id as a hint for the target name,
# the attribution file passed, and make the new target a dependency of the
# parent one.
if(arg___QT_INTERNAL_HANDLE_QT_ENTITY_ATTRIBUTION_FILES)
set(attribution_entity_type QT_THIRD_PARTY_SOURCES)
else()
set(attribution_entity_type THIRD_PARTY_SOURCES)
endif()
_qt_internal_add_sbom("${attribution_target}"
IMMEDIATE_FINALIZATION
TYPE "${attribution_entity_type}"
ATTRIBUTION_FILE_PATHS "${attribution_file_path}"
ATTRIBUTION_ENTRY_INDEX "${entry_index}"
NO_CURRENT_DIR_ATTRIBUTION
${sbom_args}
)
_qt_internal_extend_sbom_dependencies(${arg_ATTRIBUTION_PARENT_TARGET}
SBOM_DEPENDENCIES ${attribution_target}
)
endif()
math(EXPR entry_index "${entry_index} + 1")
endwhile()
math(EXPR file_index "${file_index} + 1")
endforeach()
# Show an error if an id is unaccounted for, it might be it has moved to a different file, that
# is not referenced.
if(ids_to_add)
set(attribution_ids_diff ${ids_to_add})
list(REMOVE_ITEM attribution_ids_diff ${ids_found})
if(attribution_ids_diff)
set(error_message
"The following required attribution ids were not found in the attribution files")
if(arg_ATTRIBUTION_PARENT_TARGET)
string(APPEND error_message " for target: ${arg_ATTRIBUTION_PARENT_TARGET}")
endif()
string(APPEND error_message " ids: ${attribution_ids_diff}")
message(FATAL_ERROR "${error_message}")
endif()
endif()
endfunction()
# Helper to parse a qt_attribution.json file and do various operations:
# - GET_DEFAULT_KEYS extracts the license id, copyrights, version, etc.
# - GET_KEY extracts a single given json key's value, as specified with KEY and saved into
# OUT_VAR_VALUE
# - GET_ATTRIBUTION_ENTRY_COUNT returns the number of entries in the json file, set in
# OUT_VAR_VALUE
#
# ENTRY_INDEX can be used to specify the array index to select a specific entry in the json file.
#
# Any retrieved value is set in the outer scope.
# The variables are prefixed with ${out_prefix}.
# OUT_VAR_ASSIGNED_VARIABLE_NAMES contains the list of variables set in the parent scope, the
# variables names in this list are not prefixed with ${out_prefix}.
#
# Requires cmake 3.19 for json parsing.
function(_qt_internal_sbom_read_qt_attribution out_prefix)
if(NOT QT_GENERATE_SBOM)
return()
endif()
if(CMAKE_VERSION LESS_EQUAL "3.19")
message(DEBUG "CMake version is too low, can't parse attribution.json file.")
return()
endif()
set(opt_args
GET_DEFAULT_KEYS
GET_KEY
GET_ATTRIBUTION_ENTRY_COUNT
)
set(single_args
FILE_PATH
KEY
ENTRY_INDEX
OUT_VAR_VALUE
OUT_VAR_ASSIGNED_VARIABLE_NAMES
)
set(multi_args "")
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
set(file_path "${arg_FILE_PATH}")
if(NOT file_path)
message(FATAL_ERROR "qt attribution file path not given")
endif()
file(READ "${file_path}" contents)
if(NOT contents)
message(FATAL_ERROR "qt attribution file is empty: ${file_path}")
endif()
if(NOT arg_GET_DEFAULT_KEYS AND NOT arg_GET_KEY AND NOT arg_GET_ATTRIBUTION_ENTRY_COUNT)
message(FATAL_ERROR
"No valid operation specified to _qt_internal_sbom_read_qt_attribution call.")
endif()
if(arg_GET_KEY)
if(NOT arg_KEY)
message(FATAL_ERROR "KEY must be set")
endif()
if(NOT arg_OUT_VAR_VALUE)
message(FATAL_ERROR "OUT_VAR_VALUE must be set")
endif()
endif()
get_filename_component(attribution_file_dir "${file_path}" DIRECTORY)
# Parse the json file.
# The first element might be an array, or an object. We need to detect which one.
# Do that by trying to query index 0 of the potential root array.
# If the index is found, that means the root is an array, and elem_error is set to NOTFOUND,
# because there was no error.
# Otherwise elem_error will be something like 'member '0' not found', and we can assume the
# root is an object.
string(JSON first_elem_type ERROR_VARIABLE elem_error TYPE "${contents}" 0)
if(elem_error STREQUAL "NOTFOUND")
# Root is an array. The attribution file might contain multiple entries.
# Pick the first one if no specific index was specified, otherwise use the given index.
if(NOT "${arg_ENTRY_INDEX}" STREQUAL "")
set(indices "${arg_ENTRY_INDEX}")
else()
set(indices "0")
endif()
set(is_array TRUE)
else()
# Root is an object, not an array, which means the file has a single entry.
set(indices "")
set(is_array FALSE)
endif()
set(variable_names "")
if(arg_GET_KEY)
_qt_internal_sbom_get_attribution_key(${arg_KEY} ${arg_OUT_VAR_VALUE} ${out_prefix})
endif()
if(arg_GET_ATTRIBUTION_ENTRY_COUNT)
if(NOT arg_OUT_VAR_VALUE)
message(FATAL_ERROR "OUT_VAR_VALUE must be set")
endif()
if(is_array)
string(JSON attribution_entry_count ERROR_VARIABLE elem_error LENGTH "${contents}")
# There was an error getting the length of the array, so we assume it's empty.
if(NOT elem_error STREQUAL "NOTFOUND")
set(attribution_entry_count 0)
endif()
else()
set(attribution_entry_count 1)
endif()
set(${out_prefix}_${arg_OUT_VAR_VALUE} "${attribution_entry_count}" PARENT_SCOPE)
endif()
if(arg_GET_DEFAULT_KEYS)
_qt_internal_sbom_get_attribution_key(Id attribution_id "${out_prefix}")
_qt_internal_sbom_get_attribution_key(LicenseId license_id "${out_prefix}")
_qt_internal_sbom_get_attribution_key(License license "${out_prefix}")
_qt_internal_sbom_get_attribution_key(LicenseFile license_file "${out_prefix}")
_qt_internal_sbom_get_attribution_key(Version version "${out_prefix}")
_qt_internal_sbom_get_attribution_key(Homepage homepage "${out_prefix}")
_qt_internal_sbom_get_attribution_key(Name attribution_name "${out_prefix}")
_qt_internal_sbom_get_attribution_key(Description description "${out_prefix}")
_qt_internal_sbom_get_attribution_key(QtUsage qt_usage "${out_prefix}")
_qt_internal_sbom_get_attribution_key(DownloadLocation download_location "${out_prefix}")
_qt_internal_sbom_get_attribution_key(Copyright copyrights "${out_prefix}" IS_MULTI_VALUE)
_qt_internal_sbom_get_attribution_key(CopyrightFile copyright_file "${out_prefix}")
_qt_internal_sbom_get_attribution_key(PURL purls "${out_prefix}" IS_MULTI_VALUE)
_qt_internal_sbom_get_attribution_key(CPE cpes "${out_prefix}" IS_MULTI_VALUE)
# Some attribution files contain a copyright file that contains the actual list of
# copyrights. Read it and use it.
set(copyright_file_path "${attribution_file_dir}/${copyright_file}")
get_filename_component(copyright_file_path "${copyright_file_path}" REALPATH)
if(NOT copyrights AND copyright_file AND EXISTS "${copyright_file_path}")
file(READ "${copyright_file_path}" copyright_contents)
if(copyright_contents)
set(copyright_contents "${copyright_contents}")
set(copyrights "${copyright_contents}")
set(${out_prefix}_copyrights "${copyright_contents}" PARENT_SCOPE)
list(APPEND variable_names "copyrights")
endif()
endif()
endif()
if(arg_OUT_VAR_ASSIGNED_VARIABLE_NAMES)
set(${arg_OUT_VAR_ASSIGNED_VARIABLE_NAMES} "${variable_names}" PARENT_SCOPE)
endif()
endfunction()
# Extracts a string or an array of strings from a json index path, depending on the extracted value
# type.
#
# Given the 'contents' of the whole json document and the EXTRACTED_VALUE of a json key specified
# by the INDICES path, it tries to determine whether the value is an array, in which case the array
# is converted to a cmake list and assigned to ${out_var} in the parent scope.
# Otherwise the function assumes the EXTRACTED_VALUE was not an array, and just assigns the value
# of EXTRACTED_VALUE to ${out_var}
function(_qt_internal_sbom_handle_attribution_json_array contents)
set(opt_args "")
set(single_args
EXTRACTED_VALUE
OUT_VAR
)
set(multi_args
INDICES
)
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
# Write the original value to the parent scope, in case it was not an array.
set(${arg_OUT_VAR} "${arg_EXTRACTED_VALUE}" PARENT_SCOPE)
if(NOT arg_EXTRACTED_VALUE)
return()
endif()
string(JSON element_type TYPE "${contents}" ${arg_INDICES})
if(NOT element_type STREQUAL "ARRAY")
return()
endif()
set(json_array "${arg_EXTRACTED_VALUE}")
string(JSON array_len LENGTH "${json_array}")
set(value_list "")
math(EXPR array_len "${array_len} - 1")
foreach(index RANGE 0 "${array_len}")
string(JSON value GET "${json_array}" ${index})
if(value)
list(APPEND value_list "${value}")
endif()
endforeach()
if(value_list)
set(${arg_OUT_VAR} "${value_list}" PARENT_SCOPE)
endif()
endfunction()
# Escapes various characters in json content, so that the generate cmake code to append the content
# to the spdx document is syntactically valid.
function(_qt_internal_sbom_escape_json_content content out_var)
# Escape backslashes
string(REPLACE "\\" "\\\\" escaped_content "${content}")
# Escape quotes
string(REPLACE "\"" "\\\"" escaped_content "${escaped_content}")
set(${out_var} "${escaped_content}" PARENT_SCOPE)
endfunction()
# This macro reads a json key from a qt_attribution.json file, and assigns the escaped value to
# out_var.
# Also appends the name of the out_var to the parent scope 'variable_names' var.
#
# Expects 'contents' and 'indices' to already be set in the calling scope.
#
# If IS_MULTI_VALUE is set, handles the key as if it contained an array of
# values, by converting the array of json values to a cmake list.
macro(_qt_internal_sbom_get_attribution_key json_key out_var out_prefix)
cmake_parse_arguments(arg "IS_MULTI_VALUE" "" "" ${ARGN})
string(JSON "${out_var}" ERROR_VARIABLE get_error GET "${contents}" ${indices} "${json_key}")
if(NOT "${${out_var}}" STREQUAL "" AND NOT get_error)
set(extracted_value "${${out_var}}")
if(arg_IS_MULTI_VALUE)
_qt_internal_sbom_handle_attribution_json_array("${contents}"
EXTRACTED_VALUE "${extracted_value}"
INDICES ${indices} ${json_key}
OUT_VAR value_list
)
if(value_list)
set(extracted_value "${value_list}")
endif()
endif()
_qt_internal_sbom_escape_json_content("${extracted_value}" escaped_content)
set(${out_prefix}_${out_var} "${escaped_content}" PARENT_SCOPE)
list(APPEND variable_names "${out_var}")
unset(extracted_value)
unset(escaped_content)
unset(value_list)
endif()
endmacro()
# Replaces placeholders in CPE and PURL strings read from qt_attribution.json files.
#
# VALUES - list of CPE or PURL strings
# OUT_VAR - variable to store the replaced values
# VERSION - version to replace in the placeholders
# Known placeholders:
# $<VERSION> - Replaces occurrences of the placeholder with the value passed to the VERSION option.
# $<VERSION_DASHED> - Replaces occurrences of the placeholder with the value passed to the VERSION
# option, but with dots replaced by dashes.
function(_qt_internal_sbom_replace_qa_placeholders)
set(opt_args "")
set(single_args
OUT_VAR
VERSION
)
set(multi_args
VALUES
)
cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
if(NOT arg_OUT_VAR)
message(FATAL_ERROR "OUT_VAR must be set")
endif()
set(result "")
if(arg_VERSION)
string(REPLACE "." "-" dashed_version "${arg_VERSION}")
endif()
foreach(value IN LISTS arg_VALUES)
if(arg_VERSION)
string(REPLACE "$<VERSION>" "${arg_VERSION}" value "${value}")
string(REPLACE "$<VERSION_DASHED>" "${dashed_version}" value "${value}")
endif()
list(APPEND result "${value}")
endforeach()
set(${arg_OUT_VAR} "${result}" PARENT_SCOPE)
endfunction()

View File

@ -0,0 +1,90 @@
# Copyright (C) 2024 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
# Computes a security CPE for a given set of attributes.
#
# When a part is not specified, a wildcard is added.
#
# References:
# https://spdx.github.io/spdx-spec/v2.3/external-repository-identifiers/#f22-cpe23type
# https://nvlpubs.nist.gov/nistpubs/Legacy/IR/nistir7695.pdf
# https://nvd.nist.gov/products/cpe
#
# Each attribute means:
# 1. part
# 2. vendor
# 3. product
# 4. version
# 5. update
# 6. edition
# 7. language
# 8. sw_edition
# 9. target_sw
# 10. target_hw
# 11. other
function(_qt_internal_sbom_compute_security_cpe out_cpe)
set(opt_args "")
set(single_args
PART
VENDOR
PRODUCT
VERSION
UPDATE
EDITION
)
set(multi_args "")
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
set(cpe_template "cpe:2.3:PART:VENDOR:PRODUCT:VERSION:UPDATE:EDITION:*:*:*:*:*")
set(cpe "${cpe_template}")
foreach(attribute_name IN LISTS single_args)
if(arg_${attribute_name})
set(${attribute_name}_value "${arg_${attribute_name}}")
else()
if(attribute_name STREQUAL "PART")
set(${attribute_name}_value "a")
else()
set(${attribute_name}_value "*")
endif()
endif()
string(REPLACE "${attribute_name}" "${${attribute_name}_value}" cpe "${cpe}")
endforeach()
set(${out_cpe} "${cpe}" PARENT_SCOPE)
endfunction()
# Computes the default security CPE for the Qt framework.
function(_qt_internal_sbom_get_cpe_qt out_var)
_qt_internal_sbom_get_root_project_name_lower_case(repo_project_name_lowercase)
_qt_internal_sbom_compute_security_cpe(repo_cpe
VENDOR "qt"
PRODUCT "${repo_project_name_lowercase}"
VERSION "${QT_REPO_MODULE_VERSION}"
)
set(${out_var} "${repo_cpe}" PARENT_SCOPE)
endfunction()
# Computes the default security CPE for a given qt repository.
function(_qt_internal_sbom_get_cpe_qt_repo out_var)
_qt_internal_sbom_compute_security_cpe(qt_cpe
VENDOR "qt"
PRODUCT "qt"
VERSION "${QT_REPO_MODULE_VERSION}"
)
set(${out_var} "${qt_cpe}" PARENT_SCOPE)
endfunction()
# Computes the list of security CPEs for Qt, including both the repo-specific one and generic one.
function(_qt_internal_sbom_compute_security_cpe_for_qt out_cpe_list)
set(cpe_list "")
_qt_internal_sbom_get_cpe_qt(repo_cpe)
list(APPEND cpe_list "${repo_cpe}")
_qt_internal_sbom_get_cpe_qt_repo(qt_cpe)
list(APPEND cpe_list "${qt_cpe}")
set(${out_cpe_list} "${cpe_list}" PARENT_SCOPE)
endfunction()

View File

@ -0,0 +1,265 @@
# Copyright (C) 2024 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
# Walks a target's direct dependencies and assembles a list of relationships between the packages
# of the target dependencies.
# Currently handles various Qt targets and system libraries.
function(_qt_internal_sbom_handle_target_dependencies target)
set(opt_args "")
set(single_args
SPDX_ID
OUT_RELATIONSHIPS
)
set(multi_args
LIBRARIES
PUBLIC_LIBRARIES
)
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
if(NOT arg_SPDX_ID)
message(FATAL_ERROR "SPDX_ID must be set")
endif()
set(package_spdx_id "${arg_SPDX_ID}")
set(libraries "")
if(arg_LIBRARIES)
list(APPEND libraries "${arg_LIBRARIES}")
endif()
get_target_property(extend_libraries "${target}" _qt_extend_target_libraries)
if(extend_libraries)
list(APPEND libraries ${extend_libraries})
endif()
get_target_property(target_type ${target} TYPE)
set(valid_target_types
EXECUTABLE
SHARED_LIBRARY
MODULE_LIBRARY
STATIC_LIBRARY
OBJECT_LIBRARY
)
if(target_type IN_LIST valid_target_types)
get_target_property(link_libraries "${target}" LINK_LIBRARIES)
if(link_libraries)
list(APPEND libraries ${link_libraries})
endif()
endif()
set(public_libraries "")
if(arg_PUBLIC_LIBRARIES)
list(APPEND public_libraries "${arg_PUBLIC_LIBRARIES}")
endif()
get_target_property(extend_public_libraries "${target}" _qt_extend_target_public_libraries)
if(extend_public_libraries)
list(APPEND public_libraries ${extend_public_libraries})
endif()
set(sbom_dependencies "")
if(arg_SBOM_DEPENDENCIES)
list(APPEND sbom_dependencies "${arg_SBOM_DEPENDENCIES}")
endif()
get_target_property(extend_sbom_dependencies "${target}" _qt_extend_target_sbom_dependencies)
if(extend_sbom_dependencies)
list(APPEND sbom_dependencies ${extend_sbom_dependencies})
endif()
list(REMOVE_DUPLICATES libraries)
list(REMOVE_DUPLICATES public_libraries)
list(REMOVE_DUPLICATES sbom_dependencies)
set(all_direct_libraries ${libraries} ${public_libraries} ${sbom_dependencies})
list(REMOVE_DUPLICATES all_direct_libraries)
set(spdx_dependencies "")
set(external_spdx_dependencies "")
# Go through each direct linked lib.
foreach(direct_lib IN LISTS all_direct_libraries)
if(NOT TARGET "${direct_lib}")
continue()
endif()
# Check for Qt-specific system library targets. These are marked via qt_find_package calls.
get_target_property(is_system_library "${direct_lib}" _qt_internal_sbom_is_system_library)
if(is_system_library)
# We need to check if the dependency is a FindWrap dependency that points either to a
# system library or a vendored / bundled library. We need to depend on whichever one
# the FindWrap script points to.
__qt_internal_walk_libs(
"${direct_lib}"
lib_walked_targets
_discarded_out_var
"sbom_targets"
"collect_targets")
# Detect if we are dealing with a vendored / bundled lib.
set(bundled_targets_found FALSE)
if(lib_walked_targets)
foreach(lib_walked_target IN LISTS lib_walked_targets)
get_target_property(is_3rdparty_bundled_lib
"${lib_walked_target}" _qt_module_is_3rdparty_library)
_qt_internal_sbom_get_spdx_id_for_target("${lib_walked_target}" lib_spdx_id)
# Add a dependency on the vendored lib instead of the Wrap target.
if(is_3rdparty_bundled_lib AND lib_spdx_id)
list(APPEND spdx_dependencies "${lib_spdx_id}")
set(bundled_targets_found TRUE)
endif()
endforeach()
if(bundled_targets_found)
# If we handled a bundled target, we can move on to process the next direct_lib.
continue()
endif()
endif()
if(NOT bundled_targets_found)
# If we haven't found a bundled target, then it's a regular system library
# dependency. Make sure to mark the system library as consumed, so that we later
# generate an sbom for it.
# Also fall through to the code that actually adds the dependency on the target.
_qt_internal_append_to_cmake_property_without_duplicates(
_qt_internal_sbom_consumed_system_library_targets
"${direct_lib}"
)
endif()
endif()
# Get the spdx id of the dependency.
_qt_internal_sbom_get_spdx_id_for_target("${direct_lib}" lib_spdx_id)
if(NOT lib_spdx_id)
message(DEBUG "Could not add target dependency on target ${direct_lib} "
"because no spdx id for it could be found.")
continue()
endif()
# Check if the target sbom is defined in an external document.
_qt_internal_sbom_is_external_target_dependency("${direct_lib}"
OUT_VAR is_dependency_in_external_document
)
if(NOT is_dependency_in_external_document)
# If the target is not in the external document, it must be one built as part of the
# current project.
list(APPEND spdx_dependencies "${lib_spdx_id}")
else()
# Refer to the package in the external document. This can be the case
# in a top-level build, where a system library is reused across repos, or for any
# regular dependency that was built as part of a different project.
_qt_internal_sbom_add_external_target_dependency("${direct_lib}"
extra_spdx_dependencies
)
if(extra_spdx_dependencies)
list(APPEND external_spdx_dependencies ${extra_spdx_dependencies})
endif()
endif()
endforeach()
set(relationships "")
# Keep the external dependencies first, so they are neatly ordered.
foreach(dep_spdx_id IN LISTS external_spdx_dependencies spdx_dependencies)
set(relationship
"${package_spdx_id} DEPENDS_ON ${dep_spdx_id}"
)
list(APPEND relationships "${relationship}")
endforeach()
set(${arg_OUT_RELATIONSHIPS} "${relationships}" PARENT_SCOPE)
endfunction()
# Checks whether the current target will have its sbom generated into the current repo sbom
# document, or whether it is present in an external sbom document.
function(_qt_internal_sbom_is_external_target_dependency target)
set(opt_args
SYSTEM_LIBRARY
)
set(single_args
OUT_VAR
)
set(multi_args "")
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
get_target_property(is_imported "${target}" IMPORTED)
get_target_property(is_custom_sbom_target "${target}" _qt_sbom_is_custom_sbom_target)
_qt_internal_sbom_get_root_project_name_lower_case(current_repo_project_name)
get_property(target_repo_project_name TARGET ${target}
PROPERTY _qt_sbom_spdx_repo_project_name_lowercase)
if(NOT "${target_repo_project_name}" STREQUAL ""
AND NOT "${target_repo_project_name}" STREQUAL "${current_repo_project_name}")
set(part_of_other_repo TRUE)
else()
set(part_of_other_repo FALSE)
endif()
set(${arg_OUT_VAR} "${part_of_other_repo}" PARENT_SCOPE)
endfunction()
# Handles generating an external document reference SDPX element for each target package that is
# located in a different spdx document.
function(_qt_internal_sbom_add_external_target_dependency target out_spdx_dependencies)
_qt_internal_sbom_get_spdx_id_for_target("${target}" dep_spdx_id)
if(NOT dep_spdx_id)
message(DEBUG "Could not add external target dependency on ${target} "
"because no spdx id could be found")
set(${out_spdx_dependencies} "" PARENT_SCOPE)
return()
endif()
set(spdx_dependencies "")
# Get the external document path and the repo it belongs to for the given target.
get_property(relative_installed_repo_document_path TARGET ${target}
PROPERTY _qt_sbom_spdx_relative_installed_repo_document_path)
get_property(project_name_lowercase TARGET ${target}
PROPERTY _qt_sbom_spdx_repo_project_name_lowercase)
if(relative_installed_repo_document_path AND project_name_lowercase)
_qt_internal_sbom_get_external_document_ref_spdx_id(
"${project_name_lowercase}" external_document_ref)
get_cmake_property(known_external_document
_qt_known_external_documents_${external_document_ref})
set(dependency "${external_document_ref}:${dep_spdx_id}")
list(APPEND spdx_dependencies "${dependency}")
# Only add a reference to the external document package, if we haven't done so already.
if(NOT known_external_document)
set(install_prefixes "")
get_cmake_property(install_prefix _qt_internal_sbom_install_prefix)
list(APPEND install_prefixes "${install_prefix}")
set(external_document "${relative_installed_repo_document_path}")
_qt_internal_sbom_generate_add_external_reference(
EXTERNAL_DOCUMENT_FILE_PATH "${external_document}"
EXTERNAL_DOCUMENT_INSTALL_PREFIXES ${install_prefixes}
EXTERNAL_DOCUMENT_SPDX_ID "${external_document_ref}"
)
set_property(GLOBAL PROPERTY
_qt_known_external_documents_${external_document_ref} TRUE)
set_property(GLOBAL APPEND PROPERTY
_qt_known_external_documents "${external_document_ref}")
endif()
else()
message(AUTHOR_WARNING
"Missing spdx document path for external target dependency: ${target}")
endif()
set(${out_spdx_dependencies} "${spdx_dependencies}" PARENT_SCOPE)
endfunction()

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,108 @@
# Copyright (C) 2024 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
# Adds a license id and its text to the sbom.
function(_qt_internal_sbom_add_license)
if(NOT QT_GENERATE_SBOM)
return()
endif()
set(opt_args
NO_LICENSE_REF_PREFIX
)
set(single_args
LICENSE_ID
LICENSE_PATH
EXTRACTED_TEXT
)
set(multi_args
)
cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
if(NOT arg_LICENSE_ID)
message(FATAL_ERROR "LICENSE_ID must be set")
endif()
if(NOT arg_TEXT AND NOT arg_LICENSE_PATH)
message(FATAL_ERROR "Either TEXT or LICENSE_PATH must be set")
endif()
# Sanitize the content a bit.
if(arg_TEXT)
set(text "${arg_TEXT}")
string(REPLACE ";" "$<SEMICOLON>" text "${text}")
string(REPLACE "\"" "\\\"" text "${text}")
else()
file(READ "${arg_LICENSE_PATH}" text)
string(REPLACE ";" "$<SEMICOLON>" text "${text}")
string(REPLACE "\"" "\\\"" text "${text}")
endif()
set(license_id "${arg_LICENSE_ID}")
if(NOT arg_NO_LICENSE_REF_PREFIX)
set(license_id "LicenseRef-${license_id}")
endif()
_qt_internal_sbom_generate_add_license(
LICENSE_ID "${license_id}"
EXTRACTED_TEXT "<text>${text}</text>"
)
endfunction()
# Get a qt spdx license expression given the id.
function(_qt_internal_sbom_get_spdx_license_expression id out_var)
set(license "")
# The default for modules / plugins
if(id STREQUAL "QT_DEFAULT" OR id STREQUAL "QT_COMMERCIAL_OR_LGPL3")
set(license "LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only")
# For commercial only entities
elseif(id STREQUAL "QT_COMMERCIAL")
set(license "LicenseRef-Qt-Commercial")
# For GPL3 only modules
elseif(id STREQUAL "QT_COMMERCIAL_OR_GPL3")
set(license "LicenseRef-Qt-Commercial OR GPL-3.0-only")
# For tools and apps
elseif(id STREQUAL "QT_COMMERCIAL_OR_GPL3_WITH_EXCEPTION")
set(license "LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0")
# For things like the qtmain library
elseif(id STREQUAL "QT_COMMERCIAL_OR_BSD3")
set(license "LicenseRef-Qt-Commercial OR BSD-3-Clause")
# For documentation
elseif(id STREQUAL "QT_COMMERCIAL_OR_GFDL1_3")
set(license "LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only")
# For examples and the like
elseif(id STREQUAL "BSD3")
set(license "BSD-3-Clause")
endif()
if(NOT license)
message(FATAL_ERROR "No SPDX license expression found for id: ${id}")
endif()
set(${out_var} "${license}" PARENT_SCOPE)
endfunction()
# Joins two license IDs with the given ${op}, avoiding parenthesis when possible.
function(_qt_internal_sbom_join_two_license_ids_with_op left_id op right_id out_var)
if(NOT left_id)
set(${out_var} "${right_id}" PARENT_SCOPE)
return()
endif()
if(NOT right_id)
set(${out_var} "${left_id}" PARENT_SCOPE)
return()
endif()
set(value "(${left_id}) ${op} (${right_id})")
set(${out_var} "${value}" PARENT_SCOPE)
endfunction()

View File

@ -0,0 +1,861 @@
# Copyright (C) 2024 The Qt Company Ltd.
# Copyright (C) 2023-2024 Jochem Rutgers
# SPDX-License-Identifier: MIT AND BSD-3-Clause
# Handles the look up of Python, Python spdx dependencies and other various post-installation steps
# like NTIA validation, auditing, json generation, etc.
function(_qt_internal_sbom_setup_project_ops_generation)
set(opt_args
GENERATE_JSON
GENERATE_JSON_REQUIRED
GENERATE_SOURCE_SBOM
VERIFY_SBOM
VERIFY_SBOM_REQUIRED
VERIFY_NTIA_COMPLIANT
LINT_SOURCE_SBOM
LINT_SOURCE_SBOM_NO_ERROR
SHOW_TABLE
AUDIT
AUDIT_NO_ERROR
)
set(single_args "")
set(multi_args "")
cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
if(arg_GENERATE_JSON AND NOT QT_INTERNAL_NO_SBOM_PYTHON_OPS)
set(op_args
OP_KEY "GENERATE_JSON"
OUT_VAR_DEPS_FOUND deps_found
)
if(arg_GENERATE_JSON_REQUIRED)
list(APPEND op_args REQUIRED)
endif()
_qt_internal_sbom_find_and_handle_sbom_op_dependencies(${op_args})
if(deps_found)
_qt_internal_sbom_generate_json()
endif()
endif()
if(arg_VERIFY_SBOM AND NOT QT_INTERNAL_NO_SBOM_PYTHON_OPS)
set(op_args
OP_KEY "VERIFY_SBOM"
OUT_VAR_DEPS_FOUND deps_found
)
if(arg_VERIFY_SBOM_REQUIRED)
list(APPEND op_args REQUIRED)
endif()
_qt_internal_sbom_find_and_handle_sbom_op_dependencies(${op_args})
if(deps_found)
_qt_internal_sbom_verify_valid()
endif()
endif()
if(arg_VERIFY_NTIA_COMPLIANT AND NOT QT_INTERNAL_NO_SBOM_PYTHON_OPS)
_qt_internal_sbom_find_and_handle_sbom_op_dependencies(REQUIRED OP_KEY "RUN_NTIA")
_qt_internal_sbom_verify_ntia_compliant()
endif()
if(arg_SHOW_TABLE AND NOT QT_INTERNAL_NO_SBOM_PYTHON_OPS)
_qt_internal_sbom_find_python_dependency_program(NAME sbom2doc REQUIRED)
_qt_internal_sbom_show_table()
endif()
if(arg_AUDIT AND NOT QT_INTERNAL_NO_SBOM_PYTHON_OPS)
set(audit_no_error_option "")
if(arg_AUDIT_NO_ERROR)
set(audit_no_error_option NO_ERROR)
endif()
_qt_internal_sbom_find_python_dependency_program(NAME sbomaudit REQUIRED)
_qt_internal_sbom_audit(${audit_no_error_option})
endif()
if(arg_GENERATE_SOURCE_SBOM AND NOT QT_INTERNAL_NO_SBOM_PYTHON_OPS)
_qt_internal_sbom_find_python_dependency_program(NAME reuse REQUIRED)
_qt_internal_sbom_generate_reuse_source_sbom()
endif()
if(arg_LINT_SOURCE_SBOM AND NOT QT_INTERNAL_NO_SBOM_PYTHON_OPS)
set(lint_no_error_option "")
if(arg_LINT_SOURCE_SBOM_NO_ERROR)
set(lint_no_error_option NO_ERROR)
endif()
_qt_internal_sbom_find_python_dependency_program(NAME reuse REQUIRED)
_qt_internal_sbom_run_reuse_lint(
${lint_no_error_option}
BUILD_TIME_SCRIPT_PATH_OUT_VAR reuse_lint_script
)
endif()
endfunction()
# Helper to find a python interpreter and a specific python dependency, e.g. to be able to generate
# a SPDX JSON SBOM, or run post-installation steps like NTIA verification.
# The exact dependency should be specified as the OP_KEY.
#
# Caches the found python executable in a separate cache var QT_INTERNAL_SBOM_PYTHON_EXECUTABLE, to
# avoid conflicts with any other found python interpreter.
function(_qt_internal_sbom_find_and_handle_sbom_op_dependencies)
set(opt_args
REQUIRED
)
set(single_args
OP_KEY
OUT_VAR_DEPS_FOUND
)
set(multi_args "")
cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
if(NOT arg_OP_KEY)
message(FATAL_ERROR "OP_KEY is required")
endif()
set(supported_ops "GENERATE_JSON" "VERIFY_SBOM" "RUN_NTIA")
if(arg_OP_KEY STREQUAL "GENERATE_JSON" OR arg_OP_KEY STREQUAL "VERIFY_SBOM")
set(import_statement "import spdx_tools.spdx.clitools.pyspdxtools")
elseif(arg_OP_KEY STREQUAL "RUN_NTIA")
set(import_statement "import ntia_conformance_checker.main")
else()
message(FATAL_ERROR "OP_KEY must be one of ${supported_ops}")
endif()
# Return early if we found the dependencies.
if(QT_INTERNAL_SBOM_DEPS_FOUND_FOR_${arg_OP_KEY})
if(arg_OUT_VAR_DEPS_FOUND)
set(${arg_OUT_VAR_DEPS_FOUND} TRUE PARENT_SCOPE)
endif()
return()
endif()
# NTIA-compliance checker requires Python 3.9 or later, so we use it as the minimum for all
# SBOM OPs.
set(required_version "3.9")
set(python_common_args
VERSION "${required_version}"
)
set(everything_found FALSE)
# On macOS FindPython prefers looking in the system framework location, but that usually would
# not have the required dependencies. So we first look in it, and then fallback to any other
# non-framework python found.
if(CMAKE_HOST_APPLE)
set(extra_python_args SEARCH_IN_FRAMEWORKS QUIET)
_qt_internal_sbom_find_python_and_dependency_helper_lambda()
endif()
if(NOT everything_found)
set(extra_python_args QUIET)
_qt_internal_sbom_find_python_and_dependency_helper_lambda()
endif()
# Always save the python interpreter path if it is found, even if the dependencies are not
# found. This improves the error message workflow.
if(python_found AND NOT QT_INTERNAL_SBOM_PYTHON_EXECUTABLE)
set(QT_INTERNAL_SBOM_PYTHON_EXECUTABLE "${python_path}" CACHE INTERNAL
"Python interpeter used for SBOM generation.")
endif()
if(NOT everything_found)
if(arg_REQUIRED)
set(message_type "FATAL_ERROR")
else()
set(message_type "DEBUG")
endif()
if(NOT python_found)
# Look for python one more time, this time without QUIET, to show an error why it
# wasn't found.
if(arg_REQUIRED)
_qt_internal_sbom_find_python_helper(${python_common_args}
OUT_VAR_PYTHON_PATH unused_python
OUT_VAR_PYTHON_FOUND unused_found
)
endif()
message(${message_type} "Python ${required_version} for running SBOM ops not found.")
elseif(NOT dep_found)
message(${message_type} "Python dependency for running SBOM op ${arg_OP_KEY} "
"not found:\n Python: ${python_path} \n Output: \n${dep_find_output}")
endif()
else()
message(DEBUG "Using Python ${python_path} for running SBOM ops.")
set(QT_INTERNAL_SBOM_DEPS_FOUND_FOR_${arg_OP_KEY} "TRUE" CACHE INTERNAL
"All dependencies found to run SBOM OP ${arg_OP_KEY}")
endif()
if(arg_OUT_VAR_DEPS_FOUND)
set(${arg_OUT_VAR_DEPS_FOUND} "${QT_INTERNAL_SBOM_DEPS_FOUND_FOR_${arg_OP_KEY}}"
PARENT_SCOPE)
endif()
endfunction()
# Helper that checks a variable for truthiness, and sets the OUT_VAR_DEPS_FOUND and
# OUT_VAR_REASON_FAILURE_MESSAGE variables based on what was passed in.
function(_qt_internal_sbom_handle_sbom_op_missing_dependency)
set(opt_args "")
set(single_args
VAR_TO_CHECK
OUT_VAR_DEPS_FOUND
OUT_VAR_REASON_FAILURE_MESSAGE
)
set(multi_args
FAILURE_MESSAGE
)
cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
if(NOT arg_VAR_TO_CHECK)
message(FATAL_ERROR "VAR_TO_CHECK is required")
endif()
set(reason "")
set(value "${${arg_VAR_TO_CHECK}}")
if(NOT value)
if(arg_FAILURE_MESSAGE)
list(JOIN arg_FAILURE_MESSAGE " " reason)
endif()
set(deps_found FALSE)
else()
set(deps_found TRUE)
endif()
if(arg_OUT_VAR_DEPS_FOUND)
set(${arg_OUT_VAR_DEPS_FOUND} "${deps_found}" PARENT_SCOPE)
endif()
if(arg_OUT_VAR_REASON_FAILURE_MESSAGE)
set(${arg_OUT_VAR_REASON_FAILURE_MESSAGE} "${reason}" PARENT_SCOPE)
endif()
endfunction()
# Helper to query whether the sbom python interpreter is available, and also the error message if it
# is not available.
function(_qt_internal_sbom_check_python_interpreter_available)
set(opt_args "")
set(single_args
OUT_VAR_DEPS_FOUND
OUT_VAR_REASON_FAILURE_MESSAGE
)
set(multi_args
FAILURE_MESSAGE_PREFIX
)
cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
set(failure_message
"QT_INTERNAL_SBOM_PYTHON_EXECUTABLE is missing a valid path to a python interpreter")
if(arg_FAILURE_MESSAGE_PREFIX)
list(PREPEND failure_message ${arg_FAILURE_MESSAGE_PREFIX})
endif()
_qt_internal_sbom_handle_sbom_op_missing_dependency(
VAR_TO_CHECK QT_INTERNAL_SBOM_PYTHON_EXECUTABLE
FAILURE_MESSAGE ${failure_message}
OUT_VAR_DEPS_FOUND deps_found
OUT_VAR_REASON_FAILURE_MESSAGE reason
)
if(arg_OUT_VAR_DEPS_FOUND)
set(${arg_OUT_VAR_DEPS_FOUND} "${deps_found}" PARENT_SCOPE)
endif()
if(arg_OUT_VAR_REASON_FAILURE_MESSAGE)
set(${arg_OUT_VAR_REASON_FAILURE_MESSAGE} "${reason}" PARENT_SCOPE)
endif()
endfunction()
# Helper to assert that the python interpreter is available.
function(_qt_internal_sbom_assert_python_interpreter_available error_message_prefix)
_qt_internal_sbom_check_python_interpreter_available(
FAILURE_MESSAGE_PREFIX ${error_message_prefix}
OUT_VAR_DEPS_FOUND deps_found
OUT_VAR_REASON_FAILURE_MESSAGE reason
)
if(NOT deps_found)
message(FATAL_ERROR ${reason})
endif()
endfunction()
# Helper to query whether an sbom python dependency is available, and also the error message if it
# is not available.
function(_qt_internal_sbom_check_python_dependency_available)
set(opt_args "")
set(single_args
OUT_VAR_DEPS_FOUND
OUT_VAR_REASON_FAILURE_MESSAGE
VAR_TO_CHECK
)
set(multi_args
FAILURE_MESSAGE_PREFIX
FAILURE_MESSAGE_SUFFIX
)
cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
set(failure_message
"Required Python dependencies not found: ")
if(arg_FAILURE_MESSAGE_PREFIX)
list(PREPEND failure_message ${arg_FAILURE_MESSAGE_PREFIX})
endif()
if(arg_FAILURE_MESSAGE_SUFFIX)
list(APPEND failure_message ${arg_FAILURE_MESSAGE_SUFFIX})
endif()
_qt_internal_sbom_handle_sbom_op_missing_dependency(
VAR_TO_CHECK ${arg_VAR_TO_CHECK}
FAILURE_MESSAGE ${failure_message}
OUT_VAR_DEPS_FOUND deps_found
OUT_VAR_REASON_FAILURE_MESSAGE reason
)
if(arg_OUT_VAR_DEPS_FOUND)
set(${arg_OUT_VAR_DEPS_FOUND} "${deps_found}" PARENT_SCOPE)
endif()
if(arg_OUT_VAR_REASON_FAILURE_MESSAGE)
set(${arg_OUT_VAR_REASON_FAILURE_MESSAGE} "${reason}" PARENT_SCOPE)
endif()
endfunction()
# Helper to assert that an sbom python dependency is available.
function(_qt_internal_sbom_assert_python_dependency_available key dep error_message_prefix)
_qt_internal_sbom_check_python_dependency_available(
VAR_TO_CHECK QT_INTERNAL_SBOM_DEPS_FOUND_FOR_${key}
FAILURE_MESSAGE_PREFIX ${error_message_prefix}
FAILURE_MESSAGE_SUFFIX ${dep}
OUT_VAR_DEPS_FOUND deps_found
OUT_VAR_REASON_FAILURE_MESSAGE reason
)
if(NOT deps_found)
message(FATAL_ERROR ${reason})
endif()
endfunction()
# Helper to query whether the json sbom generation dependency is available, and also the error
# message if it is not available.
function(_qt_internal_sbom_check_generate_json_dependency_available)
set(opt_args "")
set(single_args
OUT_VAR_DEPS_FOUND
OUT_VAR_REASON_FAILURE_MESSAGE
)
set(multi_args "")
cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
_qt_internal_sbom_check_python_dependency_available(
VAR_TO_CHECK QT_INTERNAL_SBOM_DEPS_FOUND_FOR_GENERATE_JSON
FAILURE_MESSAGE_SUFFIX "spdx_tools.spdx.clitools.pyspdxtools"
OUT_VAR_DEPS_FOUND deps_found
OUT_VAR_REASON_FAILURE_MESSAGE reason
)
if(arg_OUT_VAR_DEPS_FOUND)
set(${arg_OUT_VAR_DEPS_FOUND} "${deps_found}" PARENT_SCOPE)
endif()
if(arg_OUT_VAR_REASON_FAILURE_MESSAGE)
set(${arg_OUT_VAR_REASON_FAILURE_MESSAGE} "${reason}" PARENT_SCOPE)
endif()
endfunction()
# Helper to generate a SPDX JSON file from a tag/value format file.
# This also implies some additional validity checks, useful to ensure a proper sbom file.
function(_qt_internal_sbom_generate_json)
set(error_message_prefix "Failed to generate an SBOM json file.")
_qt_internal_sbom_assert_python_interpreter_available("${error_message_prefix}")
_qt_internal_sbom_assert_python_dependency_available(GENERATE_JSON
"spdx_tools.spdx.clitools.pyspdxtools" ${error_message_prefix})
set(content "
message(STATUS \"Generating JSON: \${QT_SBOM_OUTPUT_PATH}.json\")
execute_process(
COMMAND ${QT_INTERNAL_SBOM_PYTHON_EXECUTABLE} -m spdx_tools.spdx.clitools.pyspdxtools
-i \"\${QT_SBOM_OUTPUT_PATH}\" -o \"\${QT_SBOM_OUTPUT_PATH}.json\"
RESULT_VARIABLE res
)
if(NOT res EQUAL 0)
message(FATAL_ERROR \"SBOM conversion to JSON failed: \${res}\")
endif()
")
_qt_internal_get_current_project_sbom_dir(sbom_dir)
set(verify_sbom "${sbom_dir}/convert_to_json.cmake")
file(GENERATE OUTPUT "${verify_sbom}" CONTENT "${content}")
set_property(GLOBAL APPEND PROPERTY _qt_sbom_cmake_verify_include_files "${verify_sbom}")
endfunction()
# Helper to query whether the all required dependencies are available to generate a tag / value
# document from a json one.
function(_qt_internal_sbom_verify_deps_for_generate_tag_value_spdx_document)
set(opt_args "")
set(single_args
OUT_VAR_DEPS_FOUND
OUT_VAR_REASON_FAILURE_MESSAGE
)
set(multi_args "")
cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
# First try to find dependencies, because they might not have been found yet.
_qt_internal_sbom_find_and_handle_sbom_op_dependencies(
OP_KEY "GENERATE_JSON"
)
_qt_internal_sbom_check_python_interpreter_available(
OUT_VAR_DEPS_FOUND python_found
OUT_VAR_REASON_FAILURE_MESSAGE python_error
)
_qt_internal_sbom_check_generate_json_dependency_available(
OUT_VAR_DEPS_FOUND dep_found
OUT_VAR_REASON_FAILURE_MESSAGE dep_error
)
set(reasons "")
if(python_error)
string(APPEND reasons "${python_error}\n")
endif()
if(dep_error)
string(APPEND reasons "${dep_error}\n")
endif()
if(python_found AND dep_found)
set(deps_found "TRUE")
else()
set(deps_found "FALSE")
endif()
set(${arg_OUT_VAR_DEPS_FOUND} "${deps_found}" PARENT_SCOPE)
set(${arg_OUT_VAR_REASON_FAILURE_MESSAGE} "${reasons}" PARENT_SCOPE)
endfunction()
# Helper to generate a tag/value SPDX file from a SPDX JSON format file.
#
# Will be used by WebEngine to convert the Chromium JSON file to a tag/value SPDX file.
#
# This conversion needs to happen before the document is referenced in the SBOM generation process,
# so that the file already exists when it is parsed for its unique id and namespace.
# It also needs to happen before verification codes are computed for the current document
# that will depend on the target one, to ensure the the file exists and its checksum can be
# computed.
#
# OPERATION_ID - a unique id for the operation, used to generate a unique cmake file name for
# the SBOM generation process.
#
# INPUT_JSON_PATH - the absolute path to the input JSON file.
#
# OUTPUT_FILE_PATH - the absolute path where to create the output tag/value SPDX file.
# Note that if the output file path is set, it is up to the caller to also copy / install the file
# into the build and install directories where the build system expects to find all external
# document references.
#
# OUTPUT_FILE_NAME - when OUTPUT_FILE_PATH is not specified, the output directory is automatically
# set to the SBOM output directory. In this case OUTPUT_FILE_NAME can be used to override the
# outout file name. If not specified, it will be derived from the input file name.
#
# OUT_VAR_OUTPUT_FILE_NAME - output variable where to store the output file.
#
# OUT_VAR_OUTPUT_ABSOLUTE_FILE_PATH - output variable where to store the output file path.
# Note that the path will contain an unresolved '${QT_SBOM_OUTPUT_DIR}' which only has a value at
# install time. So the path can't be used sensibly during configure time.
#
# OPTIONAL - whether the operation should return early, if the required python dependencies are
# not found. OUT_VAR_DEPS_FOUND is still set in that case.
#
# OUT_VAR_DEPS_FOUND - output variable where to store whether the python dependencies for the
# operation were found, and thus the conversion will be attempted.
function(_qt_internal_sbom_generate_tag_value_spdx_document)
if(NOT QT_GENERATE_SBOM)
return()
endif()
set(opt_args
OPTIONAL
)
set(single_args
OPERATION_ID
INPUT_JSON_FILE_PATH
OUTPUT_FILE_PATH
OUTPUT_FILE_NAME
OUT_VAR_OUTPUT_FILE_NAME
OUT_VAR_OUTPUT_ABSOLUTE_FILE_PATH
OUT_VAR_DEPS_FOUND
)
set(multi_args "")
cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
# First try to find dependencies, because they might not have been found yet.
_qt_internal_sbom_find_and_handle_sbom_op_dependencies(
OP_KEY "GENERATE_JSON"
OUT_VAR_DEPS_FOUND deps_found
)
if(arg_OPTIONAL)
set(deps_are_required FALSE)
else()
set(deps_are_required TRUE)
endif()
# If the operation has to succeed, then the deps are required. Assert they are available.
if(deps_are_required)
set(error_message_prefix "Failed to generate a tag/value SBOM file from a json SBOM file.")
_qt_internal_sbom_assert_python_interpreter_available("${error_message_prefix}")
_qt_internal_sbom_assert_python_dependency_available(GENERATE_JSON
"spdx_tools.spdx.clitools.pyspdxtools" ${error_message_prefix})
# If the operation is optional, don't error out if the deps are not found, but silently return
# and mention that the deps are not found.
elseif(NOT deps_found)
set(${arg_OUT_VAR_DEPS_FOUND} "${deps_found}" PARENT_SCOPE)
return()
endif()
set(${arg_OUT_VAR_DEPS_FOUND} "${deps_found}" PARENT_SCOPE)
if(NOT arg_OPERATION_ID)
message(FATAL_ERROR "OPERATION_ID is required")
endif()
if(NOT arg_INPUT_JSON_FILE_PATH)
message(FATAL_ERROR "INPUT_JSON_FILE_PATH is required")
endif()
if(arg_OUTPUT_FILE_PATH)
set(output_path "${arg_OUTPUT_FILE_PATH}")
else()
if(arg_OUTPUT_FILE_NAME)
set(output_name "${arg_OUTPUT_FILE_NAME}")
else()
# Use the input file name without the last extension (without .json) as the output name.
get_filename_component(output_name "${arg_INPUT_JSON_FILE_PATH}" NAME_WLE)
endif()
set(output_path "\${QT_SBOM_OUTPUT_DIR}/${output_name}")
endif()
if(arg_OUT_VAR_OUTPUT_FILE_NAME)
get_filename_component(output_name_resolved "${output_path}" NAME)
set(${arg_OUT_VAR_OUTPUT_FILE_NAME} "${output_name_resolved}" PARENT_SCOPE)
endif()
if(arg_OUT_VAR_OUTPUT_ABSOLUTE_FILE_PATH)
set(${arg_OUT_VAR_OUTPUT_ABSOLUTE_FILE_PATH} "${output_path}" PARENT_SCOPE)
endif()
set(content "
message(STATUS
\"Generating tag/value SPDX document: ${output_path} from \"
\"${arg_INPUT_JSON_FILE_PATH}\")
execute_process(
COMMAND ${QT_INTERNAL_SBOM_PYTHON_EXECUTABLE} -m spdx_tools.spdx.clitools.pyspdxtools
-i \"${arg_INPUT_JSON_FILE_PATH}\" -o \"${output_path}\"
RESULT_VARIABLE res
)
if(NOT res EQUAL 0)
message(FATAL_ERROR \"SBOM conversion to tag/value failed: \${res}\")
endif()
")
_qt_internal_get_current_project_sbom_dir(sbom_dir)
set(convert_sbom "${sbom_dir}/convert_to_tag_value_${arg_OPERATION_ID}.cmake")
file(GENERATE OUTPUT "${convert_sbom}" CONTENT "${content}")
set_property(GLOBAL APPEND PROPERTY _qt_sbom_cmake_include_files
"${convert_sbom}")
endfunction()
# Helper to verify the generated sbom is valid.
function(_qt_internal_sbom_verify_valid)
set(error_message_prefix "Failed to verify SBOM file syntax.")
_qt_internal_sbom_assert_python_interpreter_available("${error_message_prefix}")
_qt_internal_sbom_assert_python_dependency_available(VERIFY_SBOM
"spdx_tools.spdx.clitools.pyspdxtools" ${error_message_prefix})
set(content "
message(STATUS \"Verifying: \${QT_SBOM_OUTPUT_PATH}\")
execute_process(
COMMAND ${QT_INTERNAL_SBOM_PYTHON_EXECUTABLE} -m spdx_tools.spdx.clitools.pyspdxtools
-i \"\${QT_SBOM_OUTPUT_PATH}\"
RESULT_VARIABLE res
)
if(NOT res EQUAL 0)
message(FATAL_ERROR \"SBOM verification failed: \${res}\")
endif()
")
_qt_internal_get_current_project_sbom_dir(sbom_dir)
set(verify_sbom "${sbom_dir}/verify_valid.cmake")
file(GENERATE OUTPUT "${verify_sbom}" CONTENT "${content}")
set_property(GLOBAL APPEND PROPERTY _qt_sbom_cmake_verify_include_files "${verify_sbom}")
endfunction()
# Helper to verify the generated sbom is NTIA compliant.
function(_qt_internal_sbom_verify_ntia_compliant)
set(error_message_prefix "Failed to run NTIA checker on SBOM file.")
_qt_internal_sbom_assert_python_interpreter_available("${error_message_prefix}")
_qt_internal_sbom_assert_python_dependency_available(RUN_NTIA
"ntia_conformance_checker.main" ${error_message_prefix})
set(content "
message(STATUS \"Checking for NTIA compliance: \${QT_SBOM_OUTPUT_PATH}\")
execute_process(
COMMAND ${QT_INTERNAL_SBOM_PYTHON_EXECUTABLE} -m ntia_conformance_checker.main
--file \"\${QT_SBOM_OUTPUT_PATH}\"
RESULT_VARIABLE res
)
if(NOT res EQUAL 0)
message(FATAL_ERROR \"SBOM NTIA verification failed: \{res}\")
endif()
")
_qt_internal_get_current_project_sbom_dir(sbom_dir)
set(verify_sbom "${sbom_dir}/verify_ntia.cmake")
file(GENERATE OUTPUT "${verify_sbom}" CONTENT "${content}")
set_property(GLOBAL APPEND PROPERTY _qt_sbom_cmake_verify_include_files "${verify_sbom}")
endfunction()
# Helper to show the main sbom document info in the form of a CLI table.
function(_qt_internal_sbom_show_table)
set(extra_code_begin "")
if(DEFINED ENV{COIN_UNIQUE_JOB_ID})
# The output of the process dynamically adjusts the width of the shown table based on the
# console width. In the CI, the width is very short for some reason, and thus the output
# is truncated in the CI log. Explicitly set a bigger width to avoid this.
set(extra_code_begin "
set(backup_env_columns \$ENV{COLUMNS})
set(ENV{COLUMNS} 150)
")
set(extra_code_end "
set(ENV{COLUMNS} \${backup_env_columns})
")
endif()
set(content "
message(STATUS \"Showing main SBOM document info: \${QT_SBOM_OUTPUT_PATH}\")
${extra_code_begin}
execute_process(
COMMAND ${QT_SBOM_PROGRAM_SBOM2DOC} -i \"\${QT_SBOM_OUTPUT_PATH}\"
RESULT_VARIABLE res
)
${extra_code_end}
if(NOT res EQUAL 0)
message(FATAL_ERROR \"Showing SBOM document failed: \${res}\")
endif()
")
_qt_internal_get_current_project_sbom_dir(sbom_dir)
set(verify_sbom "${sbom_dir}/show_table.cmake")
file(GENERATE OUTPUT "${verify_sbom}" CONTENT "${content}")
set_property(GLOBAL APPEND PROPERTY _qt_sbom_cmake_verify_include_files "${verify_sbom}")
endfunction()
# Helper to audit the generated sbom.
function(_qt_internal_sbom_audit)
set(opt_args NO_ERROR)
set(single_args "")
set(multi_args "")
cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
set(handle_error "")
if(NOT arg_NO_ERROR)
set(handle_error "
if(NOT res EQUAL 0)
message(FATAL_ERROR \"SBOM Audit failed: \${res}\")
endif()
")
endif()
set(content "
message(STATUS \"Auditing SBOM: \${QT_SBOM_OUTPUT_PATH}\")
execute_process(
COMMAND ${QT_SBOM_PROGRAM_SBOMAUDIT} -i \"\${QT_SBOM_OUTPUT_PATH}\"
--disable-license-check --cpecheck --offline
RESULT_VARIABLE res
)
${handle_error}
")
_qt_internal_get_current_project_sbom_dir(sbom_dir)
set(verify_sbom "${sbom_dir}/audit.cmake")
file(GENERATE OUTPUT "${verify_sbom}" CONTENT "${content}")
set_property(GLOBAL APPEND PROPERTY _qt_sbom_cmake_verify_include_files "${verify_sbom}")
endfunction()
# Returns path to project's potential root source reuse.toml file.
function(_qt_internal_sbom_get_project_reuse_toml_path out_var)
set(reuse_toml_path "${PROJECT_SOURCE_DIR}/REUSE.toml")
set(${out_var} "${reuse_toml_path}" PARENT_SCOPE)
endfunction()
# Helper to generate and install a source SBOM using reuse.
function(_qt_internal_sbom_generate_reuse_source_sbom)
set(opt_args NO_ERROR)
set(single_args "")
set(multi_args "")
cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
_qt_internal_get_current_project_sbom_dir(sbom_dir)
set(file_op "${sbom_dir}/generate_reuse_source_sbom.cmake")
_qt_internal_sbom_get_project_reuse_toml_path(reuse_toml_path)
if(NOT EXISTS "${reuse_toml_path}" AND NOT QT_FORCE_SOURCE_SBOM_GENERATION)
set(skip_message
"Skipping source SBOM generation: No reuse.toml file found at '${reuse_toml_path}'.")
message(STATUS "${skip_message}")
set(content "
message(STATUS \"${skip_message}\")
")
file(GENERATE OUTPUT "${file_op}" CONTENT "${content}")
set_property(GLOBAL APPEND PROPERTY _qt_sbom_cmake_post_generation_include_files
"${file_op}")
return()
endif()
set(handle_error "")
if(NOT arg_NO_ERROR)
set(handle_error "
if(NOT res EQUAL 0)
message(FATAL_ERROR \"Source SBOM generation using reuse tool failed: \${res}\")
endif()
")
endif()
set(source_sbom_path "\${QT_SBOM_OUTPUT_PATH_WITHOUT_EXT}.source.spdx")
file(TO_CMAKE_PATH "$ENV{QT_QA_LICENSE_TEST_DIR}/$ENV{QT_SOURCE_SBOM_TEST_SCRIPT}"
full_path_to_license_test)
set(verify_source_sbom "
if(res EQUAL 0)
message(STATUS \"Verifying source SBOM ${source_sbom_path} using qtqa tst_licenses.pl ${full_path_to_license_test}\")
if(NOT EXISTS \"${full_path_to_license_test}\")
message(FATAL_ERROR \"Source SBOM check has failed: The tst_licenses.pl script could not be found at ${full_path_to_license_test}\")
endif()
execute_process(
COMMAND perl \"\$ENV{QT_SOURCE_SBOM_TEST_SCRIPT}\" -sbomonly -sbom \"${source_sbom_path}\"
WORKING_DIRECTORY \"\$ENV{QT_QA_LICENSE_TEST_DIR}\"
RESULT_VARIABLE res
COMMAND_ECHO STDOUT
)
if(NOT res EQUAL 0)
message(FATAL_ERROR \"Source SBOM check has failed: \${res}\")
endif()
endif()
")
set(extra_reuse_args "")
get_property(project_supplier GLOBAL PROPERTY _qt_sbom_project_supplier)
if(project_supplier)
get_property(project_supplier_url GLOBAL PROPERTY _qt_sbom_project_supplier_url)
# Add the supplier url if available. Add it in parenthesis to stop reuse from adding its
# own empty parenthesis.
if(project_supplier_url)
set(project_supplier "${project_supplier} (${project_supplier_url})")
endif()
# Unfortunately there's no way to silence the addition of the 'Creator: Person' field,
# even though 'Creator: Organization' is supplied.
list(APPEND extra_reuse_args --creator-organization "${project_supplier}")
endif()
set(content "
message(STATUS \"Generating source SBOM using reuse tool: ${source_sbom_path}\")
set(extra_reuse_args \"${extra_reuse_args}\")
execute_process(
COMMAND
${QT_SBOM_PROGRAM_REUSE}
--root \"${PROJECT_SOURCE_DIR}\"
spdx
-o ${source_sbom_path}
\${extra_reuse_args}
RESULT_VARIABLE res
)
${handle_error}
if(\"\$ENV{VERIFY_SOURCE_SBOM}\")
${verify_source_sbom}
endif()
")
file(GENERATE OUTPUT "${file_op}" CONTENT "${content}")
set_property(GLOBAL APPEND PROPERTY _qt_sbom_cmake_post_generation_include_files "${file_op}")
endfunction()
# Helper to run 'reuse lint' on the project source dir.
function(_qt_internal_sbom_run_reuse_lint)
set(opt_args
NO_ERROR
)
set(single_args
BUILD_TIME_SCRIPT_PATH_OUT_VAR
)
set(multi_args "")
cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
# If no reuse.toml file exists, it means the repo is likely not reuse compliant yet,
# so we shouldn't error out during installation when running the lint.
_qt_internal_sbom_get_project_reuse_toml_path(reuse_toml_path)
if(NOT EXISTS "${reuse_toml_path}" AND NOT QT_FORCE_REUSE_LINT_ERROR)
set(arg_NO_ERROR TRUE)
endif()
set(handle_error "")
if(NOT arg_NO_ERROR)
set(handle_error "
if(NOT res EQUAL 0)
message(FATAL_ERROR \"Running 'reuse lint' failed: \${res}\")
endif()
")
endif()
set(content "
message(STATUS \"Running 'reuse lint' in '${PROJECT_SOURCE_DIR}'.\")
execute_process(
COMMAND ${QT_SBOM_PROGRAM_REUSE} --root \"${PROJECT_SOURCE_DIR}\" lint
RESULT_VARIABLE res
)
${handle_error}
")
_qt_internal_get_current_project_sbom_dir(sbom_dir)
set(file_op_build "${sbom_dir}/run_reuse_lint_build.cmake")
file(GENERATE OUTPUT "${file_op_build}" CONTENT "${content}")
# Allow skipping running 'reuse lint' during installation. But still allow running it during
# build time. This is a fail safe opt-out in case some repo needs it.
if(QT_FORCE_SKIP_REUSE_LINT_ON_INSTALL)
set(skip_message "Skipping running 'reuse lint' in '${PROJECT_SOURCE_DIR}'.")
set(content "
message(STATUS \"${skip_message}\")
")
set(file_op_install "${sbom_dir}/run_reuse_lint_install.cmake")
file(GENERATE OUTPUT "${file_op_install}" CONTENT "${content}")
else()
# Just reuse the already generated script for installation as well.
set(file_op_install "${file_op_build}")
endif()
set_property(GLOBAL APPEND PROPERTY _qt_sbom_cmake_verify_include_files "${file_op_install}")
if(arg_BUILD_TIME_SCRIPT_PATH_OUT_VAR)
set(${arg_BUILD_TIME_SCRIPT_PATH_OUT_VAR} "${file_op_build}" PARENT_SCOPE)
endif()
endfunction()

View File

@ -0,0 +1,305 @@
# Copyright (C) 2024 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
# Parse purl arguments for a specific purl entry.
# arguments_var_name is the variable name that contains the args.
# prefix is the prefix passed to cmake_parse_arguments.
macro(_qt_internal_sbom_parse_purl_entry_options prefix arguments_var_name)
_qt_internal_get_sbom_purl_parsing_options(purl_opt_args purl_single_args purl_multi_args)
cmake_parse_arguments(${prefix} "${purl_opt_args}" "${purl_single_args}" "${purl_multi_args}"
${${arguments_var_name}})
_qt_internal_validate_all_args_are_parsed(${prefix})
endmacro()
# Helper macro to prepare forwarding all set purl options to some other function.
# Expects the options names to be set in the parent scope by calling
# _qt_internal_get_sbom_add_target_options(opt_args single_args multi_args)
macro(_qt_internal_sbom_forward_purl_handling_options args_var_name)
if(NOT opt_args)
message(FATAL_ERROR
"Expected opt_args to be set by _qt_internal_get_sbom_purl_handling_options")
endif()
if(NOT single_args)
message(FATAL_ERROR
"Expected single_args to be set by _qt_internal_get_sbom_purl_handling_options")
endif()
if(NOT multi_args)
message(FATAL_ERROR
"Expected multi_args to be set by _qt_internal_get_sbom_purl_handling_options")
endif()
_qt_internal_forward_function_args(
FORWARD_PREFIX arg
FORWARD_OUT_VAR ${args_var_name}
FORWARD_OPTIONS
${opt_args}
FORWARD_SINGLE
${single_args}
FORWARD_MULTI
${multi_args}
)
endmacro()
# Handles purl arguments specified to functions like qt_internal_add_sbom.
#
# Synopsis
#
# qt_internal_add_sbom(<target>
# PURLS
# [[PURL_ENTRY
# PURL_ID <id>
# PURL_TYPE <type>
# PURL_NAMESPACE <namespace>
# PURL_NAME <name>
# PURL_VERSION <version>]...]
# PURL_VALUES
# [purl-string...]
# )
#
# Example
#
# qt_internal_add_sbom(<target>
# PURLS
# PURL_ENTRY
# PURL_ID "UPSTREAM"
# PURL_TYPE "github"
# PURL_NAMESPACE "harfbuzz"
# PURL_NAME "harfbuzz"
# PURL_VERSION "v8.5.0"
# PURL_ENTRY
# PURL_ID "MIRROR"
# PURL_TYPE "git"
# PURL_NAMESPACE "harfbuzz"
# PURL_NAME "harfbuzz"
# PURL_QUALIFIERS "vcs_url=https://code.qt.io/qt/qtbase"
# ....
# PURL_VALUES
# pkg:git/harfbuzz/harfbuzz@v8.5.0
# pkg:github/harfbuzz/harfbuzz@v8.5.0
# ....
#
#
# PURLS accepts multiple purl entries, each starting with the PURL_ENTRY keyword.
# PURL_VALUES takes a list of pre-built purl strings.
#
# If no arguments are specified, for qt entity types (e.g. libraries built as part of Qt repos),
# default purls will be generated.
#
# There is no limit to the number of purls that can be added to a target.
function(_qt_internal_sbom_handle_purl_values target)
_qt_internal_get_sbom_purl_handling_options(opt_args single_args multi_args)
list(APPEND single_args OUT_VAR)
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
if(NOT arg_OUT_VAR)
message(FATAL_ERROR "OUT_VAR must be set")
endif()
_qt_internal_get_sbom_purl_parsing_options(purl_opt_args purl_single_args purl_multi_args)
set(project_package_options "")
# Collect each PURL_ENTRY args into a separate variable.
set(purl_idx -1)
set(purl_entry_indices "")
foreach(purl_arg IN LISTS arg_PURLS)
if(purl_arg STREQUAL "PURL_ENTRY")
math(EXPR purl_idx "${purl_idx}+1")
list(APPEND purl_entry_indices "${purl_idx}")
elseif(purl_idx GREATER_EQUAL 0)
list(APPEND purl_${purl_idx}_args "${purl_arg}")
else()
message(FATAL_ERROR "Missing PURL_ENTRY keyword.")
endif()
endforeach()
# Validate the args for each collected entry.
foreach(purl_idx IN LISTS purl_entry_indices)
list(LENGTH purl_${purl_idx}_args num_args)
if(num_args LESS 1)
message(FATAL_ERROR "Empty PURL_ENTRY encountered.")
endif()
_qt_internal_sbom_parse_purl_entry_options(arg purl_${purl_idx}_args)
endforeach()
# Append qt specific placeholder entries when handling Qt entities.
if(arg___QT_INTERNAL_HANDLE_QT_ENTITY_TYPE_PURL)
_qt_internal_sbom_forward_purl_handling_options(purl_handling_args)
_qt_internal_sbom_handle_qt_entity_purl_entries(${purl_handling_args}
OUT_VAR_IDS qt_purl_ids
)
if(qt_purl_ids)
# Create purl placeholder indices for each qt purl id.
foreach(qt_purl_id IN LISTS qt_purl_ids)
math(EXPR purl_idx "${purl_idx}+1")
list(APPEND purl_entry_indices "${purl_idx}")
list(APPEND purl_${purl_idx}_args PURL_ID "${qt_purl_id}")
endforeach()
endif()
endif()
foreach(purl_idx IN LISTS purl_entry_indices)
# Clear previous values.
foreach(option_name IN LISTS purl_opt_args purl_single_args purl_multi_args)
unset(arg_${option_name})
endforeach()
_qt_internal_sbom_parse_purl_entry_options(arg purl_${purl_idx}_args)
set(purl_args "")
# Override the purl version with the package version.
if(arg_PURL_USE_PACKAGE_VERSION AND arg_PACKAGE_VERSION)
set(arg_PURL_VERSION "${arg_PACKAGE_VERSION}")
endif()
# Append a vcs_url to the qualifiers if specified.
if(arg_PURL_VCS_URL)
list(APPEND arg_PURL_QUALIFIERS "vcs_url=${arg_PURL_VCS_URL}")
endif()
_qt_internal_forward_function_args(
FORWARD_APPEND
FORWARD_PREFIX arg
FORWARD_OUT_VAR purl_args
FORWARD_OPTIONS
${purl_opt_args}
FORWARD_SINGLE
${purl_single_args}
FORWARD_MULTI
${purl_multi_args}
)
# Qt entity types get special treatment to gather the required args.
if(arg___QT_INTERNAL_HANDLE_QT_ENTITY_TYPE_PURL
AND arg_PURL_ID
AND arg_PURL_ID IN_LIST qt_purl_ids)
_qt_internal_sbom_handle_qt_entity_purl("${target}"
${purl_handling_args}
PURL_ID "${arg_PURL_ID}"
OUT_PURL_ARGS qt_purl_args
)
if(qt_purl_args)
list(APPEND purl_args "${qt_purl_args}")
endif()
endif()
_qt_internal_sbom_assemble_purl(${target}
${purl_args}
OUT_VAR package_manager_external_ref
)
list(APPEND project_package_options ${package_manager_external_ref})
endforeach()
foreach(purl_value IN LISTS arg_PURL_VALUES)
_qt_internal_sbom_get_purl_value_extref(
VALUE "${purl_value}" OUT_VAR package_manager_external_ref)
# The order in which the purls are generated, matters for tools that consume the SBOM.
# Some tools can only handle one PURL per package, so the first one should be the
# important one.
# For now, I deem that the directly specified ones (probably via a qt_attribution.json
# file) are the more important ones. So we prepend them.
list(PREPEND project_package_options ${package_manager_external_ref})
endforeach()
set(${arg_OUT_VAR} "${project_package_options}" PARENT_SCOPE)
endfunction()
# Assembles an external reference purl identifier.
# PURL_TYPE and PURL_NAME are required.
# Stores the result in the OUT_VAR.
# Accepted options:
# PURL_TYPE
# PURL_NAME
# PURL_NAMESPACE
# PURL_VERSION
# PURL_SUBPATH
# PURL_QUALIFIERS
function(_qt_internal_sbom_assemble_purl target)
set(opt_args "")
set(single_args
OUT_VAR
)
set(multi_args "")
_qt_internal_get_sbom_purl_parsing_options(purl_opt_args purl_single_args purl_multi_args)
list(APPEND opt_args ${purl_opt_args})
list(APPEND single_args ${purl_single_args})
list(APPEND multi_args ${purl_multi_args})
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
set(purl_scheme "pkg")
if(NOT arg_PURL_TYPE)
message(FATAL_ERROR "PURL_TYPE must be set")
endif()
if(NOT arg_PURL_NAME)
message(FATAL_ERROR "PURL_NAME must be set")
endif()
if(NOT arg_OUT_VAR)
message(FATAL_ERROR "OUT_VAR must be set")
endif()
# https://github.com/package-url/purl-spec
# Spec is 'scheme:type/namespace/name@version?qualifiers#subpath'
set(purl "${purl_scheme}:${arg_PURL_TYPE}")
if(arg_PURL_NAMESPACE)
string(APPEND purl "/${arg_PURL_NAMESPACE}")
endif()
string(APPEND purl "/${arg_PURL_NAME}")
if(arg_PURL_VERSION)
string(APPEND purl "@${arg_PURL_VERSION}")
endif()
if(arg_PURL_QUALIFIERS)
# TODO: Note that the qualifiers are expected to be URL encoded, which this implementation
# is not doing at the moment.
list(JOIN arg_PURL_QUALIFIERS "&" qualifiers)
string(APPEND purl "?${qualifiers}")
endif()
if(arg_PURL_SUBPATH)
string(APPEND purl "#${arg_PURL_SUBPATH}")
endif()
_qt_internal_sbom_get_purl_value_extref(VALUE "${purl}" OUT_VAR result)
set(${arg_OUT_VAR} "${result}" PARENT_SCOPE)
endfunction()
# Takes a PURL VALUE and returns an SBOM purl external reference in OUT_VAR.
function(_qt_internal_sbom_get_purl_value_extref)
set(opt_args "")
set(single_args
OUT_VAR
VALUE
)
set(multi_args "")
cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
if(NOT arg_OUT_VAR)
message(FATAL_ERROR "OUT_VAR must be set")
endif()
if(NOT arg_VALUE)
message(FATAL_ERROR "VALUE must be set")
endif()
# SPDX SBOM External reference type.
set(ext_ref_prefix "PACKAGE-MANAGER purl")
set(external_ref "${ext_ref_prefix} ${arg_VALUE}")
set(result "EXTREF" "${external_ref}")
set(${arg_OUT_VAR} "${result}" PARENT_SCOPE)
endfunction()

View File

@ -0,0 +1,250 @@
# Copyright (C) 2024 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
# Helper macro to find python and a given dependency. Expects the caller to set all of the vars.
# Meant to reduce the line noise due to the repeated calls.
macro(_qt_internal_sbom_find_python_and_dependency_helper_lambda)
_qt_internal_sbom_find_python_and_dependency_helper(
PYTHON_ARGS
${extra_python_args}
${python_common_args}
DEPENDENCY_ARGS
DEPENDENCY_IMPORT_STATEMENT "${import_statement}"
OUT_VAR_PYTHON_PATH python_path
OUT_VAR_PYTHON_FOUND python_found
OUT_VAR_DEP_FOUND dep_found
OUT_VAR_PYTHON_AND_DEP_FOUND everything_found
OUT_VAR_DEP_FIND_OUTPUT dep_find_output
)
endmacro()
# Tries to find python and a given dependency based on the args passed to PYTHON_ARGS and
# DEPENDENCY_ARGS which are forwarded to the respective finding functions.
# Returns the path to the python interpreter, whether it was found, whether the dependency was
# found, whether both were found, and the reason why the dependency might not be found.
function(_qt_internal_sbom_find_python_and_dependency_helper)
set(opt_args)
set(single_args
OUT_VAR_PYTHON_PATH
OUT_VAR_PYTHON_FOUND
OUT_VAR_DEP_FOUND
OUT_VAR_PYTHON_AND_DEP_FOUND
OUT_VAR_DEP_FIND_OUTPUT
)
set(multi_args
PYTHON_ARGS
DEPENDENCY_ARGS
)
cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
set(everything_found_inner FALSE)
set(deps_find_output_inner "")
if(NOT arg_OUT_VAR_PYTHON_PATH)
message(FATAL_ERROR "OUT_VAR_PYTHON_PATH var is required")
endif()
if(NOT arg_OUT_VAR_PYTHON_FOUND)
message(FATAL_ERROR "OUT_VAR_PYTHON_FOUND var is required")
endif()
if(NOT arg_OUT_VAR_DEP_FOUND)
message(FATAL_ERROR "OUT_VAR_DEP_FOUND var is required")
endif()
if(NOT arg_OUT_VAR_PYTHON_AND_DEP_FOUND)
message(FATAL_ERROR "OUT_VAR_PYTHON_AND_DEP_FOUND var is required")
endif()
if(NOT arg_OUT_VAR_DEP_FIND_OUTPUT)
message(FATAL_ERROR "OUT_VAR_DEP_FIND_OUTPUT var is required")
endif()
_qt_internal_sbom_find_python_helper(
${arg_PYTHON_ARGS}
OUT_VAR_PYTHON_PATH python_path_inner
OUT_VAR_PYTHON_FOUND python_found_inner
)
if(python_found_inner AND python_path_inner)
_qt_internal_sbom_find_python_dependency_helper(
${arg_DEPENDENCY_ARGS}
PYTHON_PATH "${python_path_inner}"
OUT_VAR_FOUND dep_found_inner
OUT_VAR_OUTPUT dep_find_output_inner
)
if(dep_found_inner)
set(everything_found_inner TRUE)
endif()
endif()
set(${arg_OUT_VAR_PYTHON_PATH} "${python_path_inner}" PARENT_SCOPE)
set(${arg_OUT_VAR_PYTHON_FOUND} "${python_found_inner}" PARENT_SCOPE)
set(${arg_OUT_VAR_DEP_FOUND} "${dep_found_inner}" PARENT_SCOPE)
set(${arg_OUT_VAR_PYTHON_AND_DEP_FOUND} "${everything_found_inner}" PARENT_SCOPE)
set(${arg_OUT_VAR_DEP_FIND_OUTPUT} "${dep_find_output_inner}" PARENT_SCOPE)
endfunction()
# Tries to find the python intrepreter, given the QT_SBOM_PYTHON_INTERP path hint, as well as
# other options.
# Ignores any previously found python.
# Returns the python interpreter path and whether it was successfully found.
#
# This is intentionally a function, and not a macro, to prevent overriding the Python3_EXECUTABLE
# non-cache variable in a global scope in case if a different python is found and used for a
# different purpose (e.g. qtwebengine or qtinterfaceframework).
# The reason to use a different python is that an already found python might not be the version we
# need, or might lack the dependencies we need.
# https://gitlab.kitware.com/cmake/cmake/-/issues/21797#note_901621 claims that finding multiple
# python versions in separate directory scopes is possible, and I claim a function scope is as
# good as a directory scope.
function(_qt_internal_sbom_find_python_helper)
set(opt_args
SEARCH_IN_FRAMEWORKS
QUIET
)
set(single_args
VERSION
OUT_VAR_PYTHON_PATH
OUT_VAR_PYTHON_FOUND
)
set(multi_args "")
cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
if(NOT arg_OUT_VAR_PYTHON_PATH)
message(FATAL_ERROR "OUT_VAR_PYTHON_PATH var is required")
endif()
if(NOT arg_OUT_VAR_PYTHON_FOUND)
message(FATAL_ERROR "OUT_VAR_PYTHON_FOUND var is required")
endif()
# Allow disabling looking for a python interpreter shipped as part of a macOS system framework.
if(NOT arg_SEARCH_IN_FRAMEWORKS)
set(Python3_FIND_FRAMEWORK NEVER)
endif()
set(required_version "")
if(arg_VERSION)
set(required_version "${arg_VERSION}")
endif()
set(find_quiet "")
if(arg_QUIET)
set(find_quiet "QUIET")
endif()
# Locally reset any executable that was possibly already found.
# We do this to ensure we always re-do the lookup/
# This needs to be set to an empty string, to override any cache variable
set(Python3_EXECUTABLE "")
# This needs to be unset, because the Python module checks whether the variable is defined, not
# whether it is empty.
unset(_Python3_EXECUTABLE)
if(QT_SBOM_PYTHON_INTERP)
set(Python3_ROOT_DIR ${QT_SBOM_PYTHON_INTERP})
endif()
find_package(Python3 ${required_version} ${find_quiet} COMPONENTS Interpreter)
set(${arg_OUT_VAR_PYTHON_PATH} "${Python3_EXECUTABLE}" PARENT_SCOPE)
set(${arg_OUT_VAR_PYTHON_FOUND} "${Python3_Interpreter_FOUND}" PARENT_SCOPE)
endfunction()
# Helper that takes an python import statement to run using the given python interpreter path,
# to confirm that the given python dependency can be found.
# Returns whether the dependency was found and the output of running the import, for error handling.
function(_qt_internal_sbom_find_python_dependency_helper)
set(opt_args "")
set(single_args
DEPENDENCY_IMPORT_STATEMENT
PYTHON_PATH
OUT_VAR_FOUND
OUT_VAR_OUTPUT
)
set(multi_args "")
cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
if(NOT arg_PYTHON_PATH)
message(FATAL_ERROR "Python interpreter path not given.")
endif()
if(NOT arg_DEPENDENCY_IMPORT_STATEMENT)
message(FATAL_ERROR "Python depdendency import statement not given.")
endif()
if(NOT arg_OUT_VAR_FOUND)
message(FATAL_ERROR "Out var found variable not given.")
endif()
set(python_path "${arg_PYTHON_PATH}")
execute_process(
COMMAND
${python_path} -c "${arg_DEPENDENCY_IMPORT_STATEMENT}"
RESULT_VARIABLE res
OUTPUT_VARIABLE output
ERROR_VARIABLE output
)
if("${res}" STREQUAL "0")
set(found TRUE)
set(output "${output}")
else()
set(found FALSE)
string(CONCAT output "SBOM Python dependency ${arg_DEPENDENCY_IMPORT_STATEMENT} not found. "
"Error:\n${output}")
endif()
set(${arg_OUT_VAR_FOUND} "${found}" PARENT_SCOPE)
if(arg_OUT_VAR_OUTPUT)
set(${arg_OUT_VAR_OUTPUT} "${output}" PARENT_SCOPE)
endif()
endfunction()
# Helper to find a python installed CLI utility.
# Expected to be in PATH.
function(_qt_internal_sbom_find_python_dependency_program)
set(opt_args
REQUIRED
)
set(single_args
NAME
)
set(multi_args "")
cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
set(program_name "${arg_NAME}")
string(TOUPPER "${program_name}" upper_name)
set(cache_var "QT_SBOM_PROGRAM_${upper_name}")
set(hints "")
# The path to python installed apps is different on Windows compared to UNIX, so we use
# a different path than where the python interpreter might be located.
if(QT_SBOM_PYTHON_APPS_PATH)
list(APPEND hints ${QT_SBOM_PYTHON_APPS_PATH})
endif()
find_program(${cache_var}
NAMES ${program_name}
HINTS ${hints}
)
if(NOT ${cache_var})
if(arg_REQUIRED)
set(message_type "FATAL_ERROR")
set(prefix "Required ")
else()
set(message_type "STATUS")
set(prefix "Optional ")
endif()
message(${message_type} "${prefix}SBOM python program '${program_name}' not found.")
endif()
endfunction()

View File

@ -0,0 +1,492 @@
# Copyright (C) 2024 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
# Helper macro to prepare forwarding all set sbom options to some other function.
# Expects the options names to be set in the parent scope by calling
# _qt_internal_get_sbom_add_target_options(opt_args single_args multi_args)
macro(_qt_internal_sbom_forward_sbom_add_target_options args_var_name)
if(NOT opt_args)
message(FATAL_ERROR
"Expected opt_args to be set by _qt_internal_get_sbom_add_target_options")
endif()
if(NOT single_args)
message(FATAL_ERROR
"Expected single_args to be set by _qt_internal_get_sbom_add_target_options")
endif()
if(NOT multi_args)
message(FATAL_ERROR
"Expected multi_args to be set by _qt_internal_get_sbom_add_target_options")
endif()
_qt_internal_forward_function_args(
FORWARD_PREFIX arg
FORWARD_OUT_VAR ${args_var_name}
FORWARD_OPTIONS
${opt_args}
FORWARD_SINGLE
${single_args}
FORWARD_MULTI
${multi_args}
)
endmacro()
# Helper function to add a default supplier for a qt entity type.
function(_qt_internal_sbom_handle_qt_entity_supplier target)
_qt_internal_get_sbom_add_target_options(opt_args single_args multi_args)
list(APPEND single_args OUT_VAR)
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
_qt_internal_sbom_is_qt_entity_type("${arg_TYPE}" is_qt_entity_type)
_qt_internal_sbom_is_qt_3rd_party_entity_type("${arg_TYPE}" is_qt_3rd_party_entity_type)
set(supplier "")
if(NOT arg_SUPPLIER
AND (is_qt_entity_type OR is_qt_3rd_party_entity_type)
AND NOT arg_NO_DEFAULT_QT_SUPPLIER)
_qt_internal_sbom_get_default_supplier(supplier)
endif()
if(supplier)
set(${arg_OUT_VAR} "${supplier}" PARENT_SCOPE)
endif()
endfunction()
# Helper function to add a default package for a qt entity type.
function(_qt_internal_sbom_handle_qt_entity_package_version target)
_qt_internal_get_sbom_add_target_options(opt_args single_args multi_args)
list(APPEND single_args OUT_VAR)
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
_qt_internal_sbom_is_qt_entity_type("${arg_TYPE}" is_qt_entity_type)
set(package_version "")
if(NOT arg_PACKAGE_VERSION
AND is_qt_entity_type
AND NOT arg_NO_DEFAULT_QT_PACKAGE_VERSION)
_qt_internal_sbom_get_default_qt_package_version(package_version)
endif()
if(package_version)
set(${arg_OUT_VAR} "${package_version}" PARENT_SCOPE)
endif()
endfunction()
# Helper function to add a default repo download location for a qt entity type.
function(_qt_internal_sbom_handle_qt_entity_download_location target)
_qt_internal_get_sbom_add_target_options(opt_args single_args multi_args)
list(APPEND single_args OUT_VAR)
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
_qt_internal_sbom_is_qt_entity_type("${arg_TYPE}" is_qt_entity_type)
set(download_location "")
if(NOT arg_DOWNLOAD_LOCATION AND is_qt_entity_type)
_qt_internal_sbom_get_qt_repo_source_download_location(download_location)
endif()
if(download_location)
set(${arg_OUT_VAR} "${download_location}" PARENT_SCOPE)
endif()
endfunction()
# Helper function to add a default license expression for a qt entity type.
function(_qt_internal_sbom_handle_qt_entity_license_expression target)
_qt_internal_get_sbom_add_target_options(opt_args single_args multi_args)
list(APPEND single_args OUT_VAR)
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
_qt_internal_sbom_is_qt_entity_type("${arg_TYPE}" is_qt_entity_type)
set(license_expression "")
# For Qt entities, we have some special handling.
if(is_qt_entity_type AND NOT arg_NO_DEFAULT_QT_LICENSE AND NOT arg_QT_LICENSE_ID)
if(arg_TYPE STREQUAL "QT_TOOL" OR arg_TYPE STREQUAL "QT_APP")
if(QT_SBOM_DEFAULT_QT_LICENSE_ID_EXECUTABLES
AND NOT arg_NO_DEFAULT_QT_LICENSE_ID_EXECUTABLES)
# A repo might contain only the "gpl3" license variant as the default for all
# executables, so allow setting it at the repo level to avoid having to repeat it
# for each target.
_qt_internal_sbom_get_spdx_license_expression(
"${QT_SBOM_DEFAULT_QT_LICENSE_ID_EXECUTABLES}" license_expression)
else()
# For tools and apps, we use the gpl exception variant by default.
_qt_internal_sbom_get_spdx_license_expression("QT_COMMERCIAL_OR_GPL3_WITH_EXCEPTION"
license_expression)
endif()
elseif(QT_SBOM_DEFAULT_QT_LICENSE_ID_LIBRARIES
AND NOT arg_NO_DEFAULT_QT_LICENSE_ID_LIBRARIES)
# A repo might contain only the "gpl3" license variant as the default for all modules
# and plugins, so allow setting it at the repo level to avoid having to repeat it
# for each target.
_qt_internal_sbom_get_spdx_license_expression(
"${QT_SBOM_DEFAULT_QT_LICENSE_ID_LIBRARIES}" license_expression)
else()
# Otherwise, for modules and plugins we use the default qt license.
_qt_internal_sbom_get_spdx_license_expression("QT_DEFAULT" license_expression)
endif()
endif()
# Some Qt entities might request a specific license from the subset that we usually use.
if(arg_QT_LICENSE_ID)
_qt_internal_sbom_get_spdx_license_expression("${arg_QT_LICENSE_ID}"
requested_license_expression)
_qt_internal_sbom_join_two_license_ids_with_op(
"${license_expression}" "AND" "${requested_license_expression}"
license_expression)
endif()
# Allow setting a license expression string per directory scope via a variable.
if(is_qt_entity_type AND QT_SBOM_LICENSE_EXPRESSION AND NOT arg_NO_DEFAULT_DIRECTORY_QT_LICENSE)
set(qt_license_expression "${QT_SBOM_LICENSE_EXPRESSION}")
_qt_internal_sbom_join_two_license_ids_with_op(
"${license_expression}" "AND" "${qt_license_expression}"
license_expression)
endif()
if(license_expression)
set(${arg_OUT_VAR} "${license_expression}" PARENT_SCOPE)
endif()
endfunction()
# Helper function to add a default license declared expression for a qt entity type.
function(_qt_internal_sbom_handle_qt_entity_license_declared_expression target)
_qt_internal_get_sbom_add_target_options(opt_args single_args multi_args)
list(APPEND single_args OUT_VAR LICENSE_CONCLUDED_EXPRESSION)
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
_qt_internal_sbom_is_qt_entity_type("${arg_TYPE}" is_qt_entity_type)
set(license_expression "")
# For qt entities we know the license we provide, so we mark it as declared as well.
if(is_qt_entity_type AND arg_LICENSE_CONCLUDED_EXPRESSION)
set(license_expression "${arg_LICENSE_CONCLUDED_EXPRESSION}")
endif()
if(license_expression)
set(${arg_OUT_VAR} "${license_expression}" PARENT_SCOPE)
endif()
endfunction()
# Get the default qt copyright.
function(_qt_internal_sbom_get_default_qt_copyright_header out_var)
set(${out_var}
"Copyright (C) The Qt Company Ltd. and other contributors."
PARENT_SCOPE)
endfunction()
# Helper function to add default copyrights for a qt entity type.
function(_qt_internal_sbom_handle_qt_entity_copyrights target)
_qt_internal_get_sbom_add_target_options(opt_args single_args multi_args)
list(APPEND single_args OUT_VAR)
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
_qt_internal_sbom_is_qt_entity_type("${arg_TYPE}" is_qt_entity_type)
set(qt_default_copyright "")
if(is_qt_entity_type AND NOT arg_NO_DEFAULT_QT_COPYRIGHTS)
_qt_internal_sbom_get_default_qt_copyright_header(qt_default_copyright)
endif()
if(qt_default_copyright)
set(${arg_OUT_VAR} "${qt_default_copyright}" PARENT_SCOPE)
endif()
endfunction()
# Helper function to add default CPEs for a qt entity type.
function(_qt_internal_sbom_handle_qt_entity_cpe target)
_qt_internal_get_sbom_add_target_options(opt_args single_args multi_args)
list(APPEND single_args OUT_VAR)
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
_qt_internal_sbom_is_qt_entity_type("${arg_TYPE}" is_qt_entity_type)
_qt_internal_sbom_is_qt_3rd_party_entity_type("${arg_TYPE}" is_qt_3rd_party_entity_type)
set(cpe_list "")
# Add the qt-specific CPE if the target is a Qt entity type, or if it's a 3rd party entity type
# without any CPE specified.
if(is_qt_entity_type OR (is_qt_3rd_party_entity_type AND NOT arg_CPE))
_qt_internal_sbom_compute_security_cpe_for_qt(cpe_list)
endif()
if(cpe_list)
set(${arg_OUT_VAR} "${cpe_list}" PARENT_SCOPE)
endif()
endfunction()
# Returns a vcs url for purls where qt entities of the current repo are hosted.
function(_qt_internal_sbom_get_qt_entity_vcs_url target)
set(opt_args "")
set(single_args
REPO_NAME
VERSION
OUT_VAR
)
set(multi_args "")
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
if(NOT arg_REPO_NAME)
message(FATAL_ERROR "REPO_NAME must be set")
endif()
if(NOT arg_OUT_VAR)
message(FATAL_ERROR "OUT_VAR must be set")
endif()
set(version_part "")
if(arg_VERSION)
set(version_part "@${arg_VERSION}")
endif()
set(vcs_url "https://code.qt.io/qt/${arg_REPO_NAME}.git${version_part}")
set(${arg_OUT_VAR} "${vcs_url}" PARENT_SCOPE)
endfunction()
# Returns a relative path to the source where the target was created, to be embedded into a
# mirror purl as a subpath.
function(_qt_internal_sbom_get_qt_entity_repo_source_dir target)
set(opt_args "")
set(single_args
OUT_VAR
)
set(multi_args "")
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
if(NOT arg_OUT_VAR)
message(FATAL_ERROR "OUT_VAR must be set")
endif()
get_target_property(repo_source_dir "${target}" SOURCE_DIR)
# Get the path relative to the PROJECT_SOURCE_DIR
file(RELATIVE_PATH relative_repo_source_dir "${PROJECT_SOURCE_DIR}" "${repo_source_dir}")
set(sub_path "${relative_repo_source_dir}")
set(${arg_OUT_VAR} "${sub_path}" PARENT_SCOPE)
endfunction()
# Gets a list of arguments to pass to _qt_internal_sbom_assemble_purl when handling a Qt entity
# type. The purl for Qt entity types have Qt-specific defaults, but can be overridden per purl
# component.
# The arguments are saved in OUT_VAR.
function(_qt_internal_sbom_get_qt_entity_purl_args target)
set(opt_args "")
set(single_args
NAME
REPO_NAME
SUPPLIER
VERSION
OUT_VAR
)
set(multi_args "")
_qt_internal_get_sbom_purl_parsing_options(purl_opt_args purl_single_args purl_multi_args)
list(APPEND opt_args ${purl_opt_args})
list(APPEND single_args ${purl_single_args})
list(APPEND multi_args ${purl_multi_args})
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
if(arg_VERSION)
set(purl_version "${arg_VERSION}")
endif()
if(arg_PURL_ID STREQUAL "GENERIC")
set(purl_type "generic")
set(purl_namespace "${arg_SUPPLIER}")
set(purl_name "${arg_NAME}")
elseif(arg_PURL_ID STREQUAL "GITHUB")
set(purl_type "github")
set(purl_namespace "qt")
set(purl_name "${arg_REPO_NAME}")
endif()
if(arg_PURL_TYPE)
set(purl_type "${arg_PURL_TYPE}")
endif()
if(arg_PURL_NAMESPACE)
set(purl_namespace "${arg_PURL_NAMESPACE}")
endif()
if(arg_PURL_NAME)
set(purl_name "${arg_PURL_NAME}")
endif()
if(arg_PURL_VERSION)
set(purl_version "${arg_PURL_VERSION}")
endif()
set(purl_version_option "")
if(purl_version)
set(purl_version_option PURL_VERSION "${purl_version}")
endif()
set(purl_args
PURL_TYPE "${purl_type}"
PURL_NAMESPACE "${purl_namespace}"
PURL_NAME "${purl_name}"
${purl_version_option}
)
if(arg_PURL_QUALIFIERS)
list(APPEND purl_args PURL_QUALIFIERS "${arg_PURL_QUALIFIERS}")
endif()
if(arg_PURL_SUBPATH)
list(APPEND purl_args PURL_SUBPATH "${arg_PURL_SUBPATH}")
endif()
set(${arg_OUT_VAR} "${purl_args}" PARENT_SCOPE)
endfunction()
# Helper to get the list of default purl ids for a qt entity.
#
# Qt entities have two purls by default:
# - a GITHUB one pointing to the qt github mirror
# - a GENERIC one pointing to code.qt.io via vcs_url
#
# Third party libraries vendored in Qt also have the same purls, like regular Qt
# libraries, but might also have an upstream one which is specified explicitly.
function(_qt_internal_sbom_get_qt_entity_default_purl_ids out_var)
set(supported_purl_ids GITHUB GENERIC)
set(${out_var} "${supported_purl_ids}" PARENT_SCOPE)
endfunction()
# Helper function to decide which purl ids to add for a qt entity.
# Returns either a list of qt purl ids, or an empty list if it's not a qt entity type or qt 3rd
# party type.
function(_qt_internal_sbom_handle_qt_entity_purl_entries)
_qt_internal_get_sbom_purl_handling_options(opt_args single_args multi_args)
list(APPEND single_args
OUT_VAR # This is unused, but added by the calling function.
OUT_VAR_IDS
)
cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
set(purl_ids "")
_qt_internal_sbom_is_qt_entity_type("${arg_TYPE}" is_qt_entity_type)
_qt_internal_sbom_is_qt_3rd_party_entity_type("${arg_TYPE}" is_qt_3rd_party_entity_type)
if(is_qt_entity_type OR is_qt_3rd_party_entity_type)
_qt_internal_sbom_get_qt_entity_default_purl_ids(purl_ids)
endif()
if(purl_ids)
set(${arg_OUT_VAR_IDS} "${purl_ids}" PARENT_SCOPE)
endif()
endfunction()
# Helper function to add purl values for a specific purl entry of a qt entity type.
function(_qt_internal_sbom_handle_qt_entity_purl target)
_qt_internal_get_sbom_purl_handling_options(opt_args single_args multi_args)
list(APPEND single_args
OUT_VAR # This is unused, but added by the calling function.
OUT_PURL_ARGS
PURL_ID
)
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
set(purl_args "")
_qt_internal_sbom_get_git_version_vars()
# Return early if not handling one of the default qt purl ids, or if requested not to add a
# default purl.
_qt_internal_sbom_get_qt_entity_default_purl_ids(default_purl_ids)
if(arg_NO_DEFAULT_QT_PURL OR (NOT arg_PURL_ID IN_LIST default_purl_ids))
set(${arg_OUT_PURL_ARGS} "${purl_args}" PARENT_SCOPE)
return()
endif()
_qt_internal_sbom_get_root_project_name_lower_case(repo_project_name_lowercase)
# Add a vcs_url to the GENERIC purl entry.
if(arg_PURL_ID STREQUAL "GENERIC")
set(entity_vcs_url_version_option "")
# Can be empty.
if(QT_SBOM_GIT_HASH_SHORT)
set(entity_vcs_url_version_option VERSION "${QT_SBOM_GIT_HASH_SHORT}")
endif()
_qt_internal_sbom_get_qt_entity_vcs_url(${target}
REPO_NAME "${repo_project_name_lowercase}"
${entity_vcs_url_version_option}
OUT_VAR vcs_url)
list(APPEND purl_args PURL_QUALIFIERS "vcs_url=${vcs_url}")
endif()
# Add the subdirectory path where the target was created as a custom qualifier.
_qt_internal_sbom_get_qt_entity_repo_source_dir(${target} OUT_VAR sub_path)
if(sub_path)
list(APPEND purl_args PURL_SUBPATH "${sub_path}")
endif()
# Add the target name as a custom qualifer.
list(APPEND purl_args PURL_QUALIFIERS "library_name=${target}")
# Can be empty.
if(QT_SBOM_GIT_HASH_SHORT)
list(APPEND purl_args VERSION "${QT_SBOM_GIT_HASH_SHORT}")
endif()
# Get purl args the Qt entity type, taking into account defaults.
_qt_internal_sbom_get_qt_entity_purl_args(${target}
NAME "${repo_project_name_lowercase}-${target}"
REPO_NAME "${repo_project_name_lowercase}"
SUPPLIER "${arg_SUPPLIER}"
PURL_ID "${arg_PURL_ID}"
${purl_args}
OUT_VAR purl_args
)
if(purl_args)
set(${arg_OUT_PURL_ARGS} "${purl_args}" PARENT_SCOPE)
endif()
endfunction()
# Get the default qt package version.
function(_qt_internal_sbom_get_default_qt_package_version out_var)
set(${out_var} "${QT_REPO_MODULE_VERSION}" PARENT_SCOPE)
endfunction()
# Get the default qt supplier.
function(_qt_internal_sbom_get_default_supplier out_var)
set(${out_var} "TheQtCompany" PARENT_SCOPE)
endfunction()
# Get the default qt supplier url.
function(_qt_internal_sbom_get_default_supplier_url out_var)
set(${out_var} "https://qt.io" PARENT_SCOPE)
endfunction()
# Get the default qt download location.
# If git info is available, includes the hash.
function(_qt_internal_sbom_get_qt_repo_source_download_location out_var)
_qt_internal_sbom_get_root_project_name_lower_case(repo_project_name_lowercase)
set(download_location "git://code.qt.io/qt/${repo_project_name_lowercase}.git")
_qt_internal_sbom_get_git_version_vars()
if(QT_SBOM_GIT_HASH)
string(APPEND download_location "@${QT_SBOM_GIT_HASH}")
endif()
set(${out_var} "${download_location}" PARENT_SCOPE)
endfunction()

View File

@ -0,0 +1,171 @@
# Copyright (C) 2024 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
# Records information about a system library target, usually due to a qt_find_package call.
# This information is later used to generate packages for the system libraries, but only after
# confirming that the library was used (linked) into any of the Qt targets.
function(_qt_internal_sbom_record_system_library_usage target)
if(NOT QT_GENERATE_SBOM)
return()
endif()
set(opt_args "")
set(single_args
TYPE
PACKAGE_VERSION
FRIENDLY_PACKAGE_NAME
)
set(multi_args "")
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
if(NOT arg_TYPE)
message(FATAL_ERROR "TYPE must be set")
endif()
# A package might be looked up more than once, make sure to record it once.
get_property(already_recorded GLOBAL PROPERTY
_qt_internal_sbom_recorded_system_library_target_${target})
if(already_recorded)
return()
endif()
set_property(GLOBAL PROPERTY
_qt_internal_sbom_recorded_system_library_target_${target} TRUE)
# Defer spdx id creation until _qt_internal_sbom_begin_project is called, so we know the
# project name. The project name is used in the package infix generation of the system library,
# but _qt_internal_sbom_record_system_library_usage might be called before sbom generation
# has started, e.g. during _qt_internal_find_third_party_dependencies.
set(spdx_options
${target}
TYPE "${arg_TYPE}"
PACKAGE_NAME "${arg_FRIENDLY_PACKAGE_NAME}"
)
get_cmake_property(sbom_repo_begin_called _qt_internal_sbom_repo_begin_called)
if(sbom_repo_begin_called AND TARGET "${target}")
_qt_internal_sbom_record_system_library_spdx_id(${target} ${spdx_options})
else()
set_property(GLOBAL PROPERTY
_qt_internal_sbom_recorded_system_library_spdx_options_${target} "${spdx_options}")
endif()
# Defer sbom info creation until we detect usage of the system library (whether the library is
# linked into any other target).
set_property(GLOBAL APPEND PROPERTY
_qt_internal_sbom_recorded_system_library_targets "${target}")
set_property(GLOBAL PROPERTY
_qt_internal_sbom_recorded_system_library_options_${target} "${ARGN}")
endfunction()
# Helper to record spdx ids of all system library targets that were found so far.
function(_qt_internal_sbom_record_system_library_spdx_ids)
get_property(recorded_targets GLOBAL PROPERTY _qt_internal_sbom_recorded_system_library_targets)
if(NOT recorded_targets)
return()
endif()
foreach(target IN LISTS recorded_targets)
get_property(args GLOBAL PROPERTY
_qt_internal_sbom_recorded_system_library_spdx_options_${target})
# qt_find_package PROVIDED_TARGETS might refer to non-existent targets in certain cases,
# like zstd::libzstd_shared for qt_find_package(WrapZSTD), because we are not sure what
# kind of zstd build was done. Make sure to check if the target exists before recording it.
if(TARGET "${target}")
set(target_unaliased "${target}")
get_target_property(aliased_target "${target}" ALIASED_TARGET)
if(aliased_target)
set(target_unaliased ${aliased_target})
endif()
_qt_internal_sbom_record_system_library_spdx_id(${target_unaliased} ${args})
else()
message(DEBUG
"Skipping recording system library for SBOM because target does not exist: "
" ${target}")
endif()
endforeach()
endfunction()
# Helper to record the spdx id of a system library target.
function(_qt_internal_sbom_record_system_library_spdx_id target)
# Save the spdx id before the sbom info is added, so we can refer to it in relationships.
_qt_internal_sbom_record_target_spdx_id(${ARGN} OUT_VAR package_spdx_id)
if(NOT package_spdx_id)
message(FATAL_ERROR "Could not generate spdx id for system library target: ${target}")
endif()
set_target_properties("${target}" PROPERTIES _qt_internal_sbom_is_system_library TRUE)
set_property(GLOBAL PROPERTY
_qt_internal_sbom_recorded_system_library_package_${target} "${package_spdx_id}")
endfunction()
# Goes through the list of consumed system libraries (those that were linked in) and creates
# sbom packages for them.
# Uses information from recorded system libraries (calls to qt_find_package).
function(_qt_internal_sbom_add_recorded_system_libraries)
get_property(recorded_targets GLOBAL PROPERTY _qt_internal_sbom_recorded_system_library_targets)
get_property(consumed_targets GLOBAL PROPERTY _qt_internal_sbom_consumed_system_library_targets)
set(unconsumed_targets "${recorded_targets}")
set(generated_package_names "")
message(DEBUG
"System libraries that were marked consumed "
"(some target linked to them): ${consumed_targets}")
message(DEBUG
"System libraries that were recorded "
"(they were marked with qt_find_package()): ${recorded_targets}")
foreach(target IN LISTS consumed_targets)
# Some system targets like qtspeech SpeechDispatcher::SpeechDispatcher might be aliased,
# and we can't set properties on them, so unalias the target name.
set(target_original "${target}")
get_target_property(aliased_target "${target}" ALIASED_TARGET)
if(aliased_target)
set(target ${aliased_target})
endif()
get_property(args GLOBAL PROPERTY
_qt_internal_sbom_recorded_system_library_options_${target})
get_property(package_name GLOBAL PROPERTY
_qt_internal_sbom_recorded_system_library_package_${target})
set_property(GLOBAL PROPERTY _qt_internal_sbom_recorded_system_library_target_${target} "")
set_property(GLOBAL PROPERTY _qt_internal_sbom_recorded_system_library_options_${target} "")
set_property(GLOBAL PROPERTY _qt_internal_sbom_recorded_system_library_package_${target} "")
# Guard against generating a package multiple times. Can happen when multiple targets belong
# to the same package.
if(sbom_generated_${package_name})
continue()
endif()
# Automatic system library sbom recording happens at project root source dir scope, which
# means it might accidentally pick up a qt_attribution.json file from the project root,
# that is not intended to be use for system libraries.
# For now, explicitly disable using the root attribution file.
list(APPEND args NO_CURRENT_DIR_ATTRIBUTION)
list(APPEND generated_package_names "${package_name}")
set(sbom_generated_${package_name} TRUE)
_qt_internal_extend_sbom(${target} ${args})
_qt_internal_finalize_sbom(${target})
list(REMOVE_ITEM unconsumed_targets "${target_original}")
endforeach()
message(DEBUG "System libraries that were recorded, but not consumed: ${unconsumed_targets}")
message(DEBUG "Generated SBOMs for the following system packages: ${generated_package_names}")
# Clean up, before configuring next repo project.
set_property(GLOBAL PROPERTY _qt_internal_sbom_consumed_system_library_targets "")
set_property(GLOBAL PROPERTY _qt_internal_sbom_recorded_system_library_targets "")
endfunction()

View File

@ -424,3 +424,93 @@ function(_qt_internal_warn_about_example_add_subdirectory)
)
endif()
endfunction()
# Mark source files as generated.
#
# This sets `GENERATED` property to TRUE, along with other Qt relevant properties,
# e.g. `SKIP_LINTING`.
#
# Synopsis
#
# _qt_internal_set_source_file_generated(SOURCE <src1> ...
# [CONFIGURE_GENERATED]
# [SKIP_AUTOGEN]
# [DIRECTORY <dirs> ...]
# [TARGET_DIRECTORY <targets> ...]
# )
#
# Arguments
#
# `SOURCES`
# Source files that are generated.
#
# Equivalent to `set_source_files_properties(<files>)`.
#
# `DIRECTORY`
# Equivalent to `set_source_files_properties(DIRECTORY)`.
#
# `TARGET_DIRECTORY`
# Equivalent to `set_source_files_properties(TARGET_DIRECTORY)`.
#
# `SKIP_AUTOGEN`
# Set SKIP_AUTOGEN property to True as well.
#
# `CONFIGURE_GENERATED`
# Files are generated with `configure_file`.
# Does not set `GENERATED TRUE` property. This is needed to avoid removing the file when
# running the clean target.
function(_qt_internal_set_source_file_generated)
set(option_args
SKIP_AUTOGEN
CONFIGURE_GENERATED
)
set(single_args "")
set(multi_args
SOURCES
DIRECTORY
TARGET_DIRECTORY
)
cmake_parse_arguments(PARSE_ARGV 0 arg
"${option_args}" "${single_args}" "${multi_args}"
)
# Parse required variables
if(NOT arg_SOURCES AND QT_FEATURE_developer_build)
message(WARNING
"Unexpected call _qt_internal_set_source_file_generated with empty `SOURCES`."
)
endif()
# Prepend again the appropriate keywords to pass to `set_source_files_properties`
if(arg_DIRECTORY)
list(PREPEND arg_DIRECTORY DIRECTORY)
endif()
if(arg_TARGET_DIRECTORY)
list(PREPEND arg_TARGET_DIRECTORY TARGET_DIRECTORY)
endif()
# Construct the properties list
set(properties "")
if(NOT arg_CONFIGURE_GENERATED)
list(APPEND properties
GENERATED TRUE
)
endif()
if(arg_SKIP_AUTOGEN)
list(APPEND properties
SKIP_AUTOGEN TRUE
)
endif()
# Add SKIP_LINTING if possible. We do not add it unconditionally here to avoid
# confusion when CMake ignores this variable.
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.27" AND NOT QT_FEATURE_lint_generated_code)
list(APPEND properties
SKIP_LINTING TRUE
)
endif()
set_source_files_properties(${arg_SOURCES}
${arg_DIRECTORY}
${arg_TARGET_DIRECTORY}
PROPERTIES ${properties}
)
endfunction()

View File

@ -68,7 +68,10 @@ is not specified")
# 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")
#
# Run the command using the proxy 'call' command to avoid issues related to invalid
# processing of quotes and spaces in cmd.exe arguments.
set(extra_runner "cmd /c call")
endif()
if(arg_PRE_RUN)
@ -118,3 +121,35 @@ endfunction()
function(_qt_internal_test_batch_target_name out)
set(${out} "test_batch" PARENT_SCOPE)
endfunction()
# Create a *_check target of the ctest execution for alternative execution
# Arguments:
# : CTEST_TEST_NAME: (default: ${testname})
# name of the ctest test used
function(_qt_internal_make_check_target testname)
set(options "")
set(singleOpts CTEST_TEST_NAME)
set(multiOpts "")
cmake_parse_arguments(PARSE_ARGV 1 arg
"${options}" "${singleOpts}" "${multiOpts}"
)
if(NOT arg_CTEST_TEST_NAME)
set(arg_CTEST_TEST_NAME ${testname})
endif()
set(test_config_options "")
get_cmake_property(is_multi_config GENERATOR_IS_MULTI_CONFIG)
if(is_multi_config)
set(test_config_options -C $<CONFIG>)
endif()
# Note: By default the working directory here is CMAKE_CURRENT_BINARY_DIR, which will
# work as long as this is called anywhere up or down the path where the equivalent
# `add_test` is called (not down a different branch path).
add_custom_target(${testname}_check
VERBATIM
COMMENT "Running ctest -V -R \"^${arg_CTEST_TEST_NAME}$\" ${test_config_options}"
COMMAND
"${CMAKE_CTEST_COMMAND}" -V -R "^${arg_CTEST_TEST_NAME}$" ${test_config_options}
)
endfunction()

View File

@ -139,7 +139,7 @@ macro(_qt_internal_execute_proccess_in_qt_env execute_process_args_var)
# We avoid escaping issues this way.
execute_process(${${execute_process_args_var}})
if(CMAKE_HOST_WIN32)
set(ENV{PATH} "${path_backup}")
set(ENV{PATH} "${_qt_internal_execute_proccess_in_qt_env_path_backup}")
unset(_qt_internal_execute_proccess_in_qt_env_path_backup)
endif()
endmacro()

View File

@ -172,12 +172,16 @@ function(__qt_internal_walk_libs
if(lib MATCHES "^\\$<TARGET_OBJECTS:")
# Skip object files.
continue()
elseif(lib MATCHES "^\\$<LINK_ONLY:(.*)>$")
set(lib_target ${CMAKE_MATCH_1})
else()
set(lib_target ${lib})
endif()
set(lib_target "${lib}")
# Unwrap targets like $<LINK_ONLY:$<BUILD_INTERFACE:Qt6::CorePrivate>>
while(lib_target
MATCHES "^\\$<(LINK_ONLY|BUILD_INTERFACE|BUILD_LOCAL_INTERFACE):(.*)>$")
set(lib_target ${CMAKE_MATCH_2})
endwhile()
# Skip CMAKE_DIRECTORY_ID_SEP. If a target_link_libraries is applied to a target
# that was defined in a different scope, CMake appends and prepends a special directory
# id separator. Filter those out.

View File

@ -53,7 +53,7 @@ endfunction()
function(__qt_internal_get_emcc_recommended_version out_var)
# This version of Qt needs this version of emscripten.
set(QT_EMCC_RECOMMENDED_VERSION "3.1.56")
set(QT_EMCC_RECOMMENDED_VERSION "3.1.70")
set(${out_var} "${QT_EMCC_RECOMMENDED_VERSION}" PARENT_SCOPE)
endfunction()

View File

@ -1,10 +1,15 @@
# Copyright (C) 2024 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
# For now these are simple internal forwarding wrappers for the public counterparts, which are
# meant to be used in qt repo CMakeLists.txt files.
function(qt_internal_add_sbom)
_qt_internal_add_sbom(${ARGN})
# These internal sbom functions are meant to be used in qt repo CMakeLists.txt files.
function(qt_internal_add_sbom target)
if(NOT QT_GENERATE_SBOM)
return()
endif()
qt_internal_sbom_get_default_sbom_args("${target}" sbom_extra_args ${ARGN})
_qt_internal_add_sbom(${target} ${ARGN} ${sbom_extra_args})
endfunction()
function(qt_internal_extend_sbom)
@ -31,3 +36,161 @@ function(qt_internal_sbom_end_qt_repo_project)
_qt_internal_sbom_end_qt_repo_project(${ARGN})
endfunction()
function(qt_internal_sbom_add_files)
_qt_internal_sbom_add_files(${ARGN})
endfunction()
function(qt_internal_sbom_add_cmake_include_step)
_qt_internal_sbom_add_cmake_include_step(${ARGN})
endfunction()
function(qt_internal_sbom_add_external_reference)
_qt_internal_sbom_generate_add_external_reference(${ARGN})
endfunction()
function(qt_internal_sbom_add_project_relationship)
_qt_internal_sbom_generate_add_project_relationship(${ARGN})
endfunction()
function(qt_internal_sbom_generate_tag_value_spdx_document)
_qt_internal_sbom_generate_tag_value_spdx_document(${ARGN})
set(opt_args "")
set(single_args
OUT_VAR_OUTPUT_FILE_NAME
OUT_VAR_OUTPUT_ABSOLUTE_FILE_PATH
OUT_VAR_DEPS_FOUND
)
set(multi_args "")
cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
if(arg_OUT_VAR_OUTPUT_FILE_NAME)
set(${arg_OUT_VAR_OUTPUT_FILE_NAME} "${${arg_OUT_VAR_OUTPUT_FILE_NAME}}" PARENT_SCOPE)
endif()
if(arg_OUT_VAR_OUTPUT_ABSOLUTE_FILE_PATH)
set(${arg_OUT_VAR_OUTPUT_ABSOLUTE_FILE_PATH} "${${arg_OUT_VAR_OUTPUT_ABSOLUTE_FILE_PATH}}"
PARENT_SCOPE)
endif()
if(arg_OUT_VAR_DEPS_FOUND)
set(${arg_OUT_VAR_DEPS_FOUND} "${${arg_OUT_VAR_DEPS_FOUND}}" PARENT_SCOPE)
endif()
endfunction()
function(qt_internal_sbom_verify_deps_for_generate_tag_value_spdx_document)
_qt_internal_sbom_verify_deps_for_generate_tag_value_spdx_document(${ARGN})
set(opt_args "")
set(single_args
OUT_VAR_DEPS_FOUND
OUT_VAR_REASON_FAILURE_MESSAGE
)
set(multi_args "")
cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
if(arg_OUT_VAR_DEPS_FOUND)
set(${arg_OUT_VAR_DEPS_FOUND} "${${arg_OUT_VAR_DEPS_FOUND}}" PARENT_SCOPE)
endif()
if(arg_OUT_VAR_REASON_FAILURE_MESSAGE)
set(${arg_OUT_VAR_REASON_FAILURE_MESSAGE}
"${${arg_OUT_VAR_REASON_FAILURE_MESSAGE}}" PARENT_SCOPE)
endif()
endfunction()
function(qt_internal_sbom_get_project_spdx_id out_var)
set(result "")
if(QT_GENERATE_SBOM)
get_cmake_property(project_spdx_id _qt_internal_sbom_project_spdx_id)
if(project_spdx_id)
set(result "${project_spdx_id}")
endif()
endif()
set(${out_var} "${result}" PARENT_SCOPE)
endfunction()
function(qt_internal_sbom_get_target_spdx_id target out_var)
set(result "")
if(QT_GENERATE_SBOM)
_qt_internal_sbom_get_spdx_id_for_target(${target} result)
endif()
set(${out_var} "${result}" PARENT_SCOPE)
endfunction()
function(qt_internal_sbom_get_external_document_ref_spdx_id project_name out_var)
set(result "")
if(QT_GENERATE_SBOM)
string(TOLOWER "${project_name}" project_name_lowercase)
_qt_internal_sbom_get_external_document_ref_spdx_id("${project_name_lowercase}" result)
endif()
set(${out_var} "${result}" PARENT_SCOPE)
endfunction()
macro(qt_internal_sbom_get_git_version_vars)
_qt_internal_sbom_get_git_version_vars()
endmacro()
function(qt_internal_sbom_get_project_supplier out_var)
get_property(result GLOBAL PROPERTY _qt_sbom_project_supplier)
set(${out_var} "${result}" PARENT_SCOPE)
endfunction()
function(qt_internal_sbom_get_project_supplier_url out_var)
get_property(result GLOBAL PROPERTY _qt_sbom_project_supplier_url)
set(${out_var} "${result}" PARENT_SCOPE)
endfunction()
function(qt_internal_sbom_get_project_namespace out_var)
get_property(result GLOBAL PROPERTY _qt_sbom_project_namespace)
set(${out_var} "${result}" PARENT_SCOPE)
endfunction()
function(qt_internal_sbom_compute_project_namespace out_var)
_qt_internal_sbom_compute_project_namespace(result ${ARGN})
set(${out_var} "${result}" PARENT_SCOPE)
endfunction()
function(qt_internal_sbom_compute_project_file_name out_var)
_qt_internal_sbom_compute_project_file_name(result ${ARGN})
set(${out_var} "${result}" PARENT_SCOPE)
endfunction()
function(qt_internal_sbom_get_sanitized_spdx_id out_var hint)
_qt_internal_sbom_get_sanitized_spdx_id(result "${hint}")
set(${out_var} "${result}" PARENT_SCOPE)
endfunction()
# Gets a list of default sbom args to use when processing qt entity types.
function(qt_internal_sbom_get_default_sbom_args target out_var)
_qt_internal_get_sbom_add_target_options(opt_args single_args multi_args)
list(APPEND opt_args IMMEDIATE_FINALIZATION)
cmake_parse_arguments(PARSE_ARGV 2 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
set(sbom_args "")
list(APPEND sbom_args USE_ATTRIBUTION_FILES)
list(APPEND sbom_args __QT_INTERNAL_HANDLE_QT_ENTITY_TYPE_PACKAGE_VERSION)
list(APPEND sbom_args __QT_INTERNAL_HANDLE_QT_ENTITY_TYPE_SUPPLIER)
list(APPEND sbom_args __QT_INTERNAL_HANDLE_QT_ENTITY_TYPE_DOWNLOAD_LOCATION)
list(APPEND sbom_args __QT_INTERNAL_HANDLE_QT_ENTITY_TYPE_LICENSE)
list(APPEND sbom_args __QT_INTERNAL_HANDLE_QT_ENTITY_TYPE_COPYRIGHTS)
list(APPEND sbom_args __QT_INTERNAL_HANDLE_QT_ENTITY_TYPE_CPE)
list(APPEND sbom_args __QT_INTERNAL_HANDLE_QT_ENTITY_TYPE_PURL)
list(APPEND sbom_args __QT_INTERNAL_HANDLE_QT_ENTITY_ATTRIBUTION_FILES)
set(${out_var} "${sbom_args}" PARENT_SCOPE)
endfunction()
function(qt_internal_extend_qt_entity_sbom target)
qt_internal_sbom_get_default_sbom_args("${target}" sbom_extra_args ${ARGN})
_qt_internal_extend_sbom(${target} ${ARGN} ${sbom_extra_args})
endfunction()

View File

@ -270,7 +270,7 @@ function(qt_enable_separate_debug_info target installDestination)
if(QNX)
set(debug_info_suffix sym)
set(debug_info_keep --keep-file-symbols)
set(strip_args "--strip-debug -R.ident")
set(strip_args --strip-debug -R.ident)
else()
set(debug_info_suffix debug)
set(debug_info_keep --only-keep-debug)

View File

@ -148,6 +148,7 @@ function(qt_internal_extend_target target)
list(TRANSFORM arg_PUBLIC_LIBRARIES REPLACE "^Qt::" "${QT_CMAKE_EXPORT_NAMESPACE}::")
list(TRANSFORM arg_LIBRARIES REPLACE "^Qt::" "${QT_CMAKE_EXPORT_NAMESPACE}::")
qt_internal_wrap_private_modules(arg_LIBRARIES ${arg_LIBRARIES})
# Set-up the target
@ -231,6 +232,9 @@ function(qt_internal_extend_target target)
)
endif()
set(all_libraries ${arg_LIBRARIES} ${arg_PUBLIC_LIBRARIES})
qt_internal_work_around_autogen_discarded_dependencies(${target} ${all_libraries})
if(QT_GENERATE_SBOM)
set(sbom_args "")
_qt_internal_forward_function_args(
@ -257,6 +261,9 @@ function(qt_internal_extend_target target)
if(TARGET "${target_private}")
target_link_libraries("${target_private}"
INTERFACE ${arg_PRIVATE_MODULE_INTERFACE})
qt_internal_register_target_dependencies("${target_private}"
PUBLIC ${arg_PRIVATE_MODULE_INTERFACE}
)
elseif(arg_PRIVATE_MODULE_INTERFACE)
set(warning_message "")
string(APPEND warning_message
@ -266,10 +273,18 @@ function(qt_internal_extend_target target)
"Ensure the target exists or remove the option.")
message(AUTHOR_WARNING "${warning_message}")
endif()
qt_register_target_dependencies("${target}"
"${arg_PUBLIC_LIBRARIES};${arg_PRIVATE_MODULE_INTERFACE}"
"${qt_libs_private};${arg_LIBRARIES}")
set(qt_register_target_dependencies_args "")
if(arg_PUBLIC_LIBRARIES)
list(APPEND qt_register_target_dependencies_args
PUBLIC ${arg_PUBLIC_LIBRARIES})
endif()
if(qt_libs_private OR arg_LIBRARIES)
list(APPEND qt_register_target_dependencies_args
PRIVATE ${qt_libs_private} ${arg_LIBRARIES})
endif()
qt_internal_register_target_dependencies("${target}"
${qt_register_target_dependencies_args})
qt_autogen_tools(${target}
ENABLE_AUTOGEN_TOOLS ${arg_ENABLE_AUTOGEN_TOOLS}
@ -329,6 +344,43 @@ function(qt_internal_extend_target target)
endif()
endfunction()
# Takes an output variable and a list of libraries.
#
# Every library that is a private module is wrapped in $<BUILD_INTERFACE> or
# $<BUILD_LOCAL_INTERFACE> if CMake is new enough.
#
# This is necessary for static builds, because if Qt6Foo links to Qt6BarPrivate, this link
# dependency is purely internal. If we don't do this, CMake adds a target check for Qt6BarPrivate
# in Qt6FooTargets.cmake. This breaks if Qt6BarPrivate is not find_package'ed before.
function(qt_internal_wrap_private_modules out_var)
set(result "")
if(CMAKE_VERSION VERSION_LESS "3.26")
set(wrapper_genex "BUILD_INTERFACE")
else()
set(wrapper_genex "BUILD_LOCAL_INTERFACE")
endif()
foreach(lib IN LISTS ARGN)
if(TARGET "${lib}")
get_target_property(lib_is_private_module ${lib} _qt_is_private_module)
if(lib_is_private_module)
# Add the public module as non-wrapped link dependency. This is necessary for
# targets that link only to the private module. Consumers of this target would then
# get a linker error about missing symbols from that Qt module.
get_target_property(lib_public_module_target ${lib} _qt_public_module_target_name)
list(APPEND result "${INSTALL_CMAKE_NAMESPACE}::${lib_public_module_target}")
# Wrap the private module in BUILD_LOCAL_INTERFACE.
set(lib "$<${wrapper_genex}:${lib}>")
endif()
endif()
list(APPEND result "${lib}")
endforeach()
set("${out_var}" "${result}" PARENT_SCOPE)
endfunction()
# Given CMAKE_CONFIG and ALL_CMAKE_CONFIGS, determines if a directory suffix needs to be appended
# to each destination, and sets the computed install target destination arguments in OUT_VAR.
# Defaults used for each of the destination types, and can be configured per destination type.

View File

@ -232,6 +232,7 @@ function(qt_internal_get_test_arg_definitions optional_args single_value_args mu
QML_IMPORTPATH
TESTDATA
QT_TEST_SERVER_LIST
ANDROID_TESTRUNNER_PRE_TEST_ADB_COMMANDS
${__default_private_args}
${__default_public_args}
PARENT_SCOPE
@ -456,6 +457,8 @@ endfunction()
# The option forces adding the provided TESTDATA to resources.
# MANUAL
# The option indicates that the test is a manual test.
# ANDROID_TESTRUNNER_PRE_TEST_ADB_COMMANDS
# Passes --pre-test-adb-command <command> to androidTestRunner. Android specific argument.
function(qt_internal_add_test name)
qt_internal_get_test_arg_definitions(optional_args single_value_args multi_value_args)
@ -684,6 +687,13 @@ function(qt_internal_add_test name)
if(QT_ENABLE_VERBOSE_DEPLOYMENT OR build_environment STREQUAL "ci")
list(APPEND extra_test_args "--verbose")
endif()
if(arg_ANDROID_TESTRUNNER_PRE_TEST_ADB_COMMANDS)
foreach(command IN LISTS arg_ANDROID_TESTRUNNER_PRE_TEST_ADB_COMMANDS)
list(APPEND extra_test_args "--pre-test-adb-command" "${command}")
endforeach()
endif()
set(test_working_dir "${CMAKE_CURRENT_BINARY_DIR}")
elseif(QNX)
set(test_working_dir "")
@ -708,7 +718,11 @@ function(qt_internal_add_test name)
set(browser "chrome")
endif()
list(APPEND extra_test_args "--browser=${browser}")
list(APPEND extra_test_args "--browser_args=\"--password-store=basic\"")
if(DEFINED ENV{HEADLESS_CHROME_FOR_TESTING})
list(APPEND extra_test_args "--browser_args=\"--password-store=basic --headless\"")
else()
list(APPEND extra_test_args "--browser_args=\"--password-store=basic\"")
endif()
list(APPEND extra_test_args "--kill_exit")
# Tests may require asyncify if they use exec(). Enable asyncify for
@ -794,18 +808,10 @@ function(qt_internal_add_test name)
)
endif()
# Add a ${target}/check makefile target, to more easily test one test.
set(test_config_options "")
get_cmake_property(is_multi_config GENERATOR_IS_MULTI_CONFIG)
if(is_multi_config)
set(test_config_options -C $<CONFIG>)
endif()
add_custom_target("${testname}_check"
VERBATIM
COMMENT "Running ${CMAKE_CTEST_COMMAND} -V -R \"^${name}$\" ${test_config_options}"
COMMAND "${CMAKE_CTEST_COMMAND}" -V -R "^${name}$" ${test_config_options}
)
# Add a ${target}_check makefile target, to more easily test one test.
# TODO: Note in batch mode testname tests would execute all batched tests defined in name
_qt_internal_make_check_target(${testname} CTEST_TEST_NAME ${name})
# Add appropriate dependencies to the targets as needed
if(TARGET "${name}")
add_dependencies("${testname}_check" "${name}")
if(ANDROID)
@ -902,6 +908,20 @@ function(qt_internal_add_test name)
endif()
endif()
if(MACOS AND NOT CMAKE_GENERATOR STREQUAL "Xcode")
# Add com.apple.security.get-task-allow entitlement to each
# test binary, so we can hook into the Swift crash handling.
if(NOT arg_QMLTEST AND arg_SOURCES)
set(entitlements_file
"${__qt_internal_cmake_apple_support_files_path}/test.entitlements.plist")
add_custom_command(TARGET "${name}"
POST_BUILD COMMAND codesign --sign -
--entitlements "${entitlements_file}"
"$<TARGET_FILE:${name}>"
)
endif()
endif()
qt_internal_add_test_finalizers("${name}")
endfunction()

View File

@ -168,7 +168,10 @@ function(qt_internal_add_tool target_name)
APPEND PROPERTY
EXPORT_PROPERTIES "_qt_package_version")
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.19.0" AND QT_FEATURE_debug_and_release)
get_cmake_property(is_multi_config GENERATOR_IS_MULTI_CONFIG)
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.19.0"
AND QT_FEATURE_debug_and_release
AND is_multi_config)
set_property(TARGET "${target_name}"
PROPERTY EXCLUDE_FROM_ALL "$<NOT:$<CONFIG:${QT_MULTI_CONFIG_FIRST_CONFIG}>>")
endif()
@ -303,7 +306,7 @@ function(qt_internal_add_tool target_name)
${__qt_internal_sbom_multi_args}
)
_qt_internal_extend_sbom(${target_name} ${sbom_args})
qt_internal_extend_qt_entity_sbom(${target_name} ${sbom_args})
endif()
qt_add_list_file_finalizer(qt_internal_finalize_tool ${target_name})
@ -385,6 +388,7 @@ function(qt_export_tools module_name)
# List of package dependencies that need be find_package'd when using the Tools package.
set(package_deps "")
set(third_party_deps "")
# Additional cmake files to install
set(extra_cmake_files "")
@ -397,7 +401,15 @@ function(qt_export_tools module_name)
# e.g. qtwaylandscanner depends on WaylandScanner (non-qt package).
get_target_property(extra_packages "${tool_name}" QT_EXTRA_PACKAGE_DEPENDENCIES)
if(extra_packages)
list(APPEND package_deps "${extra_packages}")
foreach(third_party_dep IN LISTS extra_packages)
list(GET third_party_dep 0 third_party_dep_name)
list(GET third_party_dep 1 third_party_dep_version)
# Assume that all tool thirdparty deps are mandatory.
# TODO: Components are not supported
list(APPEND third_party_deps
"${third_party_dep_name}\\\;FALSE\\\;${third_party_dep_version}\\\;\\\;")
endforeach()
endif()
get_target_property(_extra_cmake_files "${tool_name}" EXTRA_CMAKE_FILES)

View File

@ -7,10 +7,10 @@ function (qt_internal_setup_wasm_target_properties wasmTarget)
target_link_options("${wasmTarget}" INTERFACE
"SHELL:-s MAX_WEBGL_VERSION=2"
"SHELL:-s FETCH=1"
"SHELL:-s WASM_BIGINT=1"
"SHELL:-s STACK_SIZE=5MB")
set(executable_link_flags "-sFETCH")
## wasm64
if (WASM64)
target_compile_options("${wasmTarget}" INTERFACE "SHELL:-s MEMORY64=1" )
@ -99,7 +99,7 @@ function (qt_internal_setup_wasm_target_properties wasmTarget)
set(enable_side_module_if_needed
"$<$<IN_LIST:$<TARGET_PROPERTY:TYPE>,${side_modules}>:SHELL:-s SIDE_MODULE=1>")
set(enable_main_module_if_needed
"$<$<IN_LIST:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:SHELL:-s MAIN_MODULE=1>")
"$<$<IN_LIST:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:SHELL:-sMAIN_MODULE=1 ${executable_link_flags}>")
set(set_shared_module_type_if_needed
"${enable_side_module_if_needed}"
"${enable_main_module_if_needed}"
@ -115,7 +115,7 @@ function (qt_internal_setup_wasm_target_properties wasmTarget)
target_link_options("${wasmTarget}" INTERFACE "${set_shared_module_type_if_needed}")
else()
target_link_options("${wasmTarget}" INTERFACE "SHELL:-s ERROR_ON_UNDEFINED_SYMBOLS=1")
target_link_options("${wasmTarget}" INTERFACE "SHELL:-sERROR_ON_UNDEFINED_SYMBOLS=1 ${executable_link_flags}")
endif()
# Suppress warnings for known issues for developer builds

View File

@ -8,7 +8,7 @@ function(qt_internal_check_msvc_versions)
set(min_msvc_version "1930")
if(MSVC_VERSION VERSION_LESS min_msvc_version)
message(FATAL_ERROR
"Qt requires at least Visual Studio 2019 (MSVC ${min_msvc_version} or newer), "
"Qt requires at least Visual Studio 2022 (MSVC ${min_msvc_version} or newer), "
"you're building against version ${MSVC_VERSION}. "
"You can turn off this version check by setting QT_NO_MSVC_MIN_VERSION_CHECK to ON."
)

View File

@ -50,6 +50,7 @@ The following table describes the mapping of configure options to CMake argument
| -sbom-json-required | -DQT_SBOM_REQUIRE_GENERATE_JSON=ON | Fails the build if Python deps are not found |
| -sbom-verify | -DQT_SBOM_VERIFY=ON | Enables verification of generated SBOMs |
| -sbom-verify-required | -DQT_SBOM_REQUIRE_VERIFY=ON | Fails the build if Python deps are not found |
| -sbomdir <dir> | -DINSTALL_SBOMDIR=<dir> | Installation location of SBOM files. |
| -qtinlinenamespace | -DQT_INLINE_NAMESPACE=ON | Make the namespace specified by -qtnamespace an inline one. |
| -qtnamespace <name> | -DQT_NAMESPACE=<name> | |
| -qtlibinfix <infix> | -DQT_LIBINFIX=<infix> | |

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.get-task-allow</key>
<true/>
</dict>
</plist>

View File

@ -52,8 +52,8 @@ if(QT_USE_VCPKG OR (NOT DEFINED QT_USE_VCPKG AND __qt_initially_configured_use_v
)
endif()
if(NOT VCPKG_CHAINLOAD_TOOLCHAIN_FILE AND QT_CHAINLOAD_TOOLCHAIN_FILE)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${QT_CHAINLOAD_TOOLCHAIN_FILE}" CACHE STRING "")
if(NOT VCPKG_CHAINLOAD_TOOLCHAIN_FILE AND __qt_chainload_toolchain_file)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${__qt_chainload_toolchain_file}" CACHE STRING "")
endif()
set(__qt_chainload_toolchain_file "${__qt_vcpkg_toolchain_file}")

View File

@ -141,6 +141,16 @@ instructions:
maxTimeBetweenOutput: 14400
userMessageOnFailure: >
Failed to run tests.
- type: ExecuteCommand
command: >
cmake -E copy
Testing{{.Env.CI_PATH_SEP}}Temporary{{.Env.CI_PATH_SEP}}LastTest.log
{{.Env.COIN_CTEST_RESULTSDIR}}{{.Env.CI_PATH_SEP}}CTest.log
executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution
ignoreExitCode: false
userMessageOnFailure: >
Failed to copy LastTest.log to testresults directory.
executeOn: always
- type: Group
enable_if:
condition: runtime
@ -155,16 +165,13 @@ instructions:
maxTimeBetweenOutput: 14400
userMessageOnFailure: >
Failed to run tests.
- type: Group
instructions:
- type: ExecuteCommand
command: >
cmake -E copy
Testing{{.Env.CI_PATH_SEP}}Temporary{{.Env.CI_PATH_SEP}}LastTest.log
{{.Env.COIN_CTEST_RESULTSDIR}}{{.Env.CI_PATH_SEP}}CTest.log
executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution
ignoreExitCode: false
ignoreExitCode: true
userMessageOnFailure: >
Failed to copy LastTest.log to testresults directory.
executeOn: always

View File

@ -1,6 +1,7 @@
type: Group
instructions:
- !include "{{qt/qtbase}}/prepare_building_env.yaml"
- !include "{{qt/qtbase}}/prepare_source_sbom_check.yaml"
- type: Group
instructions:
- type: Group

View File

@ -1,6 +1,7 @@
type: Group
instructions:
- !include "{{qt/qtbase}}/prepare_building_env.yaml"
- !include "{{qt/qtbase}}/prepare_source_sbom_check.yaml"
- type: Group
instructions:
- !include "{{qt/qtbase}}/cmake_qtbase_build_instructions.yaml"

View File

@ -0,0 +1,47 @@
type: Group
instructions:
- type: ChangeDirectory
directory: "{{.AgentWorkingDir}}"
- type: EnvironmentVariable
variableName: QTQA_LICHECK_BRANCH
variableValue: "{{ slice .Env.TESTED_MODULE_BRANCH_COIN 5 }}"
enable_if:
condition: runtime
env_var: TESTED_MODULE_BRANCH_COIN
contains_value: "tqtc/"
- type: EnvironmentVariable
variableName: QTQA_LICHECK_BRANCH
variableValue: "{{ .Env.TESTED_MODULE_BRANCH_COIN }}"
disable_if:
condition: runtime
env_var: TESTED_MODULE_BRANCH_COIN
contains_value: "tqtc/"
# The command must not have whitespace directly after any piping,
# as whitespace directly after pipes will be interpreted as part of the command.
- type: ExecuteCommand
command: ["bash", "-c", "git clone --depth=1 -b {{ .Env.QTQA_LICHECK_BRANCH }} git://{{.Env.QT_COIN_GIT_DAEMON}}/qt-project/qt/qtqa qt/qtqa-latest ||git clone --depth=1 -b dev git://{{.Env.QT_COIN_GIT_DAEMON}}/qt-project/qt/qtqa qt/qtqa-latest"]
maxTimeInSeconds: 600
maxTimeBetweenOutput: 600
userMessageOnFailure: >
Failed to clone qtqa sources. Please investigate why.
disable_if:
condition: property
property: host.os
equals_value: Windows
- type: ExecuteCommand
command: ["cmd.exe", "/C", "git clone --depth=1 -b {{ .Env.QTQA_LICHECK_BRANCH }} git://{{.Env.QT_COIN_GIT_DAEMON}}/qt-project/qt/qtqa qt/qtqa-latest ||git clone --depth=1 -b dev git://{{.Env.QT_COIN_GIT_DAEMON}}/qt-project/qt/qtqa qt/qtqa-latest"]
executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution
maxTimeInSeconds: 600
maxTimeBetweenOutput: 600
userMessageOnFailure: >
Failed to clone qtqa sources. Please investigate why.
enable_if:
condition: property
property: host.os
equals_value: Windows
- type: EnvironmentVariable
variableName: QT_MODULE_TO_TEST
variableValue: "{{.SourceDir}}"
userMessageOnFailure: >
Failed to set QT_MODULE_TO_TEST environment variable. This should not happen.

View File

@ -0,0 +1,52 @@
type: Group
instructions:
# need qemu toolchains update to have perl script verifying source SBOM
- type: Group
instructions:
- type: EnvironmentVariable
variableName: VERIFY_SOURCE_SBOM
variableValue: "OFF"
enable_if:
condition: and
conditions:
- condition: property
property: host.os
equals_value: Linux
- condition: property
property: target.arch
equals_value: MIPS64
- type: Group
instructions:
- type: EnvironmentVariable
variableName: VERIFY_SOURCE_SBOM
variableValue: "OFF"
enable_if:
condition: and
conditions:
- condition: property
property: host.os
equals_value: Windows
- condition: property
property: target.arch
equals_value: AARCH64
- type: Group
instructions:
- !include "{{qt/qtbase}}/prepare_license_test.yaml"
- type: Group
instructions:
- type: EnvironmentVariable
variableName: QT_QA_LICENSE_TEST_DIR
variableValue: "{{.AgentWorkingDir}}"
- type: EnvironmentVariable
variableName: QT_SOURCE_SBOM_TEST_SCRIPT
variableValue: "qt{{.Env.CI_PATH_SEP}}qtqa-latest{{.Env.CI_PATH_SEP}}tests{{.Env.CI_PATH_SEP}}prebuild{{.Env.CI_PATH_SEP}}license{{.Env.CI_PATH_SEP}}tst_licenses.pl"
userMessageOnFailure: >
Failed to set QT_SOURCE_SBOM_TEST_SCRIPT environment variable. This should not happen.
enable_if:
condition: property
property: features
contains_value: GenerateSBOM

View File

@ -1,35 +1,6 @@
type: Group
instructions:
- type: ChangeDirectory
directory: "{{.AgentWorkingDir}}"
- type: EnvironmentVariable
variableName: QTQA_LICHECK_BRANCH
variableValue: "{{ slice .Env.TESTED_MODULE_BRANCH_COIN 5 }}"
enable_if:
condition: runtime
env_var: TESTED_MODULE_BRANCH_COIN
contains_value: "tqtc/"
- type: EnvironmentVariable
variableName: QTQA_LICHECK_BRANCH
variableValue: "{{ .Env.TESTED_MODULE_BRANCH_COIN }}"
disable_if:
condition: runtime
env_var: TESTED_MODULE_BRANCH_COIN
contains_value: "tqtc/"
# The command must not have whitespace directly after any piping,
# as whitespace directly after pipes will be interpreted as part of the command.
- type: ExecuteCommand
command: ["bash", "-c", "git clone --depth=1 -b {{ .Env.QTQA_LICHECK_BRANCH }} git://{{.Env.QT_COIN_GIT_DAEMON}}/qt-project/qt/qtqa qt/qtqa-latest ||git clone --depth=1 -b dev git://{{.Env.QT_COIN_GIT_DAEMON}}/qt-project/qt/qtqa qt/qtqa-latest"]
maxTimeInSeconds: 600
maxTimeBetweenOutput: 600
userMessageOnFailure: >
Failed to clone qtqa sources. Please investigate why.
- type: EnvironmentVariable
variableName: QT_MODULE_TO_TEST
variableValue: "{{.SourceDir}}"
userMessageOnFailure: >
Failed to set QT_MODULE_TO_TEST environment variable. This should not happen.
- !include "{{qt/qtbase}}/prepare_license_test.yaml"
- type: ExecuteCommand
command: perl qt/qtqa-latest/tests/prebuild/license/tst_licenses.pl
maxTimeInSeconds: 7200

View File

@ -10,7 +10,7 @@ instructions:
testdir="$(dirname $1)"
testexecutable="$1"
echo RUNNING via serial: "$quoted_args"
echo "cmd rtp exec -p 200 -t 0x01000000 -u 1000000 $testexecutable -- $quoted_args" > /home/qt/work/vx.sh
echo "cmd rtp exec -p 200 -t 0x01000000 -u 0x1000000 $testexecutable -- $quoted_args" > /home/qt/work/vx.sh
echo "cmd echo \"qtest_in_vxworks_complete: $?\"" >> /home/qt/work/vx.sh
#rtp exec Execute a process.
# -p : specify the initial task priority
@ -22,11 +22,17 @@ instructions:
# qtest_in_vxworks_complete echo is used to detect test process completion as it will
# be echoed after test process ends normally or crashes when normal log lines are not present.
# Check that emulator is functioning
echo "cmd echo \"health check\"" > /tmp/guest.in
sleep 0.5
read -t 5 echoline</tmp/guest.out
read -t 1 testline</tmp/guest.out
( echo "cmd echo \"health check\"" > /tmp/guest.in ) & pid=$!
( sleep 5 && kill -HUP $pid ) 2>/dev/null & watcher=$!
wait $pid 2>/dev/null && pkill -HUP -P $watcher
if [[ "$?" -eq "0" ]]; then
read -t 5 echoline</tmp/guest.out
read -t 1 testline</tmp/guest.out
fi
if [[ -z "$testline" ]]; then
echo "Restarting stuck emulator"
pkill qemu-system
@ -58,4 +64,16 @@ instructions:
exitcode=$(echo "$line" | sed -nr 's/qtest_in_vxworks_complete: (-?[0-9]+)/\1/gp' | tr -d '\r')
exit $exitcode
fi
# Handle crashes
if echo "$line" | /usr/bin/grep -qE "(SIGSEGV)|(SIGABRT)|(S_rtpLib_[A-Z_]+)"
then
# Empty output pipe
while read -t 1 line; do
echo $line
done < /tmp/guest.out
echo "Test crashed"
pkill qemu-system # Kill emulator to force restart on next test start
exit 1
fi
done < /tmp/guest.out

View File

@ -1,4 +1,5 @@
version: 2
tags: [git]
accept_configuration:
condition: property
property: features
@ -11,7 +12,12 @@ machine_type:
cores: 4
instructions:
Build:
# to be turned on when the module source SBOM pass the license check
- type: EnvironmentVariable
variableName: VERIFY_SOURCE_SBOM
variableValue: "ON"
- !include "{{qt/qtbase}}/coin_qtbase_build_template_v2.yaml"
Test:

View File

@ -90,12 +90,12 @@ if not defined redoing (
rem "into the file from a stream different than stdout, leading to broken or empty content."
echo.%* >"%OPT_TMP_FILE_PATH%"
cmake -DIN_FILE="%OPT_TMP_FILE_PATH%" -DOUT_FILE="%OPT_FILE_PATH%" -DIGNORE_ARGS=-top-level -P "%QTSRC%\cmake\QtWriteArgsFile.cmake"
call cmake -DIN_FILE="%OPT_TMP_FILE_PATH%" -DOUT_FILE="%OPT_FILE_PATH%" -DIGNORE_ARGS=-top-level -P "%QTSRC%\cmake\QtWriteArgsFile.cmake"
) else (
echo. 2> "%OPT_TMP_FILE_PATH%"
for /F "usebackq tokens=*" %%A in ("%OPT_FILE_PATH%") do echo "%%A" >> "%OPT_TMP_FILE_PATH%"
cmake -DIN_FILE="%OPT_TMP_FILE_PATH%" -DREDO_FILE="%REDO_TMP_FILE_PATH%" -DOUT_FILE="%REDO_FILE_PATH%" -DIGNORE_ARGS="-top-level;-redo;--redo" -P "%QTSRC%\cmake\QtWriteArgsFile.cmake"
call cmake -DIN_FILE="%OPT_TMP_FILE_PATH%" -DREDO_FILE="%REDO_TMP_FILE_PATH%" -DOUT_FILE="%REDO_FILE_PATH%" -DIGNORE_ARGS="-top-level;-redo;--redo" -P "%QTSRC%\cmake\QtWriteArgsFile.cmake"
set OPT_FILE_PATH=%REDO_FILE_PATH%
set FRESH_REQUESTED_ARG=-DFRESH_REQUESTED=TRUE
@ -104,4 +104,4 @@ if not defined redoing (
rem Launch CMake-based configure
set TOP_LEVEL_ARG=
if %TOPLEVEL% == true set TOP_LEVEL_ARG=-DTOP_LEVEL=TRUE
cmake -DOPTFILE="%OPT_FILE_PATH%" %TOP_LEVEL_ARG% %FRESH_REQUESTED_ARG% -P "%QTSRC%\cmake\QtProcessConfigureArgs.cmake"
call cmake -DOPTFILE="%OPT_FILE_PATH%" %TOP_LEVEL_ARG% %FRESH_REQUESTED_ARG% -P "%QTSRC%\cmake\QtProcessConfigureArgs.cmake"

View File

@ -580,6 +580,10 @@ qt_feature("no-prefix"
AUTODETECT NOT QT_WILL_INSTALL
CONDITION NOT QT_WILL_INSTALL
)
qt_feature("lint_generated_code"
LABEL "Lint qt-generated code"
AUTODETECT QT_FEATURE_developer_build
)
qt_feature("private_tests" PRIVATE
LABEL "Developer build: private_tests"
CONDITION QT_FEATURE_developer_build

View File

@ -7,4 +7,5 @@ macro.relatesto = "\\relates"
spurious = "Missing comma in .*" \
"Missing pattern .*" \
"Unable to parse (QML|JavaScript).*"
"Unable to parse (QML|JavaScript).*" \
"Unknown base .*"

View File

@ -15,6 +15,9 @@ productname = Qt
navigation.homepage = index.html
navigation.hometitle = "$productname $QT_VER"
# Set trademarks page (located in qt/qtdoc)
navigation.trademarkspage = Trademarks
#Words to ignore for auto-linking
ignorewords += \
macOS \

View File

@ -1,7 +1,7 @@
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\externalpage https://source.android.com/setup/start/build-numbers
\externalpage https://source.android.com/docs/setup/reference/build-numbers
\title Android: Build Numbers
*/
/*!
@ -17,7 +17,7 @@
\title Android: App Versioning
*/
/*!
\externalpage https://developer.android.com/studio/command-line/adb#devicestatus
\externalpage https://developer.android.com/tools/adb#devicestatus
\title Android: Query for devices
*/
/*!
@ -25,17 +25,21 @@
\title Android: Create Deep Links to App Content
*/
/*!
\externalpage https://developer.android.com/training/app-links/verify-site-associations
\externalpage https://developer.android.com/training/app-links/verify-android-applinks
\title Android: Verify Android App Links
*/
/*!
\externalpage https://source.android.com/devices/tech/debug/tagged-pointers
\externalpage https://source.android.com/docs/security/test/tagged-pointers
\title Android: Tagged Pointers
*/
/*!
\externalpage https://developer.android.com/build/configure-app-module
\title Android: Configure the app module
*/
/*!
\externalpage https://developer.android.com/ndk/guides/ndk-stack
\title Android: ndk-stack
*/
/*!
\externalpage https://developer.apple.com/documentation/uikit/uiapplication/1622952-canopenurl
\title iOS: canOpenURL:
@ -49,33 +53,33 @@
\title iOS: Supporting Associated Domains
*/
/*!
\externalpage http://www.freedesktop.org/
\externalpage https://www.freedesktop.org/wiki/
\title freedesktop.org
*/
/*!
\externalpage http://www.freedesktop.org/Standards/xembed-spec
\externalpage https://www.freedesktop.org/wiki/Standards/xembed-spec/
\title XEmbed Specification
*/
/*!
\externalpage http://www.freedesktop.org/Standards/icon-theme-spec
\externalpage https://www.freedesktop.org/wiki/Standards/icon-theme-spec/
\title Icon Themes Specification
*/
/*!
\externalpage http://www.cups.org/
\externalpage https://www.cups.org/
\title Common Unix Printing System (CUPS)
\keyword CUPS
*/
/*!
\externalpage http://www.freedesktop.org/wiki/Standards_2fdesktop_2dentry_2dspec
\externalpage https://www.freedesktop.org/wiki/Specifications/desktop-entry-spec/
\title Desktop Entry Specification
*/
/*!
\externalpage http://www.kde.org/
\externalpage https://kde.org/
\title The K Desktop Environment
\keyword KDE
*/
@ -131,38 +135,38 @@
*/
/*!
\externalpage http://www.gnome.org/
\externalpage https://www.gnome.org/
\title GNOME
*/
/*!
\externalpage http://www.gnu.org/software/emacs/
\externalpage https://www.gnu.org/software/emacs/
\title GNU Emacs
*/
/*!
\externalpage http://gnuwin32.sourceforge.net/packages.html
\externalpage https://gnuwin32.sourceforge.net/packages.html
\title GnuWin32 Project
*/
/*!
\externalpage http://www.w3.org/Graphics/SVG/About.html
\externalpage https://www.w3.org/Graphics/SVG/About.html
\title About SVG
\keyword Scalable Vector Graphics
*/
/*!
\externalpage http://www.w3.org/TR/SVG/types.html#ColorKeywords
\externalpage https://www.w3.org/TR/SVG/types.html#ColorKeywords
\title SVG color keyword names
*/
/*!
\externalpage http://www.w3.org/Graphics/SVG/
\externalpage https://www.w3.org/Graphics/SVG/
\title SVG Working Group
*/
/*!
\externalpage http://www.w3.org/TR/SVGMobile/
\externalpage https://www.w3.org/TR/SVGMobile/
\title Mobile SVG Profiles
\omit
Mobile SVG Profiles: SVG Tiny and SVG Basic
@ -170,49 +174,44 @@
*/
/*!
\externalpage http://www.w3.org/TR/SVGMobile12/
\externalpage https://www.w3.org/TR/SVGMobile12/
\title SVG 1.2 Tiny
*/
/*!
\externalpage http://www.w3.org/Graphics/SVG/feature/1.2/#SVG-static
\externalpage https://www.w3.org/Graphics/SVG/feature/1.2/#SVG-static
\title SVG 1.2 Tiny Static Features
*/
/*!
\externalpage http://tdm-gcc.tdragon.net/
\externalpage https://jmeubank.github.io/tdm-gcc/
\title TDM-GCC
*/
/*!
\externalpage http://www.dependencywalker.com/
\externalpage https://www.dependencywalker.com/
\title Dependency Walker
*/
/*!
\externalpage http://webkit.org/
\externalpage https://webkit.org/
\title WebKit Open Source Project
*/
/*!
\externalpage http://www.informit.com/store/product.aspx?isbn=0132354160
\externalpage https://www.informit.com/store/c-plus-plus-gui-programming-with-qt4-9780132354165
\title C++ GUI Programming with Qt 4, 2nd Edition
*/
/*!
\externalpage http://www.openssl.org/
\externalpage https://www.openssl.org/
\title OpenSSL Toolkit
*/
/*!
\externalpage http://arora-browser.org/
\title Arora Browser
*/
/*!
\externalpage http://www.activestate.com/Products/activeperl/index.mhtml
\externalpage https://www.activestate.com/platform/supported-languages/perl/
\title ActivePerl
*/
@ -222,297 +221,192 @@
*/
/*!
\externalpage https://docs.microsoft.com/en-us/windows/win32/winsock/socket-handles-2
\externalpage https://learn.microsoft.com/en-us/windows/win32/winsock/socket-handles-2
\title Winsock 2 Socket Handle
*/
/*!
\externalpage http://www.w3.org/TR/html401/
\externalpage https://www.w3.org/TR/html401/
\title HTML 4
*/
/*!
\externalpage http://www.w3.org/TR/html5/
\externalpage https://html.spec.whatwg.org/multipage/
\title HTML 5
*/
/*!
\externalpage http://site.icu-project.org/
\externalpage https://icu.unicode.org/
\title ICU
*/
/*!
\externalpage https://mingw-w64.org/
\externalpage https://www.mingw-w64.org/
\title MinGW
*/
/*!
\externalpage http://www.python.org/
\externalpage https://www.python.org/
\title Python
*/
/*!
\externalpage http://pyxml.sourceforge.net/topics/xbel/
\externalpage https://pyxml.sourceforge.net/topics/xbel/
\title XML Bookmark Exchange Language Resource Page
*/
/*!
\externalpage http://www.w3.org/TR/xquery/#errors
\externalpage https://www.w3.org/TR/xquery/#errors
\title error handling in the XQuery language
*/
/*!
\externalpage http://xaos.sourceforge.net/
\externalpage https://xaos-project.github.io/
\title XaoS
*/
/*!
\externalpage http://www.unixodbc.org
\title http://www.unixodbc.org
\externalpage https://www.unixodbc.org
\title https://www.unixodbc.org
*/
/*!
\externalpage http://www.postgresql.org
\title http://www.postgresql.org
\externalpage https://www.postgresql.org
\title https://www.postgresql.org
*/
/*!
\externalpage http://www.postgresql.org/docs/current/static/installation-platform-notes.html#INSTALLATION-NOTES-MINGW
\externalpage https://www.postgresql.org/docs/current/installation-platform-notes.html
\title PostgreSQL MinGW/Native Windows
*/
/*!
\externalpage http://www.freetds.org
\title http://www.freetds.org
\externalpage https://www.freetds.org
\title https://www.freetds.org
*/
/*!
\externalpage http://www.sybase.com
\title http://www.sybase.com
\externalpage https://www.sqlite.org
\title https://www.sqlite.org
*/
/*!
\externalpage http://linux.sybase.com
\title http://linux.sybase.com
*/
/*!
\externalpage http://www.sqlite.org
\title http://www.sqlite.org
*/
/*!
\externalpage http://www.amazon.com/Threads-Primer-Guide-Multithreaded-Programming/dp/0134436989/ref=sr_1_1?ie=UTF8&qid=1354884049&sr=8-1&keywords=a+guide+to+multithreaded+programming
\title Threads Primer: A Guide to Multithreaded Programming
*/
/*!
\externalpage http://www.amazon.com/Thread-Time-MultiThreaded-Programming-Guide/dp/0131900676/ref=sr_1_sc_3?ie=UTF8&qid=1354884427&sr=8-3-spell&keywords=The+Mulltithread+Programming+Guide
\title Thread Time: The Multithreaded Programming Guide
*/
/*!
\externalpage http://www.amazon.com/Pthreads-Programming-Standard-Multiprocessing-Nutshell/dp/1565921151/ref=sr_1_1?s=books&ie=UTF8&qid=1354884565&sr=1-1&keywords=threads+Programming%3A+A+POSIX+Standard+for+Better+Multiprocessing
\title Pthreads Programming: A POSIX Standard for Better Multiprocessing
*/
/*!
\externalpage http://www.amazon.com/Win32-Multithreaded-Programming-Aaron-Cohen/dp/B00007GW3Z/ref=sr_1_1?s=books&ie=UTF8&qid=1354884647&sr=1-1&keywords=Win32+Multithreaded+Programming
\title Win32 Multithreaded Programming
*/
/*!
\externalpage http://www.phptr.com/content/images/0131872494/samplechapter/blanchette_ch10.pdf
\title "Item View Classes" Chapter of C++ GUI Programming with Qt 4
*/
/*!
\externalpage https://developer.apple.com/library/mac/#documentation/UserExperience/Conceptual/AppleHIGuidelines/Intro/Intro.html
\title Mac OS X Aqua
*/
/*!
\externalpage http://www.kdedevelopers.org/node/2345
\title KDE applications
*/
/*!
\externalpage https://web.archive.org/web/20020803110822/http://wp.netscape.com/newsref/std/cookie_spec.html
\externalpage https://web.archive.org/web/20020803110822/https://wp.netscape.com/newsref/std/cookie_spec.html
\title Netscape Cookie Specification
*/
/*!
\externalpage https://docs.microsoft.com/en-us/previous-versions//ms533046(v=vs.85)
\externalpage https://learn.microsoft.com/en-us/previous-versions/ms533046(v=vs.85)
\title Mitigating Cross-site Scripting With HTTP-only Cookies
*/
/*!
\externalpage http://en.tldp.org/HOWTO/Framebuffer-HOWTO.html
\externalpage https://tldp.org/HOWTO/Framebuffer-HOWTO.html
\title Framebuffer HOWTO
*/
/*!
\externalpage http://wap.trafikanten.no
\title Trafikanten
*/
/*!
\externalpage http://www.w3.org/TR/scxml/
\externalpage https://www.w3.org/TR/scxml/
\title State Chart XML: State Machine Notation for Control Abstraction
*/
/*!
\externalpage http://www.wisdom.weizmann.ac.il/~dharel/SCANNED.PAPERS/Statecharts.pdf
\externalpage https://www.weizmann.ac.il/math/harel/sites/math.harel/files/users/user56/Statecharts.pdf
\title Statecharts: A visual formalism for complex systems
*/
/*!
\externalpage http://www.gnu.org/licenses/gpl.html
\externalpage https://www.gnu.org/licenses/gpl-3.0.html
\title GNU General Public License
*/
/*!
\externalpage http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
\externalpage https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
\title GNU Lesser General Public License, version 2.1
*/
/*!
\externalpage http://developers.sun.com/sunstudio/downloads/patches/index.jsp
\title Sun Studio Patches
*/
/*!
\externalpage http://www.qtcentre.org
\externalpage https://www.qtcentre.org
\title Qt Centre
*/
/*!
\externalpage http://www.kde.org
\externalpage https://kde.org
\title KDE
*/
/*!
\externalpage http://www.directfb.org/index.php?path=Main%2FDownloads&amp;page=1
\title DirectFB - df_window example
*/
/*!
\externalpage http://www.directfb.org/docs/DirectFB_Reference_1_4/IDirectFBPalette.html
\title DirectFB - IDirectFBPalette
*/
/*!
\externalpage http://www.cplusplus.com/reference/clibrary/cstring/memcpy/
\externalpage https://cplusplus.com/reference/cstring/memcpy/
\title C++ Reference - memcpy
*/
/*!
\externalpage http://www.directfb.org/docs/DirectFB_Reference_1_4/IDirectFB_CreateInputEventBuffer.html
\title DirectFB - CreateInputEventBuffer
*/
/*!
\externalpage http://www.directfb.org/docs/DirectFB_Reference_1_4/types.html#DFBSurfaceBlittingFlags
\title DirectFB - DFBSurfaceBlittingFlags
*/
/*!
\externalpage http://directfb.org/docs/DirectFB_Reference_1_4/IDirectFBImageProvider.html
\title DirectFB - IDirectFBImageProvider
*/
/*!
\externalpage http://www.directfb.org/docs/DirectFB_Reference_1_4/IDirectFBSurface.html
\title DirectFB - IDirectFBSurface
*/
/*!
\externalpage http://www.directfb.org/docs/DirectFB_Reference_1_4/IDirectFBWindow
\title DirectFB - IDirectFBWindow
*/
/*!
\externalpage http://www.directfb.org/docs/DirectFB_Reference_1_4/types.html#DFBSurfaceDescription
\title DirectFB - DFBSurfaceDescription
*/
/*!
\externalpage http://www.w3.org/TR/REC-CSS2/selector.html#q1
\externalpage https://www.w3.org/TR/CSS2/selector.html
\title Standard CSS2 selector
*/
/*!
\externalpage http://www.w3.org/XML/Core/#Publications
\externalpage https://www.w3.org/XML/Core/#Publications
\title W3C XML specifications
*/
/*!
\externalpage http://www.w3.org/XML/Schema
\externalpage https://www.w3.org/XML/Schema
\title XML Schema
*/
/*!
\externalpage http://opensource.org/licenses/bsd-license.php
\externalpage https://opensource.org/license/bsd-3-clause
\title New and Modified BSD Licenses
*/
/*!
\externalpage http://www.ecma-international.org/publications/standards/Ecma-262.htm
\externalpage https://ecma-international.org/publications-and-standards/standards/ecma-262/
\title ECMAScript Language Specification
*/
/*!
\externalpage https://developer.mozilla.org/en/JavaScript
\externalpage https://developer.mozilla.org/en-US/docs/Web/JavaScript
\title JavaScript Resources
*/
/*!
\externalpage https://developer.mozilla.org/en/JavaScript/Guide
\externalpage https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide
\title JavaScript Guide
*/
/*!
\externalpage https://developer.mozilla.org/en/JavaScript/About_JavaScript
\externalpage https://developer.mozilla.org/en-US/docs/Web/JavaScript
\title About JavaScript
*/
/*!
\externalpage http://www.libusb.org/
\title libusb
*/
/*!
\externalpage https://developer.mozilla.org/en/JavaScript/Reference/Reserved_Words
\externalpage https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#keywords
\title JavaScript Reserved Words
*/
/*!
\externalpage http://publicsuffix.org/
\externalpage https://publicsuffix.org/
\title publicsuffix.org
*/
/*!
\externalpage http://accessibility.linuxfoundation.org/a11yspecs/ia2/docs/html/_accessible_event_i_d_8idl.html
\externalpage https://accessibility.linuxfoundation.org/a11yspecs/ia2/docs/html/_accessible_event_i_d_8idl.html
\title AccessibleEventID.idl File Reference
*/
/*!
\externalpage https://docs.microsoft.com/en-us/windows/win32/winauto/event-constants
\externalpage https://learn.microsoft.com/en-us/windows/win32/winauto/event-constants
\title Microsoft Active Accessibility Event Constants
*/
/*!
\externalpage ftp://ftp.qt-project.org/pub/qt/solutions/lgpl/qtmotifextension-2.7_1-opensource.tar.gz
\title Motif Extension
*/
/*!
\externalpage http://www.opengl.org/registry/
\externalpage https://registry.khronos.org/OpenGL/index_gl.php
\title OpenGL Registry
*/
/*!
\externalpage http://www.khronos.org/registry/gles/
\externalpage https://registry.khronos.org/OpenGL/index_es.php
\title Khronos OpenGL ES API Registry
*/
@ -527,22 +421,22 @@
*/
/*!
\externalpage http://www.w3.org/TR/2009/WD-webdatabase-20091029/
\externalpage https://www.w3.org/TR/2009/WD-webdatabase-20091029/
\title HTML5 Web Database API
*/
/*!
\externalpage http://lldb.llvm.org/
\externalpage https://lldb.llvm.org/
\title The LLDB Debugger
*/
/*!
\externalpage https://login.qt.io/
\externalpage https://account.qt.io/s/
\title Qt Account Sign-up
*/
/*!
\externalpage http://facebook.github.io/zstd/
\externalpage https://facebook.github.io/zstd/
\title Zstandard Site
*/
@ -552,7 +446,7 @@
*/
/*!
\externalpage https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessw
\externalpage https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessw
\title CreateProcess
*/
@ -577,6 +471,6 @@
*/
/*!
\externalpage https://specifications.freedesktop.org/trash-spec/trashspec-1.0.html
\externalpage https://specifications.freedesktop.org/trash-spec/1.0/
\title FreeDesktop.org Trash specification version 1.0
*/

View File

@ -84,11 +84,6 @@
\title RFC 4122
*/
/*!
\externalpage https://datatracker.ietf.org/doc/html/rfc4627
\title RFC 4627
*/
/*!
\externalpage https://datatracker.ietf.org/doc/html/rfc4648
\title RFC 4648
@ -174,6 +169,11 @@
\title RFC 8152
*/
/*!
\externalpage https://datatracker.ietf.org/doc/html/rfc8259
\title RFC 8259
*/
/*!
\externalpage https://datatracker.ietf.org/doc/html/rfc8446#section-6
\title RFC 8446, section 6

View File

@ -7,8 +7,6 @@ HTML.tocdepth = 2
HTML.extraimages += template/images/arrow_bc.png \
template/images/home.png \
template/images/ico_out.png \
template/images/ico_note.png \
template/images/ico_note_attention.png \
template/images/btn_prev.png \
template/images/btn_next.png \
template/images/bullet_dn.png \
@ -22,8 +20,6 @@ HTML.extraimages += template/images/arrow_bc.png \
images/arrow_bc.png \
images/home.png \
images/ico_out.png \
images/ico_note.png \
images/ico_note_attention.png \
images/btn_prev.png \
images/btn_next.png \
images/bullet_dn.png \

View File

@ -37,9 +37,9 @@
# \endtabcontent
# \endif
macro.tab.HTML = "<input type=\"radio\" name=\"tabs_\1\" id=\"\2\" \4/><label for=\"\2\">\3</label><style>#\2:checked ~ .\2{display: block;}</style>"
macro.tabcontent.HTML = "<div class=\"tabcontent \1\">"
macro.endtabcontent.HTML = "</div>"
macro.tab.HTML = "<input type=\"radio\" name=\"tabs_\1\" id=\"\2\" \4/><label for=\"\2\">\3</label>\n<style>#\2:checked ~ .\2{display: block;}</style>\n"
macro.tabcontent = "\\div {class=\"tabcontent \1\"}"
macro.endtabcontent = "\\enddiv"
HTML.extraimages += template/style/htmltabs.css

View File

@ -81,6 +81,7 @@ macro.QQV = "Qt QML Viewer"
macro.QtAA = "Qt for Android Automotive"
macro.QUL = "Qt Quick Ultralite"
macro.QtTAS = "Qt Tools for Android Studio"
macro.Q4A = "Qt for Android"
# The following macros are used for various Android docs. The purpose is to keep
# it as simple as updating these instead of updating multiple lines in scattered locations.
@ -90,11 +91,11 @@ macro.NdkFullVer = "26.1.10909125"
macro.NdkCompilerVer = "Clang 17.0.2"
macro.JdkVer = "17"
macro.AndroidMinApiVer = "28"
macro.AndroidMaxApiVer = "34"
macro.AndroidMaxApiVer = "35"
macro.AndroidMinVer = "9"
macro.AndroidMaxVer = "14"
macro.AndroidPlatformVer = "34"
macro.AndroidBuildToolsVer = "34.0.0"
macro.AndroidMaxVer = "15"
macro.AndroidPlatformVer = "35"
macro.AndroidBuildToolsVer = "35.0.1"
macro.GradleVer = "8.10"
macro.AGPVer = "8.6.0"
macro.AAOSVer = "10 to 13"
@ -126,8 +127,9 @@ macro.QtMinorVersion.match = "\\d+\\.(\\d+)"
# along with the offline docs, you must specify it manually. In .qdocconf, to do it for all formats
# at once, add:
#
# {HTML.extraimages,qhp.QtDoc.extraFiles, DocBook.extraimages} += images/dQw4w9WgXcQ.jpg
# {HTML.extraimages,qhp.<qhp_project>.extraFiles,DocBook.extraimages} += images/dQw4w9WgXcQ.jpg
#
# Where <qhp_project> is a project name listed in `qhp.projects`.
macro.youtube.HTML = "<div class=\"video\">\n" \
"<a href=\"https://www.youtube.com/watch/?v=\1\">\n"\
"<img src=\"images/\1.jpg\"" \
@ -145,6 +147,11 @@ macro.youtube.DocBook = "<db:mediaobject>\n" \
"</db:imageobject>\n" \
"</db:mediaobject>\n"
#
# C++ constrained function templates
#
macro.constraints = "\\section1 Constraints\n\nParticipates in overload resolution only if "
macro.excludefromcreator = "\\meta tag broken"
macro.preliminarycmakecommand = "\\note This command is in technology preview and may change in future releases."

View File

@ -35,7 +35,7 @@ manifestmeta.highlighted.attributes = isHighlighted:true
manifestmeta.android.names = "Qt3D/Qt 3D: Basic Shapes C++ Example" \
"Qt3D/Qt 3D: Planets QML Example" \
"Qt3D/Qt 3D: Simple Custom Material QML Example" \
"QtCore/Qt Android Notifier" \
"QtCore/Qt for Android Notifier" \
"QtBluetooth/Bluetooth Low Energy Scanner Example" \
"QtBluetooth/Bluetooth Scanner Example" \
"QtBluetooth/QML Bluetooth Scanner Example" \

View File

@ -11,8 +11,6 @@ defines += offlinedocs
HTML.stylesheets = template/style/offline.css \
template/style/offline-dark.css
HTML.extraimages += template/images/ico_out.png \
template/images/ico_note.png \
template/images/ico_note_attention.png \
template/images/btn_prev.png \
template/images/btn_next.png \
template/images/bullet_dn.png \
@ -25,8 +23,6 @@ sourcedirs += includes
qhp.extraFiles += style/offline.css \
style/offline-dark.css \
images/ico_out.png \
images/ico_note.png \
images/ico_note_attention.png \
images/btn_prev.png \
images/btn_next.png \
images/bullet_dn.png \
@ -35,8 +31,6 @@ qhp.extraFiles += style/offline.css \
DocBook.extraimages += \
images/ico_out.png \
images/ico_note.png \
images/ico_note_attention.png \
images/btn_prev.png \
images/btn_next.png \
images/bullet_dn.png \

Binary file not shown.

Before

Width:  |  Height:  |  Size: 649 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 529 B

View File

@ -5,7 +5,7 @@ body {
text-align: left;
margin-left: 5px;
margin-right: 5px;
background-color: #2E2F30;
background-color: #262626;
color: #d0d0d0
}
@ -60,7 +60,7 @@ links
*/
a:link {
color: #9a9ef9;
color: #1ec974;
text-decoration: none;
text-align: left;
}
@ -71,18 +71,18 @@ a.qa-mark:target:before {
}
a:hover {
color: #9a9ef9;
color: #1ec974;
text-decoration:underline;
text-align: left;
}
a:visited {
color: #9a9ef9;
color: #1ec974;
text-align: left;
}
a:visited:hover {
color: #9a9ef9;
color: #1ec974;
text-align: left;
}
@ -123,11 +123,11 @@ NOTE styles
}
.admonition.note, .admonition.important {
background: #353637 3px 6px no-repeat url(../images/ico_note.png);
background: #353637 3px 6px no-repeat;
}
.admonition.warning {
background: #353637 3px 6px no-repeat url(../images/ico_note_attention.png);
background: #353637 3px 6px no-repeat);
}
/*
-------------------------------
@ -312,7 +312,7 @@ headers
position: absolute;
right: 0;
top: 0;
background-color: #2E2F30;
background-color: #262626;
border-bottom: 1px #404142 solid;
font-weight: bold;
margin-left: 0px;
@ -405,9 +405,9 @@ table styles
.table img {
border: none;
margin-left: 0px;
-moz-box-shadow: 0px 0px 0px #2E2F30;
-webkit-box-shadow: 0px 0px 0px #2E2F30;
box-shadow: 0px 0px 0px #2E2F30;
-moz-box-shadow: 0px 0px 0px #262626;
-webkit-box-shadow: 0px 0px 0px #262626;
box-shadow: 0px 0px 0px #262626;
}
/* table with border alternative colors*/
@ -426,7 +426,7 @@ table, pre, .LegaleseLeft {
}
table tr.even {
background-color: #2E2F30;
background-color: #262626;
color: #a4a6a8;
}
@ -442,7 +442,7 @@ table, pre, .LegaleseLeft {
table thead {
text-align: left;
padding-left: 20px;
background-color: #2E2F30;
background-color: #262626;
border-left: none;
border-right: none;
}
@ -477,18 +477,18 @@ table, pre, .LegaleseLeft {
.borderless {
border-radius: 0px 0px 0px 0px;
background-color: #2E2F30;
border: 1px solid #2E2F30;
background-color: #262626;
border: 1px solid #262626;
}
.borderless tr {
background-color: #2E2F30;
background-color: #262626;
color: #d0d0d0;
}
.borderless td {
border: none;
border-bottom: #2E2F30 dotted 1px;
border-bottom: #262626 dotted 1px;
}
/*

View File

@ -120,11 +120,11 @@ NOTE styles
}
.admonition.note, .admonition.important {
background: #f2f2f2 3px 6px no-repeat url(../images/ico_note.png);
background: #f2f2f2 3px 6px no-repeat;
}
.admonition.warning {
background: #f2f2f2 3px 6px no-repeat url(../images/ico_note_attention.png);
background: #f2f2f2 3px 6px no-repeat;
}
/*
-------------------------------

View File

@ -6,10 +6,26 @@
#include <QApplication>
#include <QCommandLineParser>
#include <QScreen>
#if QT_CONFIG(translation)
# include <QLocale>
# include <QLibraryInfo>
# include <QTranslator>
#endif
using namespace Qt::StringLiterals;
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
#if QT_CONFIG(translation)
QTranslator translator;
if (translator.load(QLocale::system(), "qtbase"_L1, "_"_L1,
QLibraryInfo::path(QLibraryInfo::TranslationsPath))) {
app.installTranslator(&translator);
}
#endif
QCoreApplication::setApplicationVersion(QT_VERSION_STR);
QCommandLineParser parser;

View File

@ -8,7 +8,7 @@ if(NOT ANDROID)
message(FATAL_ERROR "Example only works on Android")
endif()
find_package(Qt6 REQUIRED COMPONENTS Widgets)
find_package(Qt6 REQUIRED COMPONENTS Widgets CorePrivate)
qt_standard_project_setup()

View File

@ -2,7 +2,7 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\title Qt Android Notifier
\title \Q4A Notifier
\example platform/androidnotifier
\meta tag {widgets,android,notification}
\brief Demonstrates calling Java code from Qt in an Android application.
@ -58,5 +58,5 @@
\snippet platform/androidnotifier/main.cpp Connect button signals
\sa {Qt for Android}
\sa {\Q4A}
*/

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