Commit Graph

39274 Commits

Author SHA1 Message Date
Lorn Potter
0e100a4d89 wasm: add simd support
Emscripten only supports
SSE1, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, and 128-bit AVX instruction
sets at this time.
https://emscripten.org/docs/porting/simd.html

Browsers might need to enable simd support in the advanced
configurations
about: config or chrome:flags

Enable by configuring Qt with -sse2

Pick-to: 6.2
Fixes: QTBUG-63924
Change-Id: Ifeafae20e199dee0d19689802ad20fd0bd424ca7
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-10-05 11:30:06 +10:00
Alexey Edelev
ef623fd16f Fix __cpp_lib_hypot related error when building in macos
If __cpp_lib_hypot is undefined in macos you may observe the error:

  error: '__cpp_lib_hypot' is not defined, evaluates to 0 [-Werror,-Wundef]

Adding the explicit check for definition suppresses the warning that
is treated as an error.

Change-Id: Ie4c185fefde2f5bab699d8fc79b6a170e64af393
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2021-10-05 01:54:46 +02:00
Thiago Macieira
52377899d5 QPlugin: add error messages to the qt_get_metadata()
This is the already-loaded counterpart to the file scanning code

Change-Id: I3eb1bd30e0124f89a052fffd16a81f518fa95f0d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-04 14:01:44 -07:00
Thiago Macieira
279176aa5d QPlugin: simplify handling of exact results from Q{Elf,Mach}Parser
Those two scanners always return exact results, if the metadata is
present, so we don't need to re-scan (haven't needed since Qt
5.0). Especially since we scan from the end, we were spending cycles
doing unnecessary work.

Change-Id: I42eb903a916645db9900fffd16a4ccfdc7342278
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-04 14:01:43 -07:00
Thiago Macieira
461084b6c4 Q{Elf,Mach}Parser: harmonize the arguments passed
Both functions took a QString for the input file name, but while the ELF
parser had an optional QLibrary pointer (which was never null) where to
store the error string, the Mach-O parser received a pointer to a
QString. So make both of them take a single in/out QString pointer,
which has the file name on input and is cheap for us because of COW.

Drive-by fix the name of the static function in qmachparser.cpp from
"ns" (which stood for "not suitable") to "notfound".

Change-Id: I3eb1bd30e0124f89a052fffd16a8182f4f8541c3
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-04 14:01:42 -07:00
Thiago Macieira
349fb14c1d QPlugin: update the arch requirements to match the x86-64 ISA levels
When we created the functionality, the levels were not yet standardized.
Now they are and you can use -march=x86-64-v3 (for example) to get to
them. We're making a split between "v1" and "baseline" here for the
benefit of 32-bit, which is not included in the ISA levels.

Change-Id: I2de1b4dfacd443148279fffd16a397a700b9a15a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-04 14:01:40 -07:00
Thiago Macieira
16e7366b5c QPlugin: use one global metadata magic string
And use QByteArrayView where applicable.

Change-Id: I2de1b4dfacd443148279fffd16a39ec22908f75f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-04 14:01:37 -07:00
Thiago Macieira
788a7bfdb1 QPlugin: move some of the logic from moc's output to qplugin.h
This will allow us to make changes in QtCore itself, without having to
worry about moc compatibility.

The output uses an #ifdef so this version of moc can still be used to
compile earlier versions of Qt (usually, in cross-compilation
environments). See discussion in the mailing list[1].

[1] https://lists.qt-project.org/pipermail/development/2021-September/041732.html

Change-Id: I2de1b4dfacd443148279fffd16a39784c80c5f3b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-04 14:01:34 -07:00
Thiago Macieira
2adf444b5e QPlugin: change the generic metadata scan to forwards
The reason it scanned backwards was valid, but unfortunately that
doesn't work if the metadata magic appears in the debug info that comes
after the metadata.

Task-number: QTBUG-67461
Change-Id: I2bbf422288924c198645fffd16a9276767ca2589
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-04 14:01:32 -07:00
Thiago Macieira
f21522a4b4 src/corelib/plugin: sort #includes
Change-Id: I2de1b4dfacd443148279fffd16a3e4bdb1a49f88
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-04 14:01:31 -07:00
Thiago Macieira
96a1da00d2 QEventLoop: remove unnecessary bits of Qt 5 suggestion
Pick-to: 6.2
Change-Id: I2bbf422288924c198645fffd16a974803ab43b7f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-04 12:01:20 -07:00
Assam Boudjelthia
2028b80b6b CMake: Allow providing custom QT_ANDROID_SDK_BUILD_TOOLS_REVISION
The current CMake configuration sets QT_ANDROID_SDK_BUILD_TOOLS_REVISION
only internally, taking the latest build-tools found. A project might
still want to manually set specific build-tools version.

Pick-to: 6.2
Task-number: QTBUG-97002
Change-Id: I553563638160fdef7a27b9b334d1d9aae5d8b7e1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-10-04 21:17:07 +03:00
Albert Astals Cid
ae10084ef9 Respect font stretch if set together with font style
Fixes: QTBUG-77854
Change-Id: I2bf9cea9d5ecd151a9d96bbe93e9477a9159ca1f
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-10-04 16:10:11 +02:00
Albert Astals Cid
c89c145616 Fix QPainterPath with QFont::SmallCaps
Previous code was getting the QFontEngine from the font+script instead of from
the QTextEngine.

The font+script is not enough information to know if a given character is
smallcaps or not, while the QTextEngine actually has access to the information
needed and returns a properly a scaled fontengine if character is small caps

Pick-to: 6.2
Fixes: QTBUG-13965
Change-Id: I9f95bd2f3c3bdff76c3acb94fa2edc99cdeb0a13
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-10-04 16:10:04 +02:00
Edward Welbourne
3a8c8e7cf6 Remove an overly-complex assertion
It tried to sanity-check the correction being made to the time as a
result of converting zone to UTC, but handling also the case where the
correction avoided a gap. However, there are too many quirky cases to
permit a simple condition. The latest to trip it up is a case of a
zone leaving local solar mean time; a time in the gap that hits is
shunted by the width of the gap, which could be any old thing, and
won't show up on the data describing the zone before or after the
transition.

In any case, one branch of the check was doubling the zone's standard
time offset, which makes no sense. As that was checking for
double-DST, it would need to check standard offset plus twice the
usual DST offset; but the data it's looking at probably has its DST
offset set to the doubled one that needs to deal with. In general a
change in DST without going via standard time will have problems here,
and a change to standard time could also present problems.

Stop trying to shore up the assert and just trust the offset we got.

Change-Id: I4519f47e79dfb7595f4a12c259b80a338bc7033c
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-04 16:03:36 +02:00
Kai Köhne
e0ecb0ded2 Doc: Add overview pages to CMake API
So far the pages were only 'rooted' in the separate qtcmake
documentation. Let them have a page per module too, so that
it's easy to navigate.

At the same time rename the cmake-macros-qtcore group to
cmake-commands-qtcore. This will require a fixup in qtdoc
repository.

Pick-to: 6.2
Change-Id: Ifc09b27a6c220b5feab64686ca47c60d3342e71a
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-10-04 15:55:10 +02:00
Tor Arne Vestbø
d78245ce8f Fix reference to quitOnLastWindowClosed in WA_QuitOnClose docs
The property is nowadays on QGuiApplication.

Pick-to: 6.2
Change-Id: I8759761b08b0cdcef786ca96a7fa6364331f157d
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-10-04 15:55:10 +02:00
Kai Köhne
23125b3f01 Doc: Add summary to CMake commands
For normal \page elements, \brief is just showing in the
\generatelist or \annotatedlist commands. Make sure the description
is also visible in the actual CMake command/variable/property
page by defining a \summary macro.

Pick-to: 6.2
Change-Id: I12bc854d547059a2f6309a5922bb0b2a36d4e41c
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2021-10-04 15:55:10 +02:00
Andreas Buhr
1405c1d5bf androiddeployqt: only write enabled architectures to build.gradle
androiddeployqt writes a list of architectures into the build.gradle
file. This list should only contain the architectures which are enabled.
This patch adapts the generation of this list accordingly.
Amends 07cfab07a2.

Change-Id: I5c7c1886c54cc3b9a7e42af6eefbaf2a067a67d5
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-10-04 12:04:16 +02:00
Alex Trotsenko
a8823db578 QRingBuffer: port internals from int to qsizetype
Since Qt6, QByteArray uses qsizetype as an integral type for offsets
and sizes. In order to support large blocks, we have to migrate to
that as well.

Change-Id: I2c2983129d6a2e0a1e8078cc41d446a26e27288c
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-03 21:01:51 +03:00
Ievgenii Meshcheriakov
9a3f4afb70 Remove checks for features available in C++17
This patch removes most of the checks that are made using C++20
__cpp_* macros for features available in C++17 and earlier.
Library feature check macros (__cpp_lib_*) are unaffected.

Change-Id: I557b2bd0d4ff09b13837555e9880eb28e0355f64
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-02 17:54:39 +02:00
Assam Boudjelthia
a1e7c441de Android: remove comments from the manifest file
The comments are not needed, since we're adding a docs page
for the manifest, which include the information from these
comments and more. Keep the manifest clean.

Pick-to: 6.2
Task-number: QTBUG-95285
Change-Id: I1fd8bc695f5aab1bcc69f549cb3ddeeaac168b98
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2021-10-02 12:11:23 +00:00
Assam Boudjelthia
eb0a783e63 Android: fix Gradle version in qt_attribution file
The Gradle version in qt_attribution.json doesn't mention the actual
version that is currently used.

This amends 67c3f3f4ff.

Pick-to: 6.2
Fixes: QTBUG-71328
Change-Id: I50fbabd56beb44389f9453666822f9667bab7d61
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-10-02 12:11:16 +00:00
Fabian Kosmale
55689e301c Purge Q_NO_TEMPLATE_FRIENDS and platforms lacking support for them
Given that we rely on C++17, it should be safe to mandate that level of
language support.

Change-Id: If07ccb36bea2a5113a8f5aacf635be7d2590baf7
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-02 12:47:43 +02:00
Karsten Heimrich
fe360a9d52 Replace 0 with nullptr
Change-Id: I9ee25644a3e066391e881bd2f64274909eabfcbf
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-10-02 12:37:27 +02:00
Giuseppe D'Angelo
b4e290a9ab Update PCRE2 to 10.38
[ChangeLog][Third-Party Code] PCRE2 has been updated to version 10.38.

Change-Id: Ib6ab544790747a94a00b8eb516314ff3c57e4c79
Pick-to: 6.2 5.15
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-02 09:28:19 +02:00
Thiago Macieira
f6fa78fd60 QByteArrayMatcher: add QByteArrayView overloads
The modification to the existing constructor was necessary to avoid
ambiguous overloads from plain strings. They'd previously only match
QByteArray, but now they match QByteArrayView too.

The QByteArray constructor must stay even in Qt 7 because the pattern is
stored. The QByteArray indexIn also stays in because of ambiguous
overloads. Unless we want to remove the const char* overloads.

Change-Id: I2bbf422288924c198645fffd16a92859b67f3978
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-01 14:23:15 -07:00
Tor Arne Vestbø
90c54b02f8 Fix scrolling of QRasterBackingStore when operating on QRasterGLSurface
We were to strict in what surface type we allowed scrolling for. The
RasterGLSurface type is an odd one, used by widgets to compose GL
and raster content, which means we still have a raster backingstore
we can scroll. It's just the flush that's different.

Pick-to: 6.2
Change-Id: Ia229c21c00ad38df9e87f4fc78e341e030ef228d
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-10-01 20:12:15 +02:00
Edward Welbourne
f8a5bb3c32 Use %.6g rather than %s and QByteArray::number()
The comment against the use of this claimed qvsnprintf() lacks 64-bit
support, which is probably untrue by now but certainly irrelevant as
the value being formatted is a qreal, not a 64-bit integral type.
Since %g wants a double, make the value passed explicitly double by
casting its denominator. Casting its numerator to qreal was
superfluous as that's its type already.

Change-Id: I5ff885fbeb9b638b2b0507061e0a19e3b8522143
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-10-01 19:24:31 +02:00
Edward Welbourne
09fd398959 Clean up QXmlTestLogger's xmlQuote() and xmlCdata()
Make the overloads taking a size private (they're only called by the
implementation of the others) and have them take qsizetype for the
size, rather than size_t. Make the still-public ones consistently
return 0 on failure and move the documentation to them.

Change some spurious checks (QTestCharBuffer::size() is necessarily
positive) to assertions, use '\0' for the nul character to make it
visually distinct from the integer 0. Use a do..while loop instead of
break-ing out of the tail of a for (;;) loop. Remove spurious extra
nul-termination - the function taking size alread did that, so the
wrapper to size-expand needn't. Minor style cleanups.

Change-Id: I7440f3d9be5e3b2dd88c2aad62bcd1af9fc02278
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-10-01 19:24:31 +02:00
Edward Welbourne
427be739ff Tidy up QTest::qt_asprintf() and remove a spurious declaration
The extern declaration for filter_unprintable() was nowhere used and
no such function is anywhere defined.

The for (;;) loop with lots of reasons to break; was better structured
as a do {...} while loop. A comment on -1 as return from qvsprintf()
was misplaced. The '\0'-termination after calling qvsprintf() was
redundant as vsprintf() reliably '\0'-terminates anyway. Turned a
static const into a constexpr. Assert size (a QTestCharBuffer
necessarily has size >= 512).

Change-Id: I5b7729b9bd66fea0ee7ce3e7cfdde6770f10b36c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-10-01 19:24:31 +02:00
Joerg Bornemann
b88095e644 Disable the dnslookup feature for INTEGRITY
The QtNetwork project file excludes the dnslookup source files for Unix,
despite the dnslookup feature is always on.  This inconsistency leads to
linker errors when building applications against QtNetwork:

  (error #412) unresolved symbols: 1
   QDnsLookupRunnable::query(int, const QByteArray &, const QHostAddress
   &, QDnsLookupReply *) from libQt6Network.a(qdnslookup.cpp.o)

Turn the feature off for INTEGRITY and remove the condition from the
project file.

Pick-to: 6.2
Change-Id: If086da51ca343f598eb273236e7b6338f5da1e97
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-10-01 18:51:07 +02:00
Ivan Solovev
51e8d3592a Let QLocale::uiLanguages() use WinRT API when possible
This patch introduces support for the WinRT UI languages API.
We are using the Win32 API to get the list of preferred languages when
the system locale is used. However, this API returns an incomplete
list.
As Qt 6 supports Windows 10 and above, we can make use of the WinRT
API, if it's supported by the compiler. This API returns the full list,
as reported by the Windows system itself.
Note however, that this API can't be used with Clang and MinGW, so
we still have to fall back to Win32 API for these compilers. We also
do it if WinRT API returns an empty list of languages for some reason.

Fixes: QTBUG-94341
Pick-to: 6.2
Change-Id: I1d23c68d2ec298ae7835d0d18718876ff041aede
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-10-01 18:51:07 +02:00
Joerg Bornemann
f6cd55445d Don't export Qt6::ATSPI2_nolink target in Qt6GuiTargets.cmake
We don't have any APSPI2 includes in our public headers and should
therefore not export the target that provides ATSPI2 include paths for
consumers.

Link against PkgConfig::ATSPI2 instead of the _nolink target.
The former will not be exported.

Pick-to: 6.2
Fixes: QTBUG-97023
Change-Id: I4b12e0c2230917feeb963c02565e6db24f757bd3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-10-01 18:51:07 +02:00
Luca Di Sera
c6ae39c45f Doc: Replace broken link to Roman Czyborra's personal page
The `QFont` documentation refers to Roman Czyborra's personal page with
the intent of providing information about encodings.

The page seems to have been down for many years and may contain
information that is now deprecated such that it is now replaced with a
link to the Unicode Technical Report 17 about the Unicode Character
Encoding Model.

The new link was chosen as a substitute as it seems to cover or provide
the intuition for, standing by the last captured version of Roman
Czyborra's personal page on the Wayback Machine, many of the same
concepts.

Task-number: QTBUG-96127
Pick-to: 6.2
Change-Id: Ibf901b5023688c14efb3d6f77a10609f7ba80e72
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-10-01 18:51:07 +02:00
Raphael Cotty
cdfcb98bc0 androiddeployqt: Allow to also provide multiple qt install directories
The "qt" property can also be filled with a json object like this:
"qt": {
    "x86":"/home/.../Qt/6.3.0/android_x86",
    "x86_64":"/home/.../Qt/6.3.0/android_x86_64",
    "arm64-v8a":"/home/.../Qt/6.3.0/android_arm64_v8a",
    "armeabi-v7a":"/home/.../Qt/6.3.0/android_armv7"}
That allows to update the options.qtInstallDirectory when changing the
current architecture.

The "qtHostDir" property is also added to provide the path to the qt
host installation (rcc, qmlimportscanner).

Change-Id: I3f0c36cc7a7030d45adc1a4dccaaad61dd538aea
Task-number: QTBUG-88841
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-10-01 18:51:07 +02:00
Morten Johan Sørvig
9875869d31 wasm: fix runOnMainThread()
Calling emscripten_async_run_in_main_runtime_thread_()
with a pointer to a static lambda was too clever, use
an anonymous function as callback instead.

Pick-to: 6.2
Task-number: QTBUG-94344
Change-Id: I2d8a8b0ffc2dd1d02018aa5902550216d00f641d
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2021-10-01 18:30:26 +02:00
Ivan Solovev
1f86957f1d QWinRtFunctions::await() - introduce early exit condition
The await() method waits for the result of async operation in a
non-blocking way (triggering processEvent periodically).
It means that during this wait some other things might happen, and
there would be no reason to wait for the end of the operation execution.

This patch implements an additional parameter - a function that specifies
a condition for an early return. When this function returns true, the
await() method returns with E_ABORT, which makes it possible to
distinguish it from timer expiration.

Task-number: QTBUG-96057
Pick-to: 6.2 5.15
Change-Id: Ide73d768b7cbb3a35be7160ce7555aeb2dca5235
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi>
2021-10-01 18:03:29 +02:00
Paul Wicking
0acada9c7b Doc: Use correct \relates target
\relates takes a class name as argument, but doesn't deal nicely
with a templates full definition.

Pick-to: 6.2
Task-number: QTBUG-97028
Change-Id: I7c608717c5d552bc553073534104dece01b8ff96
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2021-10-01 17:35:42 +02:00
Volker Hilsheimer
132d6d0127 QFontCache: don't start cleanup timer if we are not in the main thread
We can only start timers in threads started via QThread, and even then
we cannot assume that the thread runs an event loop. So only start the
timer when we are in the main thread.

Add a test that verifies that we don't get the warning message.

Pick-to: 6.2
Change-Id: I40d7d9ff115720f9ecd3eedaebbade2643daf843
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-10-01 16:46:48 +02:00
David Faure
18bb10373a QAbstractItemView: fix crash if setData() does a model reset
Task-number: QTBUG-96654
Pick-to: 6.2
Change-Id: I2dca4af387ef5ad549a1a41fba2bc6de217f4ea9
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-01 13:24:17 +00:00
David Faure
ccf504abee QTextImageFormat::setQuality: deprecate the default value
Change-Id: Ia4532a7dd6eb6c0356aeea2dca0ae585ab9b1ffd
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-01 14:15:38 +02:00
Timur Pocheptsov
f2de001d84 Include <QHash> explicitly
Not relying on some implicit include coming from other include.

Pick-to: 6.2 5.15
Fixes: QTBUG-96621
Change-Id: I11f6a20e98871eacee51ad723c484f25916c2882
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-01 12:36:48 +02:00
Allan Sandfeld Jensen
9a6c653eaf Cleanup of qthreadpool
Don't bother overwaiting in waitForDone(), if it was done at one point
after it was called we can return true. And do not stop threads recently
awakened by a startThread call as they have tasks to do.

Make allowing at least one thread regardless of reservation more
standard instead of hacked in certain places.

Pick-to: 6.2
Change-Id: I304bcdc5822f440d5e72fc33ba2aa1678c9ba0d0
Reviewed-by: David Faure <david.faure@kdab.com>
2021-10-01 12:01:21 +02:00
Volker Hilsheimer
2fea6bbe8e Allocate synchronously delivered QWSI events on the stack
If we know at compile time that a window system interface event will be
delivered synchronously, then we can allocate it on the stack avoid a
new/delete. This is the case for a large number of events.

Add a template helper class that is specialized for the three delivery
types to allocate the event object on the stack if possible, and on the
heap otherwise. We can use that factory in the event handler functions,
via a helper function, to replace the heap-allocation and call to
handleWindowSystemEvent.

Done-with: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Change-Id: If92fc91ef07f3542a37dfb0fed20e15a3d19b8f0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-10-01 06:28:22 +02:00
Ievgenii Meshcheriakov
49d94bbb41 Assume that <variant> header is always present
This header is a C++17 feature that is already used unconditionally
in qtypeinfo.h.

Change-Id: I26330d298e95102f3e94c0c69fc95c1025666eb4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-10-01 02:46:27 +02:00
Ievgenii Meshcheriakov
44a7412795 Remove checks for C++ standard versions C++17 and below
Qt requires a compiler that support C++17 thus __cplusplus
is always 201703L or higher. This patch removes checks
for __cplusplus value that always succeed.

Change-Id: I4b830683ecefab8f913d8b09604086d53209d2e3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-10-01 02:46:09 +02:00
Volker Hilsheimer
79f62380f0 QAbstractItemView: Fix IM input starting edit session
Item views can open an editor widget on the first key press, and need to
take special care not to break input methods. The initial key press
starts compositing by the system input method, which is then interrupted
by the focus transfer to the editor.

To solve this problem, the widget needs to keep focus while the initial
composition is ongoing, and only transfer focus to the editor once the
composition is either accepted or cancelled by the user. Add a state flag
that is set during this initial preedit phase.

During this initial composition, the item view will receive all input
method events, and needs to forward these to the open, but not yet focused
editor for the user to get the correct visual feedback during the preedit
phase. The item view also needs to report to input method queries on
behalf of the editor to make sure that the IM UI is correctly positioned
without covering the user input.

Implement a test that simulates the sequences through synthesized
QInputMethodEvents; we can't simulate the entire system input stack.

Fixes: QTBUG-54848
Change-Id: Ief3fe349f9d7542949032905c7f9ca2beb197611
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-10-01 01:48:50 +02:00
Karsten Heimrich
55ab987c9a Fix QDir::entryList to work for directories that end with '.lnk'
In addition to checking the .lnk extension, check that the
the specified path is not a path to a directory.

Pick-to: 6.2
Fixes: QTBUG-85058
Change-Id: I83cef3d94c6ffa82a88f374c5b41779e88fe40b8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-09-30 21:20:25 +02:00
Volker Hilsheimer
b1b75326f4 macOS: fix window deactivation when a popup is open
On macOS, we get explicit notifications when a window becomes or resigns
the key, before we have had a chance to close open popups. The popup is
then closed later, but the delivery of the WindowDeactivate event has
already been aborted as QApplication interprets such notifications while
in popup mode as delayed focus events.

This leaves the focus widget still displaying focus even though its
window is no longer active. Trying to activate the window again then
does not correctly transfer focus.

To fix this, close all popup explicitly when a window resigns key.

Task-number: QTBUG-78750
Fixes: QTBUG-66513
Fixes: QTBUG-69710
Pick-to: 6.2
Change-Id: I590757c7d3532dbe4b5358a8e121ce8aa871a699
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-30 18:35:12 +02:00
Andreas Buhr
07cfab07a2 Specify Android architecture in gradle files
When building for armeabi-v7a, building and APK using
"ninja foo_make_apk" works. Building it by calling
"gradlew assembleDebug" works. Opening the "android-build" folder
in Android Studio and clicking the "Build" button works.
But clicking the "Run" or "Debug" button in Android Studio does not
work when the attached phone is arm64-v8a. Then Android Studio
automatically selects the v8 architecture which does not find the Qt
libraries. This patch adds explicit ABI selection to the gradle
configuration files. With explicit ABI selection, Android Studio does
not try to outsmart you.

Pick-to: 6.2
Fixes: QTBUG-96701
Task-number: QTBUG-87022
Change-Id: I4ad6356c38b7eca004c0e0dbbb357cab7de84c0f
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-09-30 17:27:16 +02:00
Morten Johan Sørvig
8d8448a1f5 wasm: limit exec() workarounds to the main thread
This fixes a bug where calling exec() on a secondary
thread would make the thread exit.

Task-number: QTBUG-94344
Pick-to: 6.2
Change-Id: I259c7ebbd53271609af88aca141d88c282cbcd34
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2021-09-30 11:58:34 +00:00
Oliver Wolff
8d6e825ddf windows qpa: Handle invisible child windows gracefully on dpi changes
Fixes: QTBUG-96466
Pick-to: 6.2
Change-Id: I58d90e85b4bb837df2dc5fd89abe984dadcd468d
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-09-30 13:58:34 +02:00
Andreas Buhr
95ef193715 Rename variable to not reference Qt5
In the Android gradle files, the variable qt5AndroidDir refers to Qt5
and might confuse users. This patch renames to qtAndroidDir.

Pick-to: 6.2
Change-Id: Ib18a3cd2c38646e4c6c0435dae9234f0f7887eb5
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-09-30 13:58:34 +02:00
Volker Hilsheimer
f6befd3e63 Clean up QApplication::notify code
Store isWidgetType and isWindowType once to avoid multiple tests, and
use a single QWidget* variable for widget receivers once we handle those
explicitly, rather than separate declarations for each event type.

Fix indentation to make it more obvious that the entire switch statement
is only executed for widget receivers.

Remove unreachable code for QGraphicsWidget key handling. At that point,
we already know that the receiver is a widget, which QGraphicsWidget is
not, so this code was never executed anyway.

Minor clean-ups, coding style improvements, and standardisations of
repeating patterns.

Change-Id: Idfe944f041ae82372b17082a5ffc4df13802359b
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-09-30 13:41:55 +02:00
Andreas Buhr
44c8ae5543 Add error messages in case system library directory does not exist
On Android, when the system library directory does not exist,
no error message was given. This led in turn to error messages like
Can't find 'nulllibQt6Core_armeabi-v7a.so'
which are not very helpful.

Pick-to: 6.2
Task-number: QTBUG-80766
Task-number: QTBUG-96701
Change-Id: I4187e4a68d9e78e198152306a3e664c30c51ab18
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-09-30 12:27:59 +02:00
Fabian Kosmale
4f897584ec QMetaType: Expand and clean up converter/view function documentation
This adds a few snippets to show how the functions can be used, and also
removes workarounds for oldver versions of qdoc that weren't clang based
- those workarounds also seem to have caused some bitrot.

Remove documentation for an overload of registerMutableView that
currently does not exist (for a member function with an ok parameter).

Fixes: QTBUG-96963
Pick-to: 6.2
Change-Id: Ibc867d08bcacbc7add8c965df9864d6f339a5d54
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-09-30 08:26:13 +02:00
Thiago Macieira
684c9b82b9 QDateTime: fix build with MinGW: need unistd.h very early
qobject.h has #include <chrono>, which #includes <ctime>, which includes
<time.h>.

datetime.cpp:2621:23: error: 'localtime_r' was not declared in this scope; did you mean 'localtime_s'?

Pick-to: 6.2
Change-Id: I2bbf422288924c198645fffd16a922719c4ce7d4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-09-29 13:18:21 -07:00
Eirik Aavitsland
6d41b64d45 Avoid generating large pdf files when using dashed cosmetic pens
There was a bug in the pdf writer for cosmetic pens when they were
drawn using native pdf strokes (QTBUG-68537). The workaround that was
done for that bug was to disable native atroking for such pens, so
they would always be emulated. The drawback of that was that painting
with dashed cosmetic pens would then produce unexpectedly large pdf
files, since it would contain individual strokes for every dash.

This change fixes the original bug and removes the workaround,
re-enabling native stroking for cosmetic lines.

Pick-to: 6.2 5.15
Fixes: QTBUG-86094
Change-Id: I58d06ad2db81206025ca2de394f072e822c03d47
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
2021-09-29 22:07:43 +02:00
Eirik Aavitsland
2cb42cd849 PDF generation: disentangle native pen from transforms
In the PDF engine, transforms are implented with a global pdf
transform if and only if the current pen is "simple", that is,
renderable by a native pdf pen. For non-simple pens, the painted
objects are transformed by QTransform instead. Hence, the internal
simplePen flag was used to indicate both a pen state and a transform
state.

This commit splits these two states into separate flags. No behavior
is changed, but it prepares for an improved implementation of cosmetic
pen rendering.

Pick-to: 6.2 5.15
Task-number: QTBUG-86094
Change-Id: If02e1dfc021778e3db7c9ff9a1ed35b3d6cbf3f8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
2021-09-29 22:07:43 +02:00
Giuseppe D'Angelo
0dc6cc0551 MSVC: enforce that we are under /permissive-
MSVC defaults to a C++ dialect which is not standard-compliant. For
a number of years, it has offered a switch (/permissive-) to enable
standards conformance, but it was entirely opt-in. While we do build
(and test) Qt under /permissive-, our users do not necessarily do
that for their own software.

Meaning, we risk subtle bugs and build issues for the code present
in our headers (because users may use them in non-/permissive- mode).
This has already happened multiple times (QTBUG-95880, as well as
19b5520abf).

So far, we couldn't *enforce* /permissive- for client code, as MSVC
didn't deem it stable, and various SDKs (like Windows') were not even
building under it.

This has now changed. /permissive- is now deemed fully stable and
supported, and turned on by default when using /std:c++20 (since VS 2019
16.11 [1]). So, starting from 6.3, we can now pretend its presence.

Unfortunately /permissive- does not set any special macros for us to
test [2], so test one of its side-effects: that an implicit conversion
from std::nullptr_t to bool is ill-formed (the conversion is explicit).

[1] https://devblogs.microsoft.com/cppblog/msvc-cpp20-and-the-std-cpp20-switch/
[2] https://developercommunity.visualstudio.com/t/Pre-define-a-macro-when-compiling-under/1253982?space=62&q=permissive-+sfinae&entry=myfeedback

[ChangeLog][Platform Specific Changes][Windows] When using MSVC
Qt now requires standards compliance mode. This requires passing
the /permissive- command line switch. Note that when using C++20 or
above, the /permissive- switch is implied by default.

Change-Id: I464ed36ff707fa3ada52c543433a6b0ab715748e
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-09-29 18:01:29 +00:00
Andreas Buhr
00a5d9f849 Fix building of unit tests for Android in developer build
Currently it is not possible to build unit tests for
Android in a developer build.
This patch fixes this.

Fixes: QTBUG-94882
Change-Id: I30ccacc4536032ee3a7fbf05ce90bbbcdb8331a6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-09-29 17:50:49 +02:00
Dan Ackers
a0e605e458 Remove hack fix from vulkan qnx building
Pick-to: 6.2
Task-number: QTQAINFRA-4502
Change-Id: I3ca6cb79f60e18f64323d30e44ea1660efdc54bb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-09-29 14:59:25 +00:00
Ilya Fedin
4e71603412 Implement preview support for GTK file dialog
This adds preview support in GTK file dialog implementation,
this is helpful for a lot of applications
like image viewers, messengers and etc.

[ChangeLog][Platform Specific Changes][Linux] A native GTK
file dialog (created via QFileDialog or QtQuick.Dialogs)
now shows an image preview pane.

Task-number: QTBUG-3796
Task-number: QTBUG-53167
Change-Id: Ib80108c09b84d774440a0445adcccab4b64652ef
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-09-29 11:17:03 +00:00
JiDe Zhang
71ba53e3a7 Fix memory leak
Destroy the QDBusPendingCallWatcher object when received
the QDBusPendingCallWatcher::finished signal later.

Pick-to: 5.15 6.2
Change-Id: I1ec67bf7c286f38200c374ad92df2a1579588a8a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-09-29 01:33:01 +00:00
Ievgenii Meshcheriakov
52ad59f9ea QThread: Reset the system thread ID when thread exits on Unix
Unix QThread implementation stores pthread_t as a system thread ID
when the thread is created, but never resets the system ID when
those threads are destroyed. Some implementations may reuse the
same thread IDs for new threads, and this may cause QThread::wait()
to erroneously complain that "Thread tried to wait on itself".

This patch sets the system thread ID to nullptr when the thread is
about to exit and be destroyed by the system.

A regression test is added to tst_qthread.

Fixes: QTBUG-96846
Pick-to: 5.15 6.2
Change-Id: I0850425dd0e09af50e59c9038e7e662a2a624beb
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-09-29 01:53:49 +02:00
Laszlo Agocs
fea1d57c2b rhi: gl: Do not issue memory barriers when we do not have to
First, issue glMemoryBarrier() only if the read-after-write or
write-after-write occurs for a write involving incoherent memory
access.  In practice this means a QRhiTexture with UsedWithLoadStore
or a QRhiBuffer used as an SSBO. Doing the barrier call for other
types of texture or buffers is pointless, and potentially
wasteful. What is more, some OpenGL implementations feature bugs that
manifest themselves when glMemoryBarrier() is called, see associated
Jira issue for details.

Second, reduce GL_ALL_BARRIER_BITS to the ones relevant for the type
of the resource, in an attempt to provide a minor optimization. Real
fine-grained resource usage tracking is not implemented for OpenGL so
this still means specifying all buffer-related or all texture-related
barriers together, but this is still better than all. As the usage of
compute is quite close to zero in Qt at the moment, this won't make
much of a difference in practice.

Fixes: QTBUG-96322
Pick-to: 6.2
Change-Id: Ibf794e2e8a4cbc3c69acaa88476e85de6646b605
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-09-28 17:58:56 +02:00
Samuel Thibault
6802065da8 Accessibility Linux: Fix caps lock state
Currently in QSpiApplicationAdaptor::eventFilter, the
ATSPI_MODIFIER_SHIFTLOCK flag (actually capslock modifier) only set
when the capslock key is kept pressed, not when the capslock modifier
is enabled.

Orca however really needs to know the capslock modifier state, to be
able to properly determine whether to enable/disable capslock when the
user presses double-capslock.

Task-number: QTBUG-84225
Pick-to: 6.2 5.15 5.12
Change-Id: I98ab8b7261c5560ebad49410b1358b2279080ec8
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2021-09-28 15:58:56 +00:00
Volker Hilsheimer
223066d431 Don't clear focus if setParent doesn't change the parent
QWidget::setParent might be called to change the window flags, without
changing the parent. For those cases, we don't have to clear the focus.

Decouple the newParent state from the wasCreated flag. In most places
where newParent was tested, wasCreated was either tested previously and
can't be false anyway, or the code executed is irrelevant for widgets
that are not yet created (there can't be a paint manager). In the
remaining case, test wasCreated explicitly to maintain existing logic.

Add test for the cases where the previous code broke the focus, both
for QWidget and QDialog.

Fixes: QTBUG-93005
Pick-to: 6.2
Change-Id: I39dc179c2d348054de3927aa8b69eecef4935511
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Doris Verria <doris.verria@qt.io>
2021-09-28 17:42:57 +02:00
Eirik Aavitsland
fbd3b00e0b Update the COPYRIGHT.txt file
With the contents from src/jversion.h

Pick-to: 6.2 5.15 5.12
Change-Id: I3d4d2b40b3ed6576655b97b1709ee42c9c81ebe7
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-09-28 17:06:57 +02:00
Eirik Aavitsland
66a44f4eba Preserve QImage metadata when converting format with color table
Unlike the other conversion functions, convertWithPalette() did not
call copyMetadata().

Fixes: QTBUG-96926
Pick-to: 6.2 5.15
Change-Id: I2b171cec16bc5a90d33e80d6fe178c650ed3fe36
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-09-28 15:59:31 +02:00
Gong Weia
a2ab67c8b2 qwindowswindow: fix return nullptr
fix return nullptr rather than 0

Change-Id: Ic8e04e5b8bc732a7ffba5a708caee4326abf7168
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2021-09-28 21:51:26 +08:00
Ievgenii Meshcheriakov
05870db7d0 QThread: Remove superfluous initialization of threadId on Unix
The thread ID is already initialized inside QThread::start() while
the thread lock is taken. This is completed before the attempted
initialization in QThreadPrivate::start() because it tries to take
the same lock.

Task-number: QTBUG-96846
Pick-to: 5.15 6.2
Change-Id: Ic9588f3e2e2f3c2180afbed8ec01155b33043eb3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-09-28 13:42:16 +02:00
Eskil Abrahamsen Blomfeldt
416fbfa5a0 Use Yu Gothic UI as the main fallback font for Japanese
Using MS Gothic UI as the fallback on Japanese locale has been
outdated for many years. The default font on Japanese is Yu Gothic UI,
and this caused mismatches between Japanese text when using the
fallback and when just relying on the default.

[ChangeLog][Text] Made the primary fallback font on Japanese
locale "Yu Gothic UI" (the default system font).

Fixes: QTBUG-96689
Pick-to: 6.2
Change-Id: I9cf34410619ff4a2ceb9b03d523018c5061c3634
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-09-28 06:19:54 +00:00
Volker Hilsheimer
e7bb3a8bd3 Fix crash if receiver destroys itself in closeEvent
We allow QWidget::closeEvent to "delete this", and verify that this works
in the tst_QWidget::testDeletionInEventHandlers test function. Sadly,
that test didn't reliably catch the issue introduced in
28b14b966f, where the receiver is accessed
after the delivery of QEvent::Close.

Handle the QWindow event delivery explicitly so that we don't need to
access the receiver after the event has been delivered.

There's nothing we can do to make the test fail more reliably in CI.
A QWindow deleting itself in closeEvent will still crash; perhaps we don't
want to allow that anyway.

Change-Id: I2b5c2d11ded71c4f22ae9862cdc459e1f93b3374
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-27 19:34:49 +02:00
Joerg Bornemann
a0e56294c1 Skip unnecessary commands when cross-building tools
Introduce a new macro qt_internal_return_unless_building_tools which
simply calls return() if tools are not built.  This macro is supposed to
be called after qt_internal_add_tool().

Using this macro avoids having to special-case code for when
qt_internal_add_tool() creates imported targets in cross-builds.

Adjust pro2cmake accordingly.

Task-number: QTBUG-85084
Change-Id: I9e1c455c29535dd8c318efa890ebd739c42effc1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-09-27 16:34:23 +02:00
Edward Welbourne
326d94e94b Document QTestLog's enums
Task-number: QTBUG-96844
Change-Id: I9af60ef0cf3def699e58b3477b647f2e071afa40
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-09-27 12:21:44 +02:00
Edward Welbourne
ee57d6b62e Fix various minor documentation errors in QAbstractTestLogger
Change-Id: I30ad67479b578b00557671cfa25631be0b6e4fb9
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-09-27 12:21:19 +02:00
Edward Welbourne
87fedbbf70 Coding style: correct spacing in XML test logger
Put stars after spaces, not before; indent cases level with switch.

Change-Id: I1dc29d0729d5be449b8123e15510177d814d42da
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-27 12:20:58 +02:00
Thiago Macieira
f000d5672a QPlugin: reorganize findPatternUnloaded and remove two bool variables
The compiler ought to figure them out, but we can just help it.

Change-Id: I42eb903a916645db9900fffd16a4981ac966f982
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-09-24 20:16:36 -07:00
Thiago Macieira
57960ab075 Q{Elf,Mach}Parser: simplify the return codes
The multi-state return code was a legacy of how Arvid wrote the ELF
parser code back in the day, the fact that it scanned for two different
types of plugins in Qt 4 and that the metadata could exist in different
places.  None of that matters nowadays: who cares if the file is a
corrupt binary, not a valid binary, does not have the right
architecture, or has no suitable section? It's not a plugin, period.

The Qt 4 plugin mechanism was removed for Qt 5.0 in commit
7443895857 ("Remove support for Qt 4 style
plugins").

Change-Id: I42eb903a916645db9900fffd16a442d800399b98
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-09-24 20:16:05 -07:00
Volker Hilsheimer
a03a67fbfa macOS: Remove special cases in enter/leave event handling
The Cocoa QPA plugin no longer tracks popups, but dispatches enter/leave
events when popups show and hide. So the special handling in tests and
QWidgetWindow can go away now.

Change-Id: Ib6ef00689de231996e5e57ecdd8fd0d4c861d68b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-24 21:37:06 +02:00
Thiago Macieira
0be5bf3e64 QPlugin: don't use QFile::read() if map() fails on Unix
If we can't mmap(), then libdl won't be able to either.

Pick-to: 6.2
Change-Id: I42eb903a916645db9900fffd16a492a1ac25903f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-09-24 11:40:44 -07:00
Volker Hilsheimer
a5e5943d8a macOS: send enter/leave when a window opens/closes
Since macOS doesn't give us any event when a modal window opens,
we need to do so ourselves explicitly so that the current mouse
window gets a leave event when e.g. a popup opens, and an enter
event when the popup closes again. The case for modal dialogs is
partially handled by QGuiApplication already.

Note: We cannot rely on the transientParent of the opening/closing
window, as it's nullptr for QMenu windows even if the QMenu has
a widget parent.

Add a test for enter/leave events when a secondary window opens,
covering both the dialog and the popup case. For the dialog case,
we sometimes get two Enter events when the dailog closes, which
we have to tolerate for now.
To make the test pass on b2qt platforms, fix the offscreen plugin
to explicitly send enter/leave events in the same way as Cocoa
now does.

Fixes: QTBUG-78970
Pick-to: 6.2
Change-Id: If45e43e625e8362c3502c740154f6a6a8962b9e9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-24 19:19:42 +02:00
Tor Arne Vestbø
8da42e1af6 macOS: Don't pretend like our backing store is a QRasterBackingStore
We're not using the internal m_image of QRasterBackingStore, nor its
m_requestedSize, so inheriting it was just causing confusion when we
ended up in QRasterBackingStore::scroll(), operating on those members.

Pick-to: 6.2 5.15 5.12
Change-Id: I26561209c0a19777577724728f0ad62e07673577
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-09-24 18:42:23 +02:00
Lars Knoll
9481de80b7 Fix compile error on Android
Remove an unused and deprecated enum value that was giving
compile errors due to a missing case statement when compiling
locally with -developer-build.

Pick-to: 6.2
Change-Id: Ieca2124beda122f603acfd1b5f5746284a8a1a6c
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-09-24 14:37:02 +00:00
Assam Boudjelthia
bbf115dec0 Android: fix error when signing bundles
The jarsigner command that was being used was malformed before the
file path leading to wrong signing command. A sample of the malformed
command part "-storepass password⍣/path/to/package", note the char
after 'password'. So having auto produces a QStringBuilder that's
returning the malformed char.

Fixes: QTBUG-96838
Change-Id: I5477f6913a74d79ebaf029ef7f4e2745c9f7ced0
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit f492790611fe15a4745c8ad0c97259f438c91b6b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-09-24 13:45:07 +00:00
Craig Scott
03104825d2 Add docs for qt_extract_metatypes()
Also tidy up the inline TODO comments to reduce duplication and address
some minor inconsistencies.

Task-number: QTBUG-95712
Pick-to: 6.2 6.2.0
Change-Id: Ic0d27f3c0a356fd311bba95de967faaea05e0f0a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-09-24 22:41:31 +10:00
Craig Scott
3ce0672143 Add docs for qt_set_finalizer_mode()
Task-number: QTBUG-95712
Pick-to: 6.2 6.2.0
Change-Id: Ie7b9282cfc6a27415db5e623a66317c9681c3991
Reviewed-by: Luca Di Sera <luca.disera@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-09-24 22:07:24 +10:00
Alex Trotsenko
d3a622f817 Revert "QProcess: do not emit aboutToClose() twice"
This reverts commit efb90f6e7e.

Reason for revert: behavior change for signal listeners

Change-Id: Ibe3c5d496cd61a9fccab17a10cc9fda8334fc9d4
Reviewed-by: Björn Schäpers <qt-codereview@hazardy.de>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-09-24 05:57:47 +00:00
Shawn Rutledge
11fc0e7fb3 Register Wacom tablet devices on cocoa
After 6589f2ed0c it's possible and expected
that each platform plugin will register the input devices it discovers.

Task-number: QTBUG-46412
Pick-to: 6.2
Change-Id: I76c9252bc14c5c8e6af3ecc9b26211f6f301103d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-23 18:51:24 +02:00
Luca Di Sera
fc73b585f8 Doc: Update Microsoft's Documentation Links
The documentation links on `msdn.microsoft.com` now redirect to
`docs.microsoft.com`.

While the redirection works, our script to catch broken links on
dev-snapshots builds of the documentation doesn't handle redirection
correctly, reporting it as broken.

Both to appease the broken-links script and to avoid an unneccesary
redirection, the links were modified to point to the equivalent address
in the new domain.

Furthermore, the link to the `Winsock 2 Socket Handle` was moved to be
an `\externalpage` link, as it was used in two different places.

Additionally, the `\externalpage` link titled `Dirext X SDK` was removed
as it was not used in any part of the documentation.

Task-number: QTBUG-96127
Pick-to: 6.2 6.2.0
Change-Id: I07f0ae8d610a7f8322b892a2fa37a5cc1769289e
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-09-23 15:55:59 +00:00
Laszlo Agocs
4715128213 rhi: vk: Fix invalid index for unused attachments
Pick-to: 6.2
Change-Id: I8140de4eeb1a8a490fcffd10370c29a49d677fed
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-09-23 17:54:31 +02:00
Tor Arne Vestbø
4c78ef80ca macOS: Handle window titlebar buttons independently from style mask
Style masks such as NSWindowStyleMask{Resizable,Miniaturizable}
affect whether the window has a title bar button for the action,
but also whether the window can be resized or minimized through
other means, for example if the window border can be dragged
to resize.

By decoupling the visibility and enablement of the title bar buttons
from the style mask we can individually control the buttons, and
leave the style mask set to enable behaviors we always want. We
were already doing this for the NSWindowZoomButton.

Unfortunately AppKit not only checks NSWindowStyleMaskMiniaturizable
during a call to miniaturize, but also whether the title bar button
is enabled. To allow minimizing windows without the titlebar button
we detect the situation and give AppKit a NSWindowMiniaturizeButton
that we haven't disabled. The alternative would be to temporarily
enable the NSWindowMiniaturizeButton during the minimize, but this
results in the button flashing yellow for the duration of the
animation.

Task-number: QTBUG-65637
Task-number: QTBUG-46882
Task-number: QTBUG-64994
Task-number: QTBUG-71485
Change-Id: I2c1a9564d8b7516476aa018b2820670199124bc2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-09-23 17:01:16 +02:00
Tim Jenssen
fc6eb0bb7e QFileSystemWatcher: fix QWindowsFileSystemWatcherEngine crashes
Since QHash in Qt6 does not guarantee stable iterators after
an insert it crashed from time to time.
- possible crash at the erase call if pit is invalid
- possible crash at insert if pit is invalid

QHash<QString, int> myHash;
auto i = myHash.find("foo");
myHash.insert("foo", 789);
i.value(); // possible crash
myHash.erase(i); // possible crash

Task-number: QTBUG-96790
Change-Id: Ia9b53d46b8d1fef81ab5a130c229bc9e936f6521
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit e60951eef4f0ade944e2f93ffe2f44abfc76d97a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-09-23 14:57:04 +00:00
Edward Welbourne
2c2cdb959f Document QAbstractTestLogger's virtual method API
Provide the information an implementor needs in order to be able to
implement an logging backend.

Change-Id: I7bb522de57149dad843e01a8afa9f8891d011d29
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-23 16:57:03 +02:00
Edward Welbourne
78c8f0cd4d Deprecate QTest::qWarn() and replace its last use
The one place that actually called it with file and line number was
internal to QtTest, so could call QtTestLog::warn().

Change-Id: I8be10fc81996cc3de4d2eea3ecedc59671ffe759
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-23 16:57:03 +02:00
Edward Welbourne
5b525e8e54 Replace QTest::qWarn() with qWarning()
It's the recommended replacement when file and line aren't known, and
simplifies the code in any case, thanks to taking format and varargs.
It incidentally also enables tests to tell QtTest's custom message
logger to anticipate its warnings, when they arise.

Fixes: QTBUG-67702
Change-Id: I10c883f4dd0b69dca6e59e0dbd55ab318f1938f4
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-23 16:57:03 +02:00
Edward Welbourne
8511c8b02f Convert all QT_VERSION checks to compare against QT_VERSION_CHECK()
The result is generally more readable.

Change-Id: I507f67954ecd38516de1b7a6f8244c233ee45ddf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-09-23 16:57:03 +02:00
Edward Welbourne
298e41b830 Remove fatuously true or false QT_VERSION checks
QT_VERSION is now at least QT_VERSION_CHECK(6, 3, 0), so remove all
checks against Qt 6.0.0 or earlier. They are superfluous. Tidied up in
some places in the process, particularly #include order.

Change-Id: I2636b2fd13be5b976f5b043ef2f8cddc038a72a4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-09-23 16:57:03 +02:00