QMessageBox has text values that an accessible client should be able to
read directly without having to navigate through the text labels.
Add test coverage.
Windows Narrator is inconsistent in reading the contents of a message
box. It might skip them completely, even though the text property is
read through the interface.
Task-number: QTBUG-101585
Change-Id: I639c2210a627733c093743790c6a6b83f4bb80d0
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
- shorten a couple extra long lines
- add space between functions
Pick-to: 6.4
Change-Id: I14ad7448372ba50f4b0299535c4261a5bbf415b7
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Changing a C++ source file can trigger rebuilds of a lot of other
source files that might include AUTOGEN'ed headers or sources.
See https://gitlab.kitware.com/cmake/cmake/-/issues/22531 for some
details. Fixed in CMake 3.21.2.
There are still files that are rebuilt even in 3.21.2, but it's less,
and it returns to the status quo of how it was in 3.21.0 or earlier
versions.
Pick-to: 6.2 6.3 6.4
Task-number: QTBUG-104352
Change-Id: Ie1c991d52df48442d4134e4ed22a8137a3c993c8
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
The QWSI APIs for reporting added or removed screens is not transactional,
so when several screens change at once Qt will see each screen change as
a separate state.
As a result, Qt, or the application itself, may react to the first of
many screen updates by moving a window to a different screen -- one
which is going to updated (removed) in the next iteration of QWSI
calls.
This caused trouble on macOS, where we use many different signals to
detect that the system has changed the screens, one of them being that
a window has been moved to a different screen.
In the scenario above, we would be in the process of updating screens
in response to the system going to sleep, which means all 3 connected
screens will be disconnected and replaced with one fake screen provided
by the system.
As we delivered the removal of the first QScreen, Qt or the application,
would respond by moving the window to one of the other two screens, which
in turn would recursively trigger another round of screen updates. This
round would then proceed to remove (and delete) all remaining QScreens.
When we then recursed back to the initial round of screen updates
we would continue iterating and operating on screens that had already
been removed, causing a crash.
Since we know that the screens will stabilize eventually, and that
QCocoaScreen has cached all info based on the displayId and NSScreen,
we can safely skip any recursive invocations of updateScreens().
Fixes: QTBUG-102021
Fixes: QTBUG-84741
Pick-to: 5.15 6.2 6.3 6.4
Invaluable-help-by: Bruno Cadoret <bruno.cadoret_1@signify.com>
Change-Id: I9ff96dbcbc6f308ad2729faf2db2de7ef08513c0
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
The currentSection key was accidentally using the whole remaining
section contents.
Pick-to: 6.4
Change-Id: Iec6e38636e519170eef136401ede4b626e12754a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The only way to use them was to put them in a union and then write all
the members of the union to set the various bit ranges. As only one
member of a union can be active at any time, the compiler is free to
optimize those writes away, though. This has started happening in the
wild now.
As we have a replacement, we can remove the old and broken code now.
Task-number: QTBUG-99545
Change-Id: I90718ec06662258d1c15220f54da9eed2186c5a5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The QBAV one should pass the parameter by value, like QStringView. And
now that we have it, the non-View one should call the View one in an
inline function, like we already do for QString.
The extra, defaulted parameter is there only so we get a different
signature in the new inline function compared to the removed one.
Pick-to: 6.4
Change-Id: If05aeeb7176e4f13af9afffd16e7f08062b1dc86
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
The test run is wrapped with a special TESTRUNNER script that ignores
failing tests (there are several tests failing when built with ASAN) and
also ignores LSAN errors (memory leaks - but still visible in the
output).
The test run only fails if a test reports ASAN errors or if it
crashes (or times out, which is like a crash caused by qtestlib's
watchdog timer).
Fixes: QTQAINFRA-5025
Change-Id: I861756ab49388ac4a52409d3a780684244e469b1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This renders these simple tests ASAN and LSAN (Address Sanitizer
and Leak Sanitizer) clean.
Change-Id: Ibe5b7054a20c1575a1a7939b0bed4101afeeee56
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Previously hover effects had to be enabled manually due to not being
enabled in the platform style. This change enables them by default.
Pick-to: 6.4
Fixes: QTBUG-88799
Change-Id: I014e1f5dfcd9b15656f11e12ab75a77d42f4815c
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Found by codespell
Pick-to: 6.4
Change-Id: Ie3e301a23830c773a2e9aff487c702a223d246eb
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This way, if you name several test functions on the command-line,
you'll at least get the ones that do exist run (and you'll be told all
of the ones that don't exist, rather than only the first).
Pick-to: 6.4 6.3 6.2
Change-Id: I14a515fcfacb6ca49e0470b236c05475b25db4f2
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
This change improves the loading speed of files stored in Android assets
folder by caching the information about files already opened.
Prior to the change, when creating a QFile or QFileInfo to an asset
file, the engine would first scan all the file's directory and parent
directories in order to cache all this in FolderIterator::m_assetsCache.
Due to the nature of Android assets, it might be very slow, depending on
the number of images in this tree.
In this patch, individual file accesses will stop using FolderIterator
and will simply open what is asked, caching the information about the
resource in order to avoid to have to call the expensive
AAssetManager_open if the file is accessed again (e.g. by QFileInfo).
Fixes: QTBUG-101161
Change-Id: Iaedf4cdf83d5116053b51895a6795d43bc60f942
Pick-to: 6.4 6.3 6.2 5.15
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
ffmpeg and nettle are different from other libraries, they use symbol
link as their inner module dependencies. Calling one more
install_name_tool can handle this case.
Fixes: QTBUG-100093
Pick-to: 6.2 6.3 6.4
Change-Id: I12cdd53bd5aa3120910070ba283178686deb3eb0
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
The QDateTime benchmark's toMSecsSinceEpoch() and
toMSecsSinceEpochTz() each iterated the 2010s and had 1950 and 2050
variants for two other decades. I want to also test some earlier
decades and do similar for create(), so combine the existing triplets
as three rows of a data-driven test for each triplet, add the new rows
and apply the same to create().
In the process, turn an enum used for qint64 constants into a set of
constexpr qint64 declarations.
Pick-to: 6.4 6.3 6.2 5.15
Task-number: QTBUG-104012
Change-Id: I2657346b65d96a7ef7503cd33c870b688ea5dbff
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Enable by setting QT_WIDGETS_HIGHDPI_DOWNSCALE=1 and QT_WIDGETS_RHI=1.
This will make the backing store and painter operate at the next
highest integer DPR in cases where QWindow::devicePixelRatio() returns
a fractional value. The backing store image will then be downscaled
to the target DPR at flush time, using the RHI flush pipeline.
[ChangeLog][QWidgets] Added experimental support for always
painting at an integer device pixel ratio (rounding the DPR up if
necessary), followed by a downscale to the target DPR.Enable by setting
QT_WIDGETS_HIGHDPI_DOWNSCALE=1 and QT_WIDGETS_RHI=1.
Pick-to: 6.4
Task-number: QTBUG-86344
Change-Id: Id5b834a0e3499818b0b656161f5e0c38a6caa340
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
The rhiFlush() implementation currently assumes that
QWindow->devicePixelRatio() is the correct scale factor for
transforming device independent window geometry to source geometry.
However, this assumption does not hold if/when we add support
for drawing to a rounded-up DPR, with a downscale later in
the rhiFlush implementation.
Fix this by adding a sourceDevicePixelRatio argument to rhiFlush(),
which is set to either QWindow::devicePixelRatio() or
QWidget::devicePixelRatio(), depending on from where it is used.
Change deviceRect() and friends in qbackingstoredefualtcompositor.cpp
to be scale*() functions instead which take a scale factor instead
of a QWindow. Update call sites to use srouceDevicePixelRatio
where that makes sense.
Pick-to: 6.4
Change-Id: Idb7b1e2f36816a201e00f0defe100d2dc079cb17
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Example:
Error "BadWindow" (3) is raised by the XCB backend when a mouse event
is processed on a resource that disappears between posting and
processing of the event.
That constellation is harmless and can occur in async environments.
As XCB errors point to coding issues, this patch changes their logging
behavior from qCWarning to qCDebug.
Fixes: QTBUG-56893
Pick-to: 6.4 6.3 5.15
Change-Id: Idee5ee80efaf9cd6686448779f76c68d5e4c9b63
Reviewed-by: Liang Qi <liang.qi@qt.io>
Xcode's legacy and new build system modes have different behavior
in how they bundle resource paths that start with lang_code.lproj.
Document how to bundle translation files for both legacy
and new build systems.
Pick-to: 5.15 6.2 6.3 6.4
Fixes: QTBUG-98417
Change-Id: I857ec76577f8244a751d4bf38fbe305fef614734
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
If a font is synthetically condensed / expanded, we need to scale
the advances as well as the bounding boxes for the glyph cache.
The logic is adapted from DirectWrite font engine, where the same
scaling is already in place.
[ChangeLog][macOS] Fixed a bug where synthetically stretched fonts
would get the wrong advances and sometimes glyphs would be clipped.
Pick-to: 6.2 6.3 6.4
Fixes: QTBUG-103838
Change-Id: I09fc87b245d1f2de980c10ad9253b9a83571f714
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
When Qt was configured with -no-harfbuzz, we would get overlapping
glyphs, because we skipped the shaping step but did not set up things
correctly before that. Instead, we force the PreferNoShaping code path
when there is no shaper available.
[ChangeLog][Text] Fixed font layouts when Qt was configured without
Harfbuzz.
Pick-to: 6.2 6.3 6.4
Fixes: QTBUG-100361
Change-Id: I1c54dbc457dbb235548b9d70324d607a0ee6d501
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Traces can contain only a few types; for now, enums have to be converted
to int. Amends 6d323c0b22
Task-number: QTBUG-102862
Change-Id: If129d03b13e723350bac987c6e35d471aa6c17e2
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Rafael Roquetto <rafael.roquetto@qt.io>
The section is already called Transformations. Making
it a target just causes issues in other contexts.
Pick-to: 6.4
Change-Id: I8dc65bd3254238e51a649f926cd066dfcbe9500d
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
This reverts commit b9cce12e76, which
broke
function_ref<void(int)> f = [](int i) { return i; };
ie. swallowing of return types.
We could maybe implement the same without invoke_r, with the same
manual if-constexpr that invoke_r has, but it would be a pointless
duplication across the two thunks we have, so just use invoke_r.
Add tests.
Pick-to: 6.4
Task-number: QTBUG-103739
Change-Id: I6034f05d813c06a25e8058ded5b6b62f3ca858b4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Use the QByteArrayView overload instead.
Deprecated since 6.3, so backporting:
Pick-to: 6.4 6.3
Change-Id: I529104cad59260eed371cedb1ae84a7e9086bbf6
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
We implicitly checked it, because, in C++20 builds, the non-equality
relational operators are synthesized from it by the compiler, and we
test those, but we didn't check that <=> returns strong_ordering.
We now do.
Pick-to: 6.4 6.3 6.2
Task-number: QTBUG-104108
Change-Id: Ieb19a2d4cb2d600d884f4e2e89e98c6187e23872
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This one came up on a tsan build, but not on an asan/ubsan one!?!:
qbytearray.cpp: In member function ‘QByteArray QByteArray::toBase64(Base64Options) const’:
qbytearray.cpp:3884:42: error: array subscript 1 is outside array bounds of ‘const char [1]’ [-Werror=array-bounds]
3884 | chunk |= int(uchar(data()[i++])) << 8;
| ~~~~~~~~~~^
qbytearray.cpp:37:24: note: at offset 1 into object ‘QByteArray::_empty’ of size 1
37 | Q_CONSTINIT const char QByteArray::_empty = '\0';
| ^~~~~~~~~~
cc1plus: all warnings being treated as errors
Fix, as so often, by caching the size().
The code in 5.15 is different, but similar, so picking all the way.
Pick-to: 6.4 6.3 6.2 5.15
Task-number: QTBUG-103923
Change-Id: Iac30e964c8d7d367620d16db65ceeaade33ee6b4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This was last used in 2011, before Qt 5.0 release, when QPA was yet
another windowing system, not the only option.
Change-Id: Ia4a094014ddb48cc9f6dfffd16f83aad1b7109e7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
They weren't flags. They were the version of Qt that was used in
compiling the application itself. The protection against rollback isn't
necessary any more, since qversiontagging.h, which applies to everything
and not just the main application binary. And using them to make
decisions on functionality or behavior is misguided (see previous
commit).
This commit does not deprecate the front-end classes' argument. In the
future, we may find some need for them.
Pick-to: 6.4
Change-Id: Ia4a094014ddb48cc9f6dfffd16f83a7b58ff95d3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
It's not used for anything, so remove the temptation of trying to use it
to make decisions at runtime about a behavior. It's the wrong tool for
the job: it might tell you the version of Qt the *application* was
compiled against, but not the version any of the Qt-using libraries
were.
Pick-to: 6.4
Change-Id: I175efddd75f24ae59057fffd16f70b77dd87faf4
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Snippet [22] was unused and the example using snippet [21] neglected
to show how its oldCategoryFilter got initialized, which is what [22]
does. But it turns out the example code was crashy in any case, as it
left the oldCategoryFilter uninitialized (albeit probably null) until
the call to installFilter() had returned, and installFilter() calls
the new filter, so the new filter needs to check oldCategoryFilter
before calling it. The doc also failed to explain why it's OK to not
defer to the prior filter in these calls during installFilter(), so
revise the doc and example so that the latter behaves sensibly and
readers of the former are likely to use the function safely.
This amends commit 8f0654ceb8 which
added the snippets and the use of one of them, but not the other.
Fixes: QTBUG-49704
Pick-to: 6.4 6.3 6.2 5.15
Change-Id: Iddb8d97b0bef417d8f16e7910730cfa59ea3e715
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
A QRect is unambiguous, and easier to parse than a custom rect format.
Change-Id: If8c197a5e522744b9629d5d89536df5c0da7308c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Apple Silicon Macs no longer expose display information through IOKit.
Luckily we can use the 10.15 localizedName property on NSString to
resolve the name.
Pick-to: 6.2 6.3 6.4
Change-Id: Ie75430df1a80808cb7b23d97d1e440d1f3bf75d6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Accessing a display that's offline may cause crashes,
so to be on the safe side we skip update requests in
this situation.
Task-number: QTBUG-102021
Pick-to: 6.2 6.3 6.4 5.15
Change-Id: I6b48b6722bccde628e510c538943d14f2b0271e5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This reverts commit 69e8a89358.
Reason for revert: the header is not present in all MSVC installations.
Change-Id: Ib809e59291ef30b9cbf6b4d61e27ea162e5d40b4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
On Android 13, currently in beta, android triggers a warning because it
is using a deprecated getDrawable function.
The patch changes it to use the non-deprecated alternative as suggested
in the warning.
Fixes: QTBUG-103568
Pick-to: 5.15 6.2 6.3
Change-Id: I3e629e7b75044bfb51874256895be0ec7e1088f8
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
The code incorrectly tried to ensure that the firstVisible tab was a
valid index, even though there might not be any visible tab left after
removing the last visible tab.
The same logic didn't exist of the lastVisible tab, so we tripped the
assert in qBound, as max (being -1) ended up smaller than min (0).
Fix this by removing the wrong correcting of firstVisible to be always
valid. Make sure we emit currentChanged with -1 when no visible tab is
left after removing the current tab.
Add a test.
Fixes: QTBUG-104003
Pick-to: 6.3 6.2
Change-Id: I27e6438a02d0a0f1ac4d0e0160cee4f33b3f3766
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
More specifically, if either minimum or maximum size are updated, make
sure that the current window geometry is updated so that it is within
the minimum and maximum sizes.
Previously, these constraints was only respected by the window manager
when the user resized the window.
For widgets this already worked, because a top-level widget will take
care of respecting these constraints if they are changed.
Since QWindow::setMinimumSize and QWindow::setMaximumSize started to
share so many common things, a new function (setMinOrMaxSize_helper())
is added.
Task-number: QTBUG-102771
Change-Id: Ia4b2680dcf865f84a3cf6424187f9a6036b76386
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
When the submenu is about to exceed the screen,
set the position of the submenu to the left border of the main menu
Fixes: QTBUG-104050
Change-Id: I8935f1bfceb93cfa1097391689f4233991394978
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>