Commit Graph

67302 Commits (95d4e6bababfeb36fa8a355a8487b64eb3ffb587)

Author SHA1 Message Date
Volker Hilsheimer 95d4e6baba ColorScheme: make QStyleHints::colorScheme writable for applications
Applications can request the color scheme to be either explicitly light
or dark, or to follow the system default by setting the scheme to
Qt::ColorScheme::Unknown.

Setting the color scheme will make the request to the QPlatformTheme
implementation, which can then use the appropriate implementation to
set the application's appearance so that both palette and window
decoration follow the requested color scheme. This should trigger
theme change and palette change events. A change to the effective
scheme should then call back into QStyleHintsPrivate::updateColorScheme,
which will emit the changed signal for the property.

Implement this for macOS (Cocoa), iOS, Android, and Windows.

On macOS, we have to use deprecated AppKit APIs; the replacements for
those APIs are not suitable for this use case. On iOS, the setting is
for each UIWindow, which we can update or initialize based on an
explicitly requested scheme.

On Android we can piggy-back on the logic added when dark theme support
was introduced in b4a9bb1f6a.

On Windows, we have to fake a dark palette if the dark scheme is
requested on a light system, as there is no API to read a dark palette.
However, we also have to ignore any application preference if a high-
contrast accessibility theme is selected by the user (we report the
color scheme as unknown; there are both light and dark high-contrast
themes), and read the system palette using the GetSysColor API, which
is used for light mode. And we need to initialize windows with the
correct frame if the application explicitly overrides the system color
scheme.

Add an auto-test to the QApplication test, as that gives us the most
coverage to confirm that QStyleHints emits the changed signal, and that
Theme- and PaletteChange events are received by the toplevel widget
when the color scheme actually changes. This test has to be skipped
on platforms where we cannot set the color scheme programmatically.

Add the option to explicitly select the color scheme to the widget
gallery example, and default it to dark mode.

Fixes: QTBUG-124490
Change-Id: I7302993c0121284bf9d3b72e3149c6abbe6bd261
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-05-10 01:15:12 +02:00
Thiago Macieira 4641945e45 QThreadPool: wrap the #include <functional> in QT_CORE_REMOVED_SINCE
Might improve compilation time a little for people using this header.

Amends 0e7e1c3396.

Change-Id: Ic5b1273bb0204c31afd8fffd17cd558e4578c359
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2024-05-09 04:14:24 +00:00
Thiago Macieira 55c6d6c86b QDnsLookup/Unix: check size in parsing of SRV records
We need at least 7 bytes: three 16-bit numeric fields and the hostname,
for which we need at least one byte and expandHost() takes care of
checking size further.

Pick-to: 6.7 6.5
Change-Id: Ic5b1273bb0204c31afd8fffd17cd3c9ba3c9fec7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-05-08 21:13:58 -07:00
Thiago Macieira a6d26ef64b tst_QDnsLookup: add debugging information with the query time
Change-Id: I455fe22ef4ad4b2f9b01fffd17c805aa76d2b314
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-05-08 21:13:49 -07:00
Thiago Macieira 4503dabfbd QDnsLookup: add support for TLSA records
[ChangeLog][QtNetwork][QDnsLookup] Added support for querying records of
type TLSA, which are useful in DNS-based Authentication of Named
Entities (DANE).

Change-Id: I455fe22ef4ad4b2f9b01fffd17c723aa6ab7f278
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-05-08 21:13:47 -07:00
Thiago Macieira 503fd60988 QDnsLookup: add the ability to tell if the reply was authenticated
This is implemented for DNS-over-TLS and for the native Unix resolver,
because I can find no way to get the state of the reply on Windows with
the WinDNS.h API.

Change-Id: I455fe22ef4ad4b2f9b01fffd17c7bc022ded2363
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-05-08 21:13:45 -07:00
Thiago Macieira f2f00b2a46 QDnsLookup: implement DNS-over-TLS
For the libresolv (Unix) implementation, we already had the packet
prepared by res_nmkquery(). This commit moves the res_nsend() to a
separate function so QDnsLookupRunnable::query() can be more concise.

On the Windows side, this commit creates a separate function for the DoT
case, because we now need to use two other functions from WinDNS so we
can create a query and parse the reply.

The rest is just QSslSocket.

Change-Id: I455fe22ef4ad4b2f9b01fffd17c805a3cb0466eb
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-05-09 04:13:44 +00:00
Thiago Macieira 9724b039ca QDnsLookup: add initial support for DNS-over-TLS (DoT)
This is just an empty shell for now. The implementation will come in the
next commit.

[ChangeLog][QtNetwork][QDnsLookup] The class now supports DNS-over-TLS
and some other DNSSEC experimental features, on some platforms. Use
QDnsLookup::isProtocolSupported to know if the protocol is supported on
a given platform.

Change-Id: I455fe22ef4ad4b2f9b01fffd17c7e034dee75533
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-05-08 21:13:43 -07:00
Volker Hilsheimer fd6cfd2283 Docs: fix QT_NO_FOREACH/KEYWORDS macro documentation
QT_NO_FOREACH didn't related to anything so the documentation
wasn't generated, and QT_NO_KEYWORDS wasn't documented but
referenced.

Pick-to: 6.7
Change-Id: I7b79e61519c186d10f8e8c674705adb3d10bd53a
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2024-05-09 01:11:37 +02:00
Ahmad Samir 9a61bc5dfc QStaticLatin1StringMatcher: add indexIn(QStringView)
... mirroring the same change in QLatin1StringMatcher.

Task-number: QTBUG-117054
Change-Id: I8d1f4ed01ee75a51e3d99a165dbb35ae7dae5886
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-05-08 22:05:35 +02:00
Tatiana Borisova ec88e63f2a QFuture::const_iterator: use modernize comparisons
Replace class operators operator==(), operator!=() of
QFuture::const_iterator: to friend method comparesEqual() and
Q_DECLARE_EQUALITY_COMPARABLE macro.

Task-number: QTBUG-120304
Change-Id: Ifa264b83f4d5623db99820847ab9a800cca99be2
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-05-08 22:05:35 +02:00
Christian Ehrlicher 5ea2481556 QWidget: fix render() in RTL mode
Rendering a widget to a paintdevice via QWidget::render() did not pass
the LayoutDirection mode of the widget to the paintdevice which lead to
wrong rendering of text.
This is especially visible with the windows 11 style which does not draw
some widgets directly on the screen but through a QGraphicsEffect on a
QImage.

Pick-to: 6.7 6.5 6.2
Fixes: QTBUG-124931
Change-Id: If2cfa326d2ca45c42e203a4ae91fd857afa5c69c
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
2024-05-08 19:58:17 +02:00
Kai Uwe Broulik c587eeef11 Mark QGuiApplication::platformName property as CONSTANT
It cannot change at run-time once the platform
has been initialized.

Pick-to: 6.7
Change-Id: Ib5ec049d799cbc54f184ebc8a6531f22c02b6b5b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-05-08 17:58:17 +00:00
Tor Arne Vestbø 6c36e21bec iOS: Always call setParent during QIOSWindow construction
We rely on setParent for parenting top level windows into our desktop
manager view, so we can't condition the call on having a parent window,
like we do on other platforms.

This was a regression from 988039729f.

Fixes: QTBUG-125142
Pick-to: 6.7
Change-Id: I2884d77db09cba5371ccd77eabda7ce38c0292de
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2024-05-08 19:51:25 +02:00
Ahmad Samir c878a51509 QLatin1StringMatcher: add indexIn(QStringView) overload
Drive-by changes, remove a redundant typedef.

[ChangeLog][QtCore][QLatin1StringMatcher] Added indexIn(QStringView)
overload.

Task-number: QTBUG-117054
Change-Id: I5a8426cb0f9d9111f086015902ffe2185a267c86
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
2024-05-08 19:22:46 +02:00
Joerg Bornemann 519a47e870 CMake: Record static libs and target type in for deployment
In <build-dir>/.qt/QtDeployTargets.cmake we recorded deployable targets
and their file path. We skipped static libraries, because we don't
consider these deployable.

However, we need information about static library targets too when
deploying QML plugins: we need to know that they are "built by us" in
order to properly skip them.

Now, we record STATIC_LIBRARY targets too and also record the type of
each target.

Pick-to: 6.7
Task-number: QTBUG-124771
Change-Id: Ic1ef33a3295458c372c2bc9f24ecce43f17e7321
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-05-08 18:59:22 +02:00
Frédéric Lefebvre a0759dd420 tst_QApplication::focusWidget() remove setActiveWindow() child section
2f6fe3a268 as made calls to
QApplicationPrivate::setActiveWindow() redundant.

Remove redundant calls.

Task-number: QTBUG-121488
Change-Id: Ib3b39f4bd51c87eeeebe329ada163f24390f6bc3
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-05-08 13:37:47 +02:00
Alexey Edelev c5be402651 Consider the qt_internal_extend_target calls when adding deps on qpa_default_plugins
Applications not necessarly link QtGui module in
qt_internal_add_executable. They still may add link it in followoup
qt_internal_extend_target calls. We should consider this when adding
dependencies on qpa_default_plugins to the internal executables.

Pick-to: 6.7
Change-Id: Icc413bd35b631b3a356e4033faab4e6c01b29a60
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-05-08 13:31:26 +02:00
Alexey Edelev 1e8a36e360 Consider the versioned Qt6::Gui when target when adding the plugin dependencies
QtGui module can be linked using both versioned and non versioned
targets. Consider this when adding the dependencies to the
qpa_default_plugins targets.

Pick-to: 6.7
Change-Id: Iccbf3009ab8a4f9df4de1677f1b41445814c8c9e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-05-08 13:31:23 +02:00
Alexey Edelev c7176f3142 Fix the static linking of plugins to the Qt tools and internal executables
Qt tools and executables may required the static plugins from modules
that are build as part of the Qt build tree. In this case we need to
force plugin importing. This adds the qt_internal_import_plugins call
when we extend the executable target.

Replace the previos solution that considered libraries that were
provided in the arguments of the qt_internal_add_executable call only.

Pick-to: 6.7 6.6 6.5
Fixes: QTBUG-111988
Change-Id: Ifa2cf7f1f68d9f90cafc64f225aebe11d4cdb2ae
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-05-08 13:31:20 +02:00
Edward Welbourne 669f7e3b97 Disambiguate a QDateTime construction
When compiling removed_api.cpp, both the removed QDateTime(QDate,
QTime) constructor and the one taking a transition resolution with a
default are visible. The inline fromStdLocalTime() was thus ambiguous
as to which it was calling. So make the transition resolution overt.

Fixes: QTBUG-125079
Pick-to: 6.7
Change-Id: I0c498bed2831afee0adc41c4575f3ed1bc244122
Reviewed-by: Tim Blechmann <tim@klingt.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-05-08 13:14:11 +02:00
Lucie Gérard 251a632dc4 Add copyright and licensing to .bat files missing them
Task-number: QTBUG-124453
Change-Id: I8bd48ab5d5b18197ef5bf9a46edf49da86374bee
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2024-05-08 13:09:40 +02:00
Lucie Gérard 00a04dddaf Add REUSE ignore comment
For those files, reuse fails to process the copyright and licensing information. The information is written to .reuse/dep5 file and reuse is told to ignore what is in the file.

Task-number: QTBUG-124453
Change-Id: If593c713026d9d349055cb6e8e73500966a05d9b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2024-05-08 11:09:28 +00:00
Lucie Gérard 3114e0a72e Correct license for test files
According to QUIP-18 [1], all test files should be
LicenseRef-Qt-Commercial OR GPL-3.0-only

[1]: https://contribute.qt-project.org/quips/18

Task-number: QTBUG-121787
Change-Id: I1da572cca6151d5fc6105f774731d11417025341
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2024-05-08 13:09:11 +02:00
Frédéric Lefebvre f75b5b8aca tst_QApplication::focusWidget() remove setActiveWindow()
2f6fe3a268 as made calls to
QApplicationPrivate::setActiveWindow() redundant.

Remove redundant calls.

Task-number: QTBUG-121488
Change-Id: I160e71302b40777d13e2481447bc47ebfc1a784c
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-05-08 13:07:33 +02:00
Frédéric Lefebvre 22e53dced7 tst_QSpinBox::editingFinished() remove setActiveWindow()
2f6fe3a268 as made calls to
QApplicationPrivate::setActiveWindow() redundant.

Remove redundant calls.

Task-number: QTBUG-121488
Change-Id: Ib08791375e3984e7eda5b25ec6bac0b283ed80cc
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-05-08 13:02:32 +02:00
Even Oscar Andersen 1530c475e9 wasm: Fix nullptr access in QWasmScreen::allwindows
If the QWindow::handle() has not been created yet we will add
a zero page pointer to the allwindows list.
One possible symptom is that emscripten::val complains
in context2d() that it is accessed by the wrong thread.
what happens is that the this pointer points to the first
page.
Seen in the documentviewer example

Change-Id: I2b08176ebdd7c35d5105194f7fd9f4f6d45b77e5
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2024-05-08 06:47:16 +00:00
Christian Ehrlicher 1a4470a8ef SQL tests: Fix dropping procedures Firebird/IBase
Firebird can not handle 'DROP PROCEDURE IF EXISTS' - need to call it
unconditional without 'IF EXISTS'.

Pick-to: 6.7 6.5
Change-Id: I530bcc2c756eed680a6fdaf27b3e3a0715f96bd4
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-05-08 08:36:19 +02:00
Thiago Macieira 1ed0dd88a3 QThread/Unix: make QThreadPrivate::finish() be called much later
We need it to run after all the thread-local destructors have run, to
ensure that some user code hasn't run after QThreadPrivate::finish() has
finished. We achieve that by making it get called from a thread-local
destructor itself, in the form of a qScopeGuard.

This ought to have been done since C++11 thread_local with non-trivial
destructors became available. However, it only started showing up after
commit 4a93285b16 began using thread_local
inside Qt itself. The visible symptom was that QThreadPrivate::finish()
had already destroyed the thread's event dispatcher, but some user code
ran later and expected it to still exist (or, worse, recreated it, via
QEventLoop → QThreadData::ensureEventDispatcher).

Fixes: QTBUG-117996
Pick-to: 6.7
Change-Id: I8f3ce163ccc5408cac39fffd178d682e5bfa6955
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2024-05-07 14:22:27 -07:00
Thiago Macieira 3fc5ee5c2e QThread/Doc: update the docs on setStackSize()
There's some confusion about minimum and maximum.

Pick-to: 6.7
Fixes: QTBUG-109512
Change-Id: I262c3499666e4f4fbcfbfffd17cc1d592bc658b3
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Philip Van Hoof <philip@codeminded.be>
2024-05-07 14:22:27 -07:00
Thiago Macieira ed70faf87a QCoreApplication: make removeNativeEventFilter() remove from main thread
installNativeEventFilter() always installs on the main thread, so match
it.

[ChangeLog][QtCore][QCoreApplication] Fixed a mismatch on which event
dispatcher was modified between installNativeEventFilter() and
removeNativeEventFilter(). Now both functions in QCoreApplication access
the main thread's event dispatcher. To access the current thread's
dispatcher, use QAbstractEventDispatcher's functions.

Fixes: QTBUG-124783
Pick-to: 6.5 6.7
Change-Id: I6979d02a7395405cbf23fffd17ca09e1ac43f1f3
Reviewed-by: David Faure <david.faure@kdab.com>
2024-05-07 21:22:27 +00:00
Carl Schwan ab2f4ef8fa QTextDocument: Add support for responsive images
Add support for the max-width css attribute in image. This allows images
to be responsive: it adapts their size to the size of the QTextDocument
so that they never grow bigger than the QTextDocument pageSize.

This is implemented for the image handler used in QTextEdit and other
QtWidget text related classes.

[ChangeLog][QtGui][CSS] The max-width style can now be applied to
<img/> to set the maximum width in pixels or percentage.

Task-number: QTBUG-12283
Change-Id: Ic94e16279a1240ab4a509823de59dc0bfc920bb9
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2024-05-07 12:28:59 -07:00
Lena Biliaieva fb2ea1e52a tst_QNetworkRequest: add test for operator==()
Task-number: QTBUG-107751
Change-Id: I4ed77b022f9e576f1363d55a05de6f6fad5b01dc
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
2024-05-07 21:28:59 +02:00
Lena Biliaieva c68b20477f QNetworkReplyHttpImpl: simplify setting headers in postRequest()
Task-number: QTBUG-107751
Change-Id: I33bbad1d7dadc058af52f8a81766762f0de1d812
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-05-07 21:28:59 +02:00
Orkun Tokdemir 545b84b93c CMake: Add `qt_add_ui` API
This commit introduces a new `qt_add_ui` CMake API to be used instead
of AUTOUIC, due to several hard-to-fix bugs it has.

* Resolves the issue where Ninja required two passes to correctly build
`.ui` files.
* Avoids build folder leakage, in contrast to `AUTOUIC`
* Prevents unnecessary recompilation of unchanged source files when a
`.ui` file is modified with Ninja.
* Since `qt_add_ui` does not scan source files, it provides a faster
build than `AUTOUIC`.

These changes aim to streamline the build process and improve
efficiency when working with `.ui` files.

This addresses the following issues:
https://gitlab.kitware.com/cmake/cmake/-/issues/16776
https://gitlab.kitware.com/cmake/cmake/-/issues/25436
https://gitlab.kitware.com/cmake/cmake/-/issues/25195

Task-number: QTBUG-110369
Fixes: QTBUG-114563
Change-Id: I34cd3df70542becf6e08502f0cbcd1c11eeeadd6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-05-07 21:12:29 +02:00
Doris Verria 0678a8a00d QWindowPrivate::setFocusToTarget: Add focusReason parameter
The focusReason is also important when setting focus to the target, so
ammend 8c44064f62 and add this parameter
to the virtual method.

Change-Id: Id7800a366cbc1ce2ac26b3fec1e47ec9267a57bb
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2024-05-07 21:12:29 +02:00
Tomasz Kozłowski c0c66a42ce Exclude sync() usage from VxWorks platform
This function is not available in VxWorks libraries and it is not
mandatory for proper qstorageinfo test execution.

Pick-to: 6.7
Task-number: QTBUG-115777
Change-Id: Ic503c776002087d461c32f890795c27be4b1ca34
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-05-07 17:30:37 +02:00
Frédéric Lefebvre 23ecc6ce70 tst_QGraphicsProxyWidget::tooltip_basic() remove setActiveWindow()
2f6fe3a268 has made calls to
QApplicationPrivate::setActiveWindow() redundant.

Remove redundant calls.

Task-number: QTBUG-121488
Change-Id: I842e1c01007cc56e07a27a6e15ff173c4f6aece2
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-05-07 17:30:33 +02:00
Lena Biliaieva 0fef8f53c3 Use QHttpHeaders: Update internal users of QNRequest, QNReply, QNProxy
Replace QNetworkHeadersPrivate's main headers storage, which was
RawHeadersList, with QHttpHeaders. Replace internal usage of raw and
cooked header methods with the QHttpHeaders API.

[ChangeLog][QtNetwork][QNetworkRequest] Header value added by
QNetworkRequest::setRawHeader() method is trimmed now.

Task-number: QTBUG-107751
Change-Id: I8882978afa430651e6c798a4fed00beef6c4cfd2
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
2024-05-07 12:39:23 +02:00
Tatiana Borisova a32c152d39 QSocketDescriptor: use modernize comparisons
Change-Id: Ic0389ab7f8578a0c224072097420cfd8cac508be
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-05-07 12:38:13 +02:00
Eskil Abrahamsen Blomfeldt 9928ebd26a doc: Update note about variable axes on Windows
Since Qt 6.8, the DirectWrite backend is the default, so we need
to invert the warning.

Change-Id: I0d32c06c3507664ecd5b1bc3ae3fcabeedee12b7
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2024-05-07 12:16:30 +02:00
Alexey Edelev ac4920b5c0 Prefer the versioned targets over the namespaceless one when collecting deps
Change the way we collect dependencies in __qt_internal_walk_libs.
Prefer the versioned Qt targets over the namespaceless. This fixes the
generating of the pkg-config configs.

Pick-to: 6.5 6.6 6.7
Task-number: QTBUG-124135
Change-Id: I660376e122a99b5bc0874f2bc6ccd4d80c9ad453
Reviewed-by: Ionen Wolkens <ionen@gentoo.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-05-07 12:13:41 +02:00
Alexey Edelev 721cfbd194 Consider versioned targets when checking the existens in __qt_internal_walk_libs
Since Qt targets now are linked as versioned targets by default, we
should adjust the respective check in __qt_internal_walk_libs.

Pick-to: 6.7
Change-Id: Idb896c1d9eda944a06d57b0491686cd78e010df0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-05-07 12:13:37 +02:00
Alexey Edelev 337cadbcb7 Consider '^Qt6' deps when generating pkg-config files
Dependencies that alredy start with QT_CMAKE_EXPORT_NAMESPACE shouldn't
be skipped but collected as is when generating pkg-config files.

Pick-to: 6.5 6.6 6.7
Fixes: QTBUG-124135
Change-Id: I6875337c2e1d98f657e52a5fc2c37eebccf08b98
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-05-07 12:13:33 +02:00
Alexey Edelev e820ff8301 Make version_tagging the full-functional feature
This feature allows to explicitly disable the version tagging for Qt
libraries and have the precise feature-based guarding in C++ code.

Task-number: QTBUG-124346
Change-Id: If109adb2f6a998c58825a2449cfb936ea278b2ad
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-05-07 12:10:22 +02:00
Volker Hilsheimer 31de589906 Docs: fix warning from old QCheckBox::checkStateChanged overload
The overload carrying the new state as an integer is deprecated, but
still documented, so we need to document the parameter as well. Bring
the full documentation back to silence the warning.

Amends 5a96d13bb5.

Pick-to: 6.7
Change-Id: I5253e68e4ad7b42fc552feb958cc0ac40d685609
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-05-07 07:14:25 +02:00
Thiago Macieira 4a984c15dd QResource: add support for duplicating mapped memory on macOS
Similar to the Linux solution, this avoids allocating heap memory in the
implementation of QFile::map() calls with MapPrivateOption.

Unlike the Linux solution, the macOS one cannot duplicate resources
present in read-only sections of binaries, only those loaded from files
with mmap() (QResource::registerResource()), because the max_prot
setting on the source does not have the VM_PROT_WRITE bit set and I
could not find a way to reset it to force a copy-on-write.

Change-Id: I6979d02a7395405cbf23fffd17c951949c71ec20
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-05-06 14:32:55 -07:00
Thiago Macieira 1b64b7c672 QResource: add support for duplicating mapped memory on Linux
This makes QResourceFileEngine avoid allocating heap memory in the
implementation of QFile::map() calls with MapPrivateOption. We do that
by asking the kernel to duplicate the mapping to the same memory pages,
which increases our virtual memory space but doesn't initially take up
any more RAM.

We have to be careful to ensure the resulting mapping is copy-on-write
and that this setting is independent of the original map's. The former
is easy: the mremap() system call with MREMAP_DONTUNMAP only works on
private memory blocks, so by definition any private + writable block is
copy-on-write.

The latter is slightly more difficult: if the original block was already
writable, then the kernel could give us a new map to the exact same
pages[*], which isn't exactly helpful. Therefore, we need to check if
the QResourceRoot points to a private, read-only block.

[*] in those conditions, mremap() is documented to replace the original
    mapping with a zero page, which means we have a near certainty of
    crashing, instead of accidentally, silently corrupting memory.

Change-Id: I6979d02a7395405cbf23fffd17c90fb1f1612ed7
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-05-06 14:32:55 -07:00
Thiago Macieira 62e0080a6a tst_QResourceEngine: use both ways of registering dynamic resources
So we test both the mmap()ed and non-mmap()ed versions. Will be
important in the next commit.

Change-Id: I6979d02a7395405cbf23fffd17c98f0e207477e6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2024-05-06 14:32:55 -07:00
Tatiana Borisova ecb0878cbc QVersionNumber: use new comparison helper macros
Replace public friend operators operator==(), operator!=(),
operator<(), etc of QVersionNumber to friend methods
comparesEqual() / compareThreeWay().

Task-number: QTBUG-120304
Change-Id: Ib94a1a28ca9843ca5d5a8d07f41c63de9fe584bb
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-05-06 22:47:55 +02:00