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>
Might improve compilation time a little for people using this header.
Amends 0e7e1c3396.
Change-Id: Ic5b1273bb0204c31afd8fffd17cd558e4578c359
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
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>
[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>
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>
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>
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>
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>
... mirroring the same change in QLatin1StringMatcher.
Task-number: QTBUG-117054
Change-Id: I8d1f4ed01ee75a51e3d99a165dbb35ae7dae5886
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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/16776https://gitlab.kitware.com/cmake/cmake/-/issues/25436https://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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>