74309 Commits

Author SHA1 Message Date
Bartlomiej Moskal
393c294e10 Android: Avoid lazy initialization of QAndroidPlatformServices
In commit ff51ea5418d131248b07e327513b41dad1231f37, lazy initialization
was introduced for QPlatformServices, including
QAndroidPlatformServices. However, this approach causes a regression.
When QAndroidPlatformServices is lazily initialized, the intent listener
registration is delayed. As a result, handling custom URL schemes is
affected - especially those coming from external applications.

To address this issue, this commit removes lazy initialization for
QAndroidPlatformServices.

Fixes: QTBUG-135489
Pick-to: 6.9 6.8 6.5
Change-Id: I24becdf4ac573e7a2ca101cfbc27560d1eb4adef
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-05-29 08:01:13 +00:00
Dheerendra Purohit
d446df7599 QNetworkRequest: fix minor typo referencing non-existent method
Replaced incorrect setTimeout() with setTransferTimeout()

Pick-to: 6.9 6.8
Fixes: QTBUG-111993
Change-Id: I1eef02cda1be00d6ab99769f4a9b4406ac92d389
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2025-05-29 04:22:43 +00:00
Christian Ehrlicher
d34754ea81 QStyleSheetstyle: misc cleanup of QStyleSheetBorderImageData
Remove unused member 'image' from QStyleSheetBorderImageData and replace
c array with std::array<>.

Pick-to: 6.9
Change-Id: I149ef72e443027a6b6d30f25e8c7b1adf4138fc5
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-05-28 21:54:52 +02:00
Michael Weghorn
da3422ca15 a11y: Introduce QAccessible::Attribute::Locale, bridge to AT-SPI
Introduce a new Locale value for the QAccessible::Attribute
enum class that can be used to specify the locale
of an accessible object.

Use this to implement support for the
"Locale" property of the AT-SPI Accessible interface. [1]

If no locale has explicitly been specified, report
the default locale in the AT-SPI adaptor, as is
already the case in the implementation of the
"GetLocale" method of the AT-SPI Application
interface.

Being able to explicitly specify a locale is of
particular interest when an application contains
objects whose locale differs from the default
application locale, e.g. documents or paragraphs
written in a different language.

Demo LibreOffice change making use of this
new API: [2]

Sample use case with the above-mentioned LibreOffice
change in place:

1) start LibreOffice Writer, using English UI
   and document language
2) type "Hello world" for the first paragraph
3) press Enter to create a new paragraph
4) copy-paste "你好世界" ("Hello world" in Chinese)
   into the new paragraph
5) start Accerciser
6) select the first paragraph in Accerciser's treeview
   of the LibreOffice a11y hierarchy
7) query locale in Accerciser's IPython console

    In [1]: acc.get_object_locale()
    Out[1]: 'en_GB'

8) select the second paragraph in Accerciser's treeview
   of the LibreOffice a11y hierarchy
9) query locale in Accerciser's IPython console

    In [2]: acc.get_object_locale()
    Out[2]: 'zh_CN'

For UIA on Windows, UIA_CulturePropertyId [3] seems
to be the equivalent property that the new attribute
could be mapped to (to be done separately, not implemented
in this commit).

[1] 2e65b0877d/xml/Accessible.xml (L55-67)
[2] https://gerrit.libreoffice.org/c/core/+/185709
[3] https://learn.microsoft.com/en-us/windows/win32/winauto/uiauto-automation-element-propids

[ChangeLog][QtGui][QAccessible::Attribute] Added new
Locale enum value that can be used to specify the
locale of an accessible object.

Fixes: QTBUG-137144
Change-Id: Ice11b9e45b512305dbb8195961b8b08e1389c69e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2025-05-28 21:44:13 +02:00
Ivan Solovev
ca50d72778 QtConcurrent: mark as security-significant
The QtConcurrent module applies user-provided map-, filter-, and reduce-
functions (or their combinations) to user-provided data.
It does not make any assumptions about the provided functions and
data, apart from input/return type validation. It also does not parse
the provided data and does not have any way to sanitize it.

Mark all the source and header files in the module with the default
security-significant score to confirm that the code was reviewed.

QUIP: 23
Fixes: QTBUG-135179
Pick-to: 6.9 6.8
Change-Id: I2c1b315b837111627c2f0ce6e2ade704415972e2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2025-05-28 18:00:36 +02:00
Joshua Goins
c50ede0b20 Add autotest for ensuring restoring cursor shapes doesn't regress
We now try to keep track of the cursor state for each window, but was
missing an autotest (modeled after QTBUG-133541.)

Pick-to: 6.8 6.9
Change-Id: I9d081f5a3cc8bdaa860d48beb5f105afa424f102
Reviewed-by: David Edmundson <davidedmundson@kde.org>
2025-05-28 16:34:45 +02:00
Joerg Bornemann
286e309373 Revert "CMake: Make generated pkgconfig files relocatable"
This reverts commit 731d9a13956ef40e3f563f5ff5ff5c250b8d6d94.

Reason for revert: ${pcfiledir} cannot be used, because this
leads to wrong prefix values if PKG_CONFIG_SYSROOT_DIR is set.

See the comments of the associated task for instances of this
problem in other projects.

Pick-to: 6.8 6.9
Task-number: QTBUG-136210
Change-Id: I2a60946828f07866b931dacfe0ef81346f1aac9d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2025-05-28 14:34:45 +00:00
David Boddie
fbc6b0c6e6 Doc: Fix link to removed QFontMetrics::width function
The function was removed but documentation still referred to it.

Change-Id: I2fc1ef2ffc9cdc93e059dd1854816e6aa86dc972
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2025-05-28 12:05:57 +02:00
Alexandru Croitor
674a6dc5f6 CMake: Stop spamming CMP0156 debug messages
We set the CMP0156 policy to NEW for Apple platforms for each created
Qt target, but the debug message is generic, so we should only show it
once.

Amends c20d7bcb86361d0c9f8af3807dcad9db1a3a5ca0

Pick-to: 6.8 6.9
Task-number: QTBUG-135978
Change-Id: I332bd357999647df1d5f715d154fb568911889b1
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2025-05-28 11:38:24 +02:00
Alexandru Croitor
c2f7004204 CMake: Prefer target arch qmltestrunner when searching for it
Currently qmltestrunner is built as a tool, instead of an app.

That means that for most cross-compiling platforms (aside from Yocto),
the build system will look for a host binary when referring to the
qmltestrunner target. We want to look for the target platform binary
instead.

Switch the code around to prefer looking for the target platform
binary via find_program, before falling back to referring to it by
target name.

In the future when we change qmltestrunner to be an app, and also
expose its target platform binary as a target name, this should not be
needed anymore, and we could rely solely on the target name.

Amends 9edcc4690665496c2b6f15876b3979487dbad22a

Task-number: COIN-1211
Task-number: QTBUG-137005
Change-Id: If2eb93d8832a17aae3d0648d1d0f5997805796fa
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2025-05-28 11:35:07 +02:00
Edward Welbourne
6f8431b930 Modernize string usage in corelib/time/ tests
This incidentally lets me turn on QT_NO_CAST_{FROM,TO}_ASCII for them.

In the process, convert some test-cases to addRow() and use plain QBA
in place of newRow((QString arithmetic).toLocal8Bit().constData()),

Change-Id: I0117338dd927fc4eee74688ac86975508fa43b51
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2025-05-28 11:28:10 +02:00
Lorn Potter
f5d888b44a wasm: Make sure native fetch is destroyed before reply is canceled, closed
finished signal was being sent before native fetch was destroyed
which, in some instances, was causing a crash.

Fixes: QTBUG-136710
Pick-to: 6.9
Change-Id: I2134431cbf9af0511d888dc5db3f589f5259c88a
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Even Oscar Andersen <even.oscar.andersen@qt.io>
2025-05-28 15:53:10 +10:00
Topi Reinio
cc07564978 Doc: Enable automatic linking to sources on code.qt.io
Since 6.10, QDoc is capable of generating links to the declaration in
the source code for each documented C++ API entity in their `Detailed
description`.

Add the required configuration to enable this feature in online
documentation builds.

Change-Id: Iaafabc5aea50a6cd72549bb1c04007bb4de498ca
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2025-05-27 23:32:25 +00:00
Aurélien Brooke
2c6d729be9 QMetaType: only use sized-delete when available
Sized-delete is C++14 feature, but Clang didn't enable it until version
19.1 because it needs to support different standard libraries, and many
of them hadn't implemented support when the code was originally written.

https://github.com/llvm/llvm-project/pull/83774

Amends 44b5602536a95b847404b28948ad2bb4a4076f4b.

Change-Id: I17fc098d70bfb7474f4324d29ec6f32c91e3a705
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-05-28 00:59:58 +02:00
David Edmundson
68562d9b2e Wayland Client: explicitly attach a buffer in sendExposeEvent()
if an expose is not handled by application code. This primarily is a
workaround for Qt unit tests using QWindow directly and wanting focus.

Done-with: Liang Qi <liang.qi@qt.io>
Fixes: QTBUG-137021
Change-Id: Ibcbd931af9a3558cf7244699216bc716eba4850c
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2025-05-27 20:51:05 +00:00
David Edmundson
4c8333a353 qtooltip: Fix whitespace
Change-Id: I97676328036560a8afb66d607d1bef21a6930fad
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2025-05-27 20:05:50 +00:00
Tor Arne Vestbø
26f92a333e Windows: Only use UpdateLayeredWindowIndirect if window has an alpha
We only call UpdateLayeredWindow in setWindowOpacity if the window
has an alpha an no native frame, which means we need to use the
same condition in the backingstore when choosing how to flush the
window.

Amends 9a45fea9d1f6e445fb488693b107cdec6e42cccd.

As a follow-up we should refactor this code to avoid the duplicated
logic that must always be kept in sync.

Pick-to: 6.9 6.8
Change-Id: I2bd79bdc4a726339fc486d0892ff4e1960a5a10e
Reviewed-by: Zhao Yuhang <2546789017@qq.com>
Reviewed-by: Nodir Temirkhodjaev <nodir.temir@gmail.com>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2025-05-27 22:05:50 +02:00
Giuseppe D'Angelo
f56ed53261 moc: indent the generated code for ResetProperty
Make it match the one for the other property-related operations.

Change-Id: I9248cca81f9ab48cf6765f66d696631e91f5ad07
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-05-27 22:05:50 +02:00
Tim Blechmann
6d820c8551 entrypoint: remove extern "C" from main declaration
clang emits -Wmain if `main` is declared as `extern "C"`.

Pick-to: 6.8 6.9
Change-Id: Ieee28204f18e5153eaae8d6088294539f4991f96
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-05-28 03:34:58 +08:00
Vlad Zahorodnii
4ddc7a1407 wayland: Deliver WindowScreenChangedEvent synchronously
The QWaylandWindow::handleScreensChanged() function checks
window()->screen(), but QWindow's screen is updated asynchronously. It
can lead to the following issue:

- start on screen 1
- QWaylandWindow::handleWindowScreenChanged(screen 2): it'll update
  the window geometry so the window position is at the top left corner
  of screen 2
- QWaylandWindow::handleWindowScreenChanged(screen 1): it'll do nothing,
  despite the fact that the geometry has to be updated

This change makes the delivery of WindowScreenChanged events sync, so
the QPA updates the window geometry as expected if the window moves back
and forth between two outputs.

This fixes misplaced popup menus in Konsole.

Change-Id: I5a200b33ef63c6082f54ee85667b7b1ab513335e
Reviewed-by: David Edmundson <davidedmundson@kde.org>
2025-05-27 18:11:03 +03:00
Matthias Rauter
1ecbad8da9 Add TEST_ALL_COMPARISON to tst_qstringview
While porting some of these tests to QUtf8StringView, Thiago suggested
to add the comparison tests from qcomparisontesthelper_p.h.

Pick-to: 6.9 6.8
Change-Id: Id8f2c1c5690f7219ac000eebb637f48acbc5662d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-05-27 13:35:40 +02:00
David Redondo
deec49bac6 qtwaylandscanner: Handle destructor requests with new_id correctly
Instead of generating code like
    return request(args)
    m_object = nullptr
do
   new_id = request(args)
   m_object = nullptr
   return new_id
This came up in the color managment protocol where
wp_image_description_creator_params_v1::create creates a new object
but is also a destructor at the same time.

Pick-to: 6.9
Change-Id: Ic5d9f72656d99740bf6665c07393f69ee78af013
Reviewed-by: David Redondo <qt@david-redondo.de>
2025-05-27 11:35:40 +00:00
Lu YaNing
555bda1736 Client: add cursor state management
When tooltip window is shown and dismissed under Wayland, the cursor state

Add cursor state storage and application logic to ensure cursor state
is properly updated when changing cursors on focused

Fixes: QTBUG-135938
Change-Id: I8c3520bcb785cea03cddd1eb91e58b9d253b4fe0
Reviewed-by: David Edmundson <davidedmundson@kde.org>
2025-05-27 14:28:27 +08:00
Tim Blechmann
1f6352010d network: silence -Wimplicit-exception-spec-mismatch
`noexcept` drop implicit noexcept from QHttp2Connection dtor

Pick-to: 6.8 6.9
Change-Id: I0ff6afb1f70d3fe68739380b6f18c308871aa327
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2025-05-26 23:02:30 +02:00
Edward Welbourne
d4a54ba56a Deploy QCOMPARE_op() more widely in corelib/time/ tests
Exceptions:
* In tests of comparison operators themselves, still verify.
* Hash values aren't interesting to display.

Change-Id: I046be84f0f2637eddf57409895f20f164bda9a6b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-05-26 21:12:52 +02:00
Thiago Macieira
9ffa770afa QLogging: fix build: narrowing conversion from qsizetype to size_t
Amends a6070847f075296458e1afef0210f9c89aca4b2a.

error: narrowing conversion of ‘(& ba)->QByteArray::size()’ from ‘qsizetype’ {aka ‘long long int’} to ‘size_t’ {aka ‘long unsigned int’} [-Werror=narrowing]

Task-number: QTBUG-120047
Task-number: QTBUG-120048
Change-Id: I1fe8c5d7318c398e4ef3fffd17e06f0eeccdd791
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2025-05-26 12:12:52 -07:00
Alexandru Croitor
d2ed84514d CMake: Skip sbom file checksum checks for excluded test targets
If a developer configured Qt with
 -DQT_GENERATE_SBOM=ON
 -DQT_BUILD_TESTS=ON
 -DQT_BUILD_TESTS_BY_DEFAULT=OFF

The would get the following error upon installation of qtmultimedia:

CMake Error at
qt_sbom/SPDXRef-PackagedFile-qt-plugin-MockMultimediaPlugin.cmake:5
  (message):
  Cannot find 'plugins/multimedia/libmockmultimediaplugin.a' to
  compute its checksum.

This happens because QT_BUILD_TESTS_BY_DEFAULT == ON sets the
EXCLUDE_FROM_ALL directory property on the tests directory, which
means all plugins created under tests/ subdir are not installed by
default, and the SBOM code could not read the installed files to check
the checksums.

In such a case, set a QT_INTERNAL_TEST_TARGETS_EXCLUDE_FROM_ALL
directory-scoped variable in the tests/ subdir, and use that as a
marker for the sbom code to know it should skip the checksum check.

Pick-to: 6.8 6.9
Fixes: QTBUG-137168
Change-Id: I970c3bc5732cc648549e5099fa1d50b3b39cb26f
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2025-05-26 20:11:33 +02:00
Piotr Wiercinski
fcb89d1560 wasm: Skip tst_QDir::mkdirOnSymlink
Skip this test temporarily to enable upgrading Emscripten to 4.0.7.

Change-Id: Ieb01a3d3d231828a127c5d7c1866cab547e22fb6
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Even Oscar Andersen <even.oscar.andersen@qt.io>
2025-05-26 20:11:33 +02:00
Ahmad Samir
a0c0d40842 QHttpNetworkConnection: use std::optional instead of QScopedPointer
As pointed out in the code review.

Task-number: QTBUG-132213
Change-Id: Ia67cae1aa89dd11bd54331d1593d5717deafcf8d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2025-05-26 19:58:30 +03:00
Ahmad Samir
ffc5491757 QLocalServer: use std::unique_ptr instead of QScopedPointer
Task-number: QTBUG-132213
Change-Id: I6a18e787efa9a2ecfe89339569a9724467ac3e6a

Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2025-05-26 18:56:49 +03:00
David Boddie
9eb2c404ee Doc: Fix page file name typo
Change-Id: Id3e932426c01725b6f6ba2f64f06e211689235dd
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2025-05-26 17:56:49 +02:00
Bartlomiej Moskal
ab98013efc Android: Fix text update issues with fullscreen virtual keyboard
In commit 1f6d7cbb341bd79826d3f6d69e1f1a427ebb8f1b, we introduced
support for the full-screen software keyboard.

However, this revealed issues with text not updating correctly in the
view, particularly with composing text.

This commit addresses the problem by adding calls of [0]restartInput()
in three methods: setComposingText, deleteSurroundingText and
setSelection.

These calls help synchronize the editable state with the input method
and ensure the displayed text remains consistent and up-to-date.

There is one more issue that needs to be solved: QTBUG-136229

[0]https://developer.android.com/reference/android/view/inputmethod/InputMethodManager#restartInput(android.view.View)

Pick-to: 6.9 6.8
Fixes: QTBUG-135376
Fixes: QTBUG-128745
Fixes: QTBUG-130058
Change-Id: I3f905dd02cb3bfe5046b01164412f328160b7a8b
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-05-26 17:38:31 +02:00
Volker Hilsheimer
bdbe4c8858 QGIM: Rename to QRangeModel
As per the discussion on the mailing list [1], we want to avoid the word
"Generic" in class names. And QGIM is by design not using 'items', so
similar to e.g. QAbstractListModel or QSqlQueryModel, we don't need to
have "item" in the class name either.

It is a "Model", which is a well defined concept in Qt, that operates on
any C++ range, which is a well defined concept in C++. QRangeModel
is the best name.

Future evolutions on this API, e.g. adding a C++ template class that
provides an idiomatic C++ range API around the data while also updating
the Qt model, are not expected to be problematic by using this name.

[1] https://lists.qt-project.org/pipermail/development/2025-May/046322.html

Change-Id: Idaa70f8b2a30754cb28da13a0e6b0e22334afa11
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
2025-05-26 16:11:27 +02:00
Wladimir Leuschner
2d0e3c5001 Revert "Windows QPA: Remove usage of deprecated DwmEnableBlurBehindWindow"
This reverts commit b07876105788d519a3bb04a353eaa5ffa6269253.

Reason for revert: Introduced regression QTBUG-136098

Change-Id: Id1f4d7a485659c4150f6750866c2f702fcdc1bf6
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2025-05-26 15:15:08 +02:00
Even Oscar Andersen
e48c19449e wasm: Fix stacking order problem for transient parent windows
Windows with a transient parent does not reflect the relationship
in the stacking order. Essentially AboveTransientParent is missing
as a configuration choice.

What makes this slightly convoluted is that the window stack
does not depend on the window (for testability).

We solve this problem by making the stack and treenode templates,
and provide test class as arguments when testing.

QWasmWindow and QWasmScreen are not templated as before.

There is also a new order type StayAboveTransientParent. Which
means that we can no longer use order type to get to the
group location (Since StayAboveTransientParent can map to either
of the three types).

The window stack tests have been updated to handle the
StayAboveTransientParent type.

Finally, we do not do anything with a normal parent
child relationship as this should already work
correctly.

Fixes: QTBUG-131699
Change-Id: Ie08e18f9e0a2339175c4a09da0a831f031df71e1
Reviewed-by: Lorn Potter <lorn.potter@qt.io>
2025-05-26 13:27:17 +02:00
Leena Miettinen
3ad9d5777f Doc: Update external links to Qt Creator docs to 16.0.0 level
Mostly additions, but some title changes, too.

Pick-to: 6.8 6.9
Change-Id: Ic911183c1ad77f68f2fc958d82456010b8ce8201
Reviewed-by: Mats Honkamaa <mats.honkamaa@qt.io>
Reviewed-by: Esa Törmänen <esa.tormanen@qt.io>
Reviewed-by: Inkamari Harjula <inkamari.harjula@qt.io>
2025-05-26 13:27:17 +02:00
Lauri Pohjanheimo
10b9a43bf8 Mark QtNative as security sensitive
QtNative handled app input parameters and parses Uri:s

Pick-to: 6.9 6.8
Task-number: QTBUG-136727
Task-number: QTBUG-135178
Change-Id: I9830a51816ef41cd3b090382593012c22171c87b
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-05-26 11:27:17 +00:00
Aurélien Brooke
c100bb306a QMetaCallEvent: remove the QMetaCallEvent::create() function
It is unused since 0bd1fc006097e481d8b92ee1c5246ffa1ae9379f, and
duplicates a lot of code.

The last usages were replaced by QMetaObject::invokeMethod().

Change-Id: Idad7c75a7b43670269b0cfcea9543114839e604c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-05-26 13:27:17 +02:00
Ivan Solovev
3c1e2b8a24 network/ssl: Fix deprecated usages of QHashCombine
Amends c05ae82efb33507959ae2082483fb9425ccca8a0 which deprecated the
default constructor in favor of always requiring to pass the seed.

Change-Id: I1d77aff13fd1af8b8db8c61b19a6f70cfd092f54
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2025-05-26 13:27:17 +02:00
Tim Blechmann
f90dd023cf QQueue: add enqueue signature to enqueue elements by moving
Using the QQueue shim one could only use `enqueue` by copying. Adding a
signature to copy to allow elements to be moved.

Change-Id: Idfbabb6fc01265285f128c5657ccb4050e902720
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-05-26 08:59:48 +00:00
Juha Vuolle
bed78605e7 Make Qt for Android configurable without 'desktopservices' support
Put all URL open handling behind desktopservices-feature flag.
Move the few remaining function (desktopEnvironment()) a bit to
keep #ifdeffery simple.

Fixes: QTBUG-135722
Pick-to: 6.9 6.8
Change-Id: Id210f99f905719b8c5dc0a5fa5ac3cf10181ae84
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-05-26 07:32:02 +03:00
Tim Blechmann
6f319847d0 Add q23::expected as a private type
This patch adds a std::expected-like type in Qt for use in the Qt
implementation. It is using Sy Brand's tl::expected which is similar to
std::expected, and works with C++17. Although it closely resembles
std::expected, it is not identical and is therefor added as a private
header. The new type is intended to be accessible to all Qt modules and
is therefore made available through Qt Core. It is, however, not
intended for use in public APIs.

[ChangeLog][Third-Party Code] Added Sy Brand's tl::expected as a third
party dependency for use internally in Qt implementation.

Change-Id: I09930f31bf97498643d62814c688f288d5c33265
Reviewed-by: Tim Blechmann <tim.blechmann@qt.io>
2025-05-25 23:09:56 +02:00
Thiago Macieira
60f36b8d02 QTest::CrashHandler: extract the address of the crashing instruction
From the user and machine context provided in the signal handler.

Linux w/ GDB prints:
   0x563bb2ab7346 <_ZN11tst_Crashes5crashEv+28>:	movl   $0x1,(%rax)

FreeBSD w/ LLDB prints:
(lldb) x/i 0x0000319a0ae86996
    0x319a0ae86996: c7 40 04 01 00 00 00  other       movl   $0x1, 0x4(%rax)

macOS w/ LLDB prints (after disabling the check for SIP):
(lldb) x/i 0x00000001054086c8
    0x1054086c8: movl   $0x1, 0x4(%rax)

Done-With: Samuel Gaist
Done-With: Ivan Solovev
Change-Id: Iac02025b1922b6b4d927fffd3efe210ef51fc759
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
2025-05-25 13:24:27 -07:00
Thiago Macieira
33435ce567 QTest::CrashHandler: prepare to disassemble the crashing instruction
This is the infrastructure code, without actually getting the
instruction pointer from the machine context.

Change-Id: Iadd2c78913b2d0177949fffdeafa12e9fc3daf87
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2025-05-25 13:24:27 -07:00
Thiago Macieira
4fcd854657 QTest::CrashHandler: switch to execvp() instead of execlp()
There will be variable options.

Change-Id: Ie633615daeac87e8bd2cfffd962666a85d91d5cd
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2025-05-25 13:24:27 -07:00
Thiago Macieira
c8d3d7a7af QAbstractEventDispatcher: prevent too late unregistering of timers
Timers can't unregister when the dispatcher object is no longer of a
dispatcher type. It's too late even at ~QAbstractEventDispatcher,
because unregisterTimer() is a pure virtual. To prevent their attempting
to unregister, we set the thread's dispatcher to nullptr if it is this
object.

This has been a latent bug, so it's worth fixing. This started happening
for me with an un-pushed change that changed the order of how
QCoreApplication and QGuiApplication destroy the main thread event
dispatcher (namely, in their destructors, not waiting for ~QObject to
deleteChildren()).

Drive-by relax the store in QThread::setEventDispatcher().

Fixes: QTBUG-137130
Pick-to: 6.9 6.8
Change-Id: I8845736c38a931af62e3fffdfd3554874df89e8e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2025-05-25 13:24:27 -07:00
Thiago Macieira
08325952ee 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: 6.9 6.8
Change-Id: Ibe40567bba8dea205401fffdb71f7e6a3be130e4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit b5e47fa433f218a47db98a370fbad97c70455e85)
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2025-05-25 16:58:28 +00:00
Thiago Macieira
1a54a03301 QLibrary/Darwin: don't use RTLD_NODELETE, just don't dlclose()
As the comment says, the OS does support the flag and a perusal of the
source code for dyld[1] shows it does handle the flag, setting an
internal flag called "leaveMapped", which is different from the
"neverUnload" flag. My guess is that it literally just leaves the memory
for the plugin mapped, but removes all links to it in the dyld internal
data structures.

That results in the Objective C runtime crashing when running content
from NODELETE plugins that has been dlclose()d. This probably explains
why lldb stops seeing those symbols too:

(lldb) f
frame #0: 0x0000000103872eb4 QtCore`QLibraryPrivate::unload_sys(this=0x000060000179c210) at qlibrary_unix.cpp:258:21
-> 258      if (doTryUnload && dlclose(pHnd.loadAcquire())) {
(lldb) target modules list libqcocoa.dylib
[  0] 81EB58D5-8D31-333A-9E8C-F2385F6EFCF4 0x00000001043de000 libqcocoa.dylib
(lldb) image lookup -vn QCocoaEventDispatcher::QCocoaEventDispatcher
2 matches found in libqcocoa.dylib:
        Address: libqcocoa.dylib[0x0000000000036480] (libqcocoa.dylib.__TEXT.__text + 190368)
        Summary: libqcocoa.dylib`QCocoaEventDispatcher::QCocoaEventDispatcher(QObject*) at qcocoaeventdispatcher.mm:776
...
(lldb) n

(lldb) target modules list libqcocoa.dylib
[  0] 81EB58D5-8D31-333A-9E8C-F2385F6EFCF4 libqcocoa.dylib[0x0000000000000000] libqcocoa.dylib
(lldb) image lookup -vn QCocoaEventDispatcher::QCocoaEventDispatcher

[1] https://github.com/apple-oss-distributions/dyld

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: 6.9 6.9.0 6.8
Change-Id: I7da3b3615a6ace7c72d1fffd5cf560d8f8a4e1bb
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2025-05-25 16:58:27 +00:00
Ahmad Samir
0c0b5d0ff0 QMetaObject: port qRemoveWhitespace() to QByteArrayView
Change-Id: Ib5754708f25bdb3ac9d6546deaf3182dbb7ed8a8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-05-25 10:54:52 +00:00
Assam Boudjelthia
054dfb50a0 Android: avoid no impl found for updateNativeActivity() at startup
It seems that try/catch and ignoring the exception is not enough
to silence the error message about no implementation found for the
native method updateNativeActivity() when it's invoked at the start
before the libraries are loaded. To fix that we can call it only
if m_stateDetails.isStarted assuming that it would mean the libraries
were loaded since the app has been started.

Pick-to: 6.9 6.8
Change-Id: Ic23ce16439000090e2661b2e6956bcd9954bf33f
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2025-05-24 18:37:30 +03:00