Commit Graph

56614 Commits

Author SHA1 Message Date
David Faure
546e11f1dc QDBusArgument: ensure std::vector isn't seen as an associative container
This broke compilation of qDBusRegisterMetaType<std::vector<MyStruct>>
because std::vector<T> is in fact std::vector<T, std::allocator<T>>.

Pick-to: 6.2
Change-Id: I6a13f5f0476a3faa3a43da54d90d652b4bdd8186
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-05-17 01:27:33 +02:00
David Faure
42cf2a2617 QWidgetTextControl: don't clear() a new empty document
Before: 0.063 msecs per iteration
After: 0.054 msecs per iteration

clear() takes time because:
1) QTextDocumentLayout::documentChanged() => doLayout() => layoutFrame()
2) QTextDocumentPrivate::init() => insertBlock() => finishEdit() =>
   QTextDocumentLayout::documentChanged() => layoutStep() => ... => doLayout() again

Pick-to: 6.3 6.2
Change-Id: I7a13164d06a1ed77226f2b9d7d12e69ce5b31dfe
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-05-16 22:34:06 +00:00
Volker Hilsheimer
367092d7e0 Return specific types for frequently used Java objects
This allows us to specialize JNI type signature templates for e.g. the
context object, which in Java signatures is "android/content/Context".

Introduce a Q_DECLARE_JNI_TYPE macro that takes care of the plumbing.
The types declared this way live in the QtJniTypes namespace, and
transparently convert from and to jobject. Since jobject is a typedef
to _jobject* we cannot create a subclass. Use a "Object" superclass
that we can provide a QJniObject constructor for so that we don't
require the QJniObject declaration to be able to use the macro.

The APIs in the QNativeInterface namespace doesn't provide source or
binary compatibility guarantees, so we can change the return types.

Change-Id: I4cf9fa734ec9a5550b6fddeb14ef0ffd72663f29
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-05-17 00:34:06 +02:00
Volker Hilsheimer
f6e89e901b Fold methods for object return type into generic methods
Since we know at compile time whether the return type is an object type,
we can use 'if constexpr' and auto return type in the call(Static)Method
and get(Static)Field functions to call the object-type methods.

This makes the object-methods conceptually obsolete, but don't declare
them as deprecated as long as they are still used in submodules to avoid
warning floods and build failures in -Werror configurations.

Change-Id: Ic3019ed990a9252eefcb02cdb355f8a6ed6bc2ff
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-05-17 00:34:06 +02:00
Marc Mutz
18a16533b9 QString: don't use utf16() just to create a u16string
QString::utf16() will detach from QStringLiterals in order to ensure
NUL-termination, we don't need the returned pointer NUL-terminated,
because we pass the length explicitly to the u16string ctor, so just
use data().

Task-number: QTBUG-98763
Pick-to: 6.3
Change-Id: If883901a41480f469162ff4ed5bef927a3bf060a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-05-16 23:30:36 +02:00
Marc Mutz
68f220c93b QReadWriteLock: fix data race in stateForWaitCondition()
The function dereferences the load()ed pointer, so it needs an acquire
fence.

Pick-to: 6.3 6.2 5.15
Change-Id: Ib951de3f00851d915fec3392cdaba64f4a994300
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-05-16 20:36:29 +02:00
Volker Hilsheimer
1c338e6d07 Stylesheet: fix toolbutton menu indicator rendering
Turn off native indicators if we have custom rules, and if we drew
natively, don't draw custom indicators. This amends
ea0e0a8652 which turned off custom drawing
too aggressively, removing custom indicators also if no custom drop
down arrow (which is only relevant for drop down menu buttons) was set.

When then drawing the custom indicator, respect positioning rules in the
style sheet.

Extend baseline test.

Fixes: QTBUG-102866
Pick-to: 6.3 6.2
Change-Id: I5ca353f42e704ec3f6e57677c35118a9cb358b0b
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-05-16 20:32:27 +02:00
Marc Mutz
8af7019096 QReadWriteLock: fix data race in dtor
We need an acquire fence before we delete the d-pointer. Otherwise,
the reads that the dtor performs (QReadWriteLockPrivate contains many
non-trivial data types such as std::mutex and QVLA), race against
writes performed in other threads. The qWarning() indicates that
QReadWriteLock can not rely on external synchronization to ensure
a happens-before relationship between reads in the dtor and said writes.

While an explicit fence just before the delete would suffice, the guard
return is an extremely unlikely error case, and if we ignore it, then
loadAcquire() is correct, so use that.

Pick-to: 6.3 6.2 5.15
Change-Id: I29773b665a7f864cd6b07a294da326e8b10399b5
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-05-16 18:17:05 +00:00
André de la Rocha
067b538641 Windows QPA: Fix text input with Input Method Editors
Removes a workaround that was added to force the Windows On-Screen
Keyboard to automatically appear on Windows tablets, since it is
no longer needed in currently supported Windows releases and was
interfering with text input using Input Method Editors.
Also remove logic for programmatically disabling the OSK, since
it is no longer needed here as well, and is already supported in
the UI Automation code elsewhere in the Windows QPA.

Pick-to: 6.2 6.3
Fixes: QTBUG-98003
Change-Id: I6c4781852a5e9f96330d54a24ee3893dcd43a28c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-05-16 16:37:38 +02:00
Yuhang Zhao
75f2270293 Windows: Make QScreen::name() more user-friendly, take 2
The first attempt introduced in e9fd1c6aab had an unwanted
side-effect which makes the screen name non-unique and made the
screen manager think multiple different monitors with the
same name is one same monitor. This behavior is of course wrong
and unwanted but it was missed due to there's no unit test
for this property and I was not familiar enough with QPA
stuff. As a result the change was reverted in 851dc581cf.

However, the original change is still a good improvement,
so we bring it back, but fixed the side-effect mentioned above,
by letting the screen manager compare the device name instead
of monitor name.

If multiple monitors have the same name, a numeric suffix
will be appended to the monitor name to let people still be
able to distinguish between them.

Change-Id: Ic03105d0825abbb3d21cb51d1da3ab2cbb4ca913
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-05-16 22:37:38 +08:00
Lucie Gérard
05fc3aef53 Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
Files that have to be modified by hand are modified.
License files are organized under LICENSES directory.

Task-number: QTBUG-67283
Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-05-16 16:37:38 +02:00
Viktor Arvidsson
13c0fb137d Correctly read and write CF_DIB bmp data
When decoding CF_DIB data through the bmp handler we have to
do some assumptions on where the pixel data starts since there's
no file header to get the offset value from. We have to do this
because theres some optional data after the info header that
needs to be skipped over in some cases.

These optional color mask values are now also written when
putting a CF_DIB into the clipboard for maximum compatibility
with other apps on Windows.

This fixes the issue where pasted dibs would be offset by 3 pixels
on Windows.

Fixes: QTBUG-100351
Pick-to: 6.2 6.3
Change-Id: Icafaf82e0aa3476794b671c638455402a0d5206f
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-05-16 15:16:36 +02:00
Ivan Solovev
0613146d21 Android A11Y: handle LocationChanged event only for focused element
LocationChanged event unconditionally triggered invalidateVirtualViewId
call. That call results in TYPE_WINDOW_CONTENT_CHANGED Android event,
which causes a lot of background processing.
That is not correct, because LocationChanged event is generated by
every accessible element, not only the one that has A11Y focus.

This patch checks event->uniqueId(), and processes only events that
come from the focused accessible element.

Done-with: Mike Achtelik <mike.achtelik@gmail.com>
Task-number: QTBUG-102594
Pick-to: 6.3 6.2 5.15
Change-Id: I6b941733c9d215fed5ee5a7aeeb5be234add9ebe
Reviewed-by: Mike Achtelik <mike.achtelik@gmail.com>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2022-05-16 15:16:35 +02:00
Giuseppe D'Angelo
53ee4c8b1f Item widgets: clean up treatment of Qt::TextAlignmentRole / CheckStateRole
The item widgets all have an API flaw: getters and setters for the text
alignment deal with int instead of Qt::Alignment.

Deprecate the existing setters and introduce others taking
Qt::Alignment. Store the alignment directly into the item widget (now
that views know how to handle it).

We can't change the getters without cluttering the API, so make that a
Qt 7 change. Users can prepare by forcibly casting the return value to
Qt::Alignment; this is going to work in Qt 6 and 7.

While at it: streamline the handling of Qt::CheckStateRole as well,
avoiding to rely on a pointless Qt::CheckState to int conversion
through QVariant (the setter stores a Qt::CheckState, but the getter
retrieves an int and converts it to a Qt::CheckState).

Task-number: QTBUG-75172
Change-Id: I9f29e818e93cb2dc1d8e042bc320162c2f692112
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-05-16 09:46:27 +02:00
Laszlo Papp
5d8f815e10 QKeySequence: Fix the one-off error in the mac glyph array size
It seems that the size of the corresponding array in the code has a one-off
error. This is now fixed.

The end of the array passed to lower_bound is wrong because the
hard-coded size is size + 1. However, the end is array + size. This is
what lower_bound expects from an array. Or any other algorithm for that
matter expecting the end of a container as an argument.

This can cause issues with something like lower_bound because a
potential "empty" fill is not sorted as lower_bound would expect the
data structure.

It could have been fixed by decreasing the size by one, however it is a more
future-proof solution to avoid hard-coding the size and just use
std::size(array) instead.

Pick-to: 5.15 6.2 6.3
Change-Id: I1d25a5b1a80a3b2634b229e0718108ad5e7808a0
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-05-15 19:02:22 +01:00
Shawn Rutledge
7c76064604 Add QTextDocFragment::to/fromMarkdown() & QTextCursor::insertMarkdown()
Also add the beginnings of an autotest for QTextCursor::insertHtml(),
for comparison purposes.

We can see that the block to be inserted is merged with an existing
block by default rather than being inserted as a new one, with both HTML and
Markdown insertions.  So now we test for leading and trailing newlines
in the markdown to be inserted, to determine whether we need a new block
into which to insert, and to "hit enter" at the end of the insertion.

QSKIP the toMarkdown() comparisons if GeneralFont is mono. This happens
on Boot2Qt systems in CI.

Task-number: QTBUG-76105
Task-number: QTBUG-94462
Task-number: QTBUG-100515
Task-number: QTBUG-103484
Change-Id: I51a05c6a7cd0be4f2817f4a922f45fa663982293
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-05-14 21:32:05 +02:00
Allan Sandfeld Jensen
e69ebf93ca Add floating point color space conversions
This allows color space conversions that produces values outside the
0.0->1.0 range, which is one of the intended functions of the floating
point image formats.

Change-Id: I63b37b0f6934d4382edafb4709486c785a637c67
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-05-14 01:00:05 +02:00
Oliver Eftevaag
e33a449271 Add override keyword to avoid warning from compiler
A class that reimplements a virtual function isn't using the override
keyword, which generates a warning during compilation.

Pick-to: 6.3
Change-Id: Ic39ea24993e031f95ac9e61c3285d3be05fe6c34
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-05-13 18:49:05 +00:00
Alexey Edelev
28b4bd7dbb Use correct condition for the qopengles2ext.h file
Amends b98706f122

Change-Id: I5d7af699d0afed4deebc5afd39725f1af68833b5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-05-13 20:06:40 +02:00
Volker Hilsheimer
601dbd6499 Add variadic template overloads for QJniObject/Environment methods
This allows the compiler to deduce the template arguments based on the
provided method parameters, which we can then pass to the methodSignature
and fieldSignature helpers to generate the signature string completely at
compile time.

Since we can't partially specialize template member functions, replace
the specializations for void methods with compile-time-if branches in
the general templates.

This variadic template now prevents implicit conversion from the
LiteralStorage types to const char* signatures, so catch the case where
such a type ends up in the parameter list.

Due to overload resolution rules for constructors, we need to explicitly
disable the constructor if any of the arguments is a string literal type,
as we have to keep the old C-style variadic function working for such
calls.

Add variations that use the variadic templates to the unit tests.

Change-Id: I8734664b38bae932369462330a9a03302254c33c
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-05-13 18:13:49 +02:00
Marc Mutz
b9c55b5b9e QVersionNumber: de-inline QList constructor calls and resize()
The QList<int> range ctor and other QList<int> methods have percolated
up near the top of the list of Clang -ftime-trace most expensive
template instantiations in PCH libQt6Gui.so builds:

**** Templates that took longest to instantiate:
  [...]
  5138 ms: QList<int>::QList<const int *, true> (256 times, avg 20 ms)
  4327 ms: QtPrivate::QCommonArrayOps<int>::appendIteratorRange<const int *> (256 times, avg 16 ms)

The code in 6.3 is already sufficiently different for this patch to
not be applicable there.

Task-number: QTBUG-97601
Change-Id: I4420c8c90e472ecfd679b414cc4334d2ab55cce3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-05-13 17:13:46 +02:00
Marc Mutz
949b85a721 QObject: mark two error reporting functions COLD
They already nicely factored this error-only code from the normal path
of execution. All that was missing was for them to be marked as COLD,
so the compiler moves them out of the way even further, and optimizes
them for size, not speed.

TEXT size savings: ~400b on GCC 11.2 and ~500b on Clang 10 optimized
C++20 AMD64 Linux builds.

Pick-to: 6.3 6.2 5.15
Change-Id: I64a4123645855b4e34fbb0bc3304d144d7191a0d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-05-13 17:13:46 +02:00
Kai Köhne
c5183b497e Fix versioning of PixelScroll
\since will mark the whole enum as new in 6.2

Amends  673ed80fa4

Pick-to: 6.2 6.3
Change-Id: I88bd73d3bf8b0da355e3200b7a9b67fc141a2b93
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2022-05-13 17:13:46 +02:00
Liang Qi
3116eddb68 XCB: fix leaked QXcbScrollingDevicePrivate
==1585319== 1,112 (720 direct, 392 indirect) bytes in 2 blocks are definitely lost in loss record 110 of 123
==1585319==    at 0x483EF2F: operator new(unsigned long) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==1585319==    by 0x7D01D6C: QXcbConnection::xi2SetupSlavePointerDevice(void*, bool, QPointingDevice*)::{lambda()#1}::operator()() const (qxcbconnection_xi2.cpp:262)
==1585319==    by 0x7D025C2: QXcbConnection::xi2SetupSlavePointerDevice(void*, bool, QPointingDevice*) (qxcbconnection_xi2.cpp:316)
==1585319==    by 0x7D03D2D: QXcbConnection::xi2SetupDevices() (qxcbconnection_xi2.cpp:499)
==1585319==    by 0x7CE81A3: QXcbConnection::QXcbConnection(QXcbNativeInterface*, bool, unsigned int, char const*) (qxcbconnection.cpp:105)
==1585319==    by 0x7D27BEA: QXcbIntegration::QXcbIntegration(QList<QString> const&, int&, char**) (qxcbintegration.cpp:199)
==1585319==    by 0x7C9D282: QXcbIntegrationPlugin::create(QString const&, QList<QString> const&, int&, char**) (qxcbmain.cpp:56)
==1585319==    by 0x4B516DE: QPlatformIntegration* qLoadPlugin<QPlatformIntegration, QPlatformIntegrationPlugin, QList<QString> const&, int&, char**&>(QFactoryLoader const*, QString const&, QList<QString> const&, int&, char**&) (qfactoryloader_p.h:108)
==1585319==    by 0x4B512A9: QPlatformIntegrationFactory::create(QString const&, QList<QString> const&, int&, char**, QString const&) (qplatformintegrationfactory.cpp:71)
==1585319==    by 0x4B074EC: init_platform(QString const&, QString const&, QString const&, int&, char**) (qguiapplication.cpp:1209)
==1585319==    by 0x4B0A646: QGuiApplicationPrivate::createPlatformIntegration() (qguiapplication.cpp:1491)
==1585319==    by 0x4B0A7C9: QGuiApplicationPrivate::createEventDispatcher() (qguiapplication.cpp:1508)
==1585319==    by 0x568853F: QCoreApplicationPrivate::init() (qcoreapplication.cpp:847)
==1585319==    by 0x4B0A89F: QGuiApplicationPrivate::init() (qguiapplication.cpp:1532)
==1585319==    by 0x4B05D16: QGuiApplication::QGuiApplication(int&, char**, int) (qguiapplication.cpp:653)
==1585319==    by 0x451613: main (tst_qmetatype.cpp:2141)

Fixes: QTBUG-95468
Pick-to: 6.3 6.2
Change-Id: I7e0b82c2d2fe464082d8fffd1696c0122c3b35b7
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-05-13 15:35:30 +02:00
Morten Sørvig
50b34661fa qtloader.js: remove "getProcAddress" error filtering
Emscripten no longer prints an error for each getProcAddress
lookup failure and this code can be removed.

Change-Id: I082f420772677196c8eb82c49546825c750377ae
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: David Skoland <david.skoland@qt.io>
2022-05-13 11:15:15 +02:00
Morten Sørvig
a1092b8130 qtloader.js: forward stdErr to console.warn()
This is the correct mapping, and as a bonus the Chrome browser provides
a stack trace on all output from console.warn().

Change-Id: I4a1b95475679d6b54a0690f51c23683514fe7985
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: David Skoland <david.skoland@qt.io>
2022-05-13 09:15:11 +00:00
Marcus Tillmanns
40e3c1c2b1 Fix removal of trailing slash
The fsevents implementation of QFileSystemWatcher on Mac OS X tries to
remove trailing slashes from the paths when calling addPaths(). If the
user tries to watch "/", the path is changed to "".

The fix checks whether the path is longer than 1 before removing
trailing slashes.

Change-Id: Iafb10e449c4f3bd600b02edbe7c549911db05048
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-05-13 10:34:05 +02:00
Marc Mutz
11791e2a50 QVarLengthArray: Move unique_ptr<void, free_deleter> to QVLABaseBase
This avoids repeated re-instantiations of unique_ptr with local
deleters, removing that instantiation from the top of the list in
Clang -ftime-trace QtWidgets builds:

**** Templates that took longest to instantiate:
  2627 ms: std::__1::unique_ptr<void, free_deleter> (835 times, avg 3 ms)

Amends e297e80fd0.

Pick-to: 6.3
Task-number: QTBUG-97601
Task-number: QTBUG-99039
Change-Id: I1281f6cf9248a3796d9dfdc653f19f5a67dc3bda
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-05-13 05:14:49 +00:00
Morten Sørvig
250f5f4a11 wasm: fix specialHtmlTargets code
Remove .as_handle() call, which was left over from the previous
EM_ASM-based code; see 0ec75f4b9.

Change-Id: I220304074f4d17e706726dab086c0330edc9ef25
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-05-12 23:50:18 +00:00
Alexandru Croitor
f4e9981259 CMake: Fix static library link order when using qmake
qmake adds QMAKE_PRL_LIBS values on the link line after the currently
processed library. Because CMake adds resource object files into
QMAKE_PRL_LIBS, they end up on the link line after the library.
This causes issues on Linux with GNU ld and ld.gold, because the
linker discards symbols from the library which are then later referenced
by the object files.

Work around that by placing the path to the library directly into
QMAKE_PRL_LIBS after the resource object files.
This ensures the linker doesn't discard the symbols required by the
resource object files.

This means that each library encountered in qmake's LIBS variable will
be temporarily referenced twice in qmake's project state: once from
LIBS / QMAKE_PRL_TARGET, and once when the QMAKE_PRL_LIBS values are
added. On the link line it will appear only once though, because qmake
does library deduplication during prl file processing, which only keeps
the last occurrence.

Amends 4ab5432081

Pick-to: 6.2 6.3
Fixes: QTBUG-103002
Change-Id: I97647b64de22b158424850915fee62b5fea5f995
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-05-12 21:45:59 +02:00
Thiago Macieira
1c7ed7e73e Revert "MySQL: pedantism: create and destroy the MYSQL_TIME type"
This reverts commit 6feb289189. It causes
a crash when field.myField is null.

Fixes: QTBUG-102489
Pick-to: 6.3
Change-Id: I7e305799c8594ebab255fffd16ee1a41cac8d387
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2022-05-12 11:52:12 -07:00
David Skoland
8e07d5095b Only configure one test for wasm
Since we still don't support dynamic linking in wasm, we can't
use it for tests, which forces us to use static linking, which is
very slow (up to 30 seconds in some cases). The idea is to at least
have one test run for wasm before expanding it later.

Note that even with this change,
QT_BUILD_MINIMAL_STATIC_TESTS=ON needs to be defined to skip
the baseline test directory.

Change-Id: I39aea22087211fb39f03dfb0b39c55f63a26d2a7
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-05-12 18:55:04 +02:00
Alexey Edelev
b98706f122 Add missing header files to the module sources
All module header files should be listed in the corresponding sections
of modules SOURCEs to be accessible in CMake routines.

Task-number: QTBUG-103196
Change-Id: Ieb77ae70557e35e546a5b00387e1e0aa40338239
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-05-12 16:34:25 +02:00
Alexey Edelev
a3e13cdacf Use full file path for the generated dbus files
Change-Id: Idb7cb49800eaef4a2e09d3e03d2e44528d992d75
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-05-12 16:34:25 +02:00
Morten Sørvig
7ff65323e5 wasm: remove window from requestUpdate queue on removeWindow()
Don't deliver update requests to windows which have been deleted
or are not on screen.

Change-Id: Ia2972e8dbef46eaf91a45a84962353917d436da6
Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: David Skoland <david.skoland@qt.io>
2022-05-12 16:34:24 +02:00
Morten Sørvig
83106badcd wasm: always call destroy() before deleting a screen
QWasmCompositor currently has the requirement that destroying it
requires freeing a GL texture, which requires a valid GL context,
which requires a valid screen, in order to get to the native context
on the canvas. 

For this reason QWasmScreen has a destroy() function which is called
before deleting the QScreen and QPlatformScreen.

Make sure we call destroy() also when deleting all screens in the
QWasmIntegration destructor. Move the common logic into a new
deleteScreen() function which replaces destroy().

Change-Id: I628f13c868808db539effff9b29ecbefac23abc9
Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: David Skoland <david.skoland@qt.io>
2022-05-12 16:34:24 +02:00
Morten Sørvig
b119f26a56 wasm: enable WASM_BIGINT
JavaScripts's BigInt feature provides support for arbitrary-precision
integers. This makes it possible to represent 64-bit integers; the
standard JS Number type supports 32-bit integers only (or more
accurately 53-bit integers - see Number.MAX_SAFE_INTEGER).

Enable WASM_BIGINT which makes Emscripten map int64_t and uint64_t
to BigInt when interfacing with JavaScript code.

This removes one of the conditions which enables
wasm-emscripten-finalize.

Task-number: QTBUG-103352
Change-Id: Ia70d599daaf34c92695f5a2b61665e0c237e6b95
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: David Skoland <david.skoland@qt.io>
2022-05-12 16:34:24 +02:00
Morten Sørvig
bd8d3fb47c wasm: set ASSERTIONS level to default (1)
This removes one of the conditions which enables
wasm-emscripten-finalize.

Task-number: QTBUG-103352
Change-Id: Id05db4b081dec360cdad2e611622e5baf09aeb23
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: David Skoland <david.skoland@qt.io>
2022-05-12 16:34:24 +02:00
Dmitry Shachnev
e2a8b0adbd Hardcode atomic_LIB as -latomic
find_library does not always work because libatomic.so may be in a path
like /usr/lib/gcc/x86_64-linux-gnu/11/libatomic.so, which CMake does not
consider by default.

Pick-to: 6.3
Change-Id: I73a657c470efa4f84f8629bd531edfcac3b3a352
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-05-12 17:34:24 +03:00
Ville Voutilainen
0c0a784c6f Add BiC data for the new way to do BiC testing
Change-Id: Id85fc21d4758eecc73b48f64370cc1479b618d81
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-05-12 13:33:41 +03:00
Fabian Kosmale
4e7f92bf0d QMetaType: Fix normalization on MSVC if name contains enum
During type normalization, we remove the struct, class and enum
keywords (see the skipStructClassOrEnum function). However, we only want
to do that for actual keywords, not for a name that happens to start
with e.g. "enum", as in "enumerationNameSpacce".
Adjust the MSVC check to still require no identifier character after the
keyword, while still allowing for some remaining characters.

Fixes: QTBUG-97813
Pick-to: 6.3 6.2
Change-Id: I82b873d02ff454cce4b75f2814a52a66f2268208
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-05-12 08:17:54 +02:00
Johannes Rosenqvist
bb334e8181 Fix a QDBusConnection crash with pending calls when connection is closed
QDBusConnection::closeConnection does not use deref() on pendingCall
list so if there is an QDBusPendingCallWatcher watching the
pending call the QDbusPendingCallPrivate destructor will
run twice causing a crash.

Pick-to: 5.15 6.2 6.3
Change-Id: Ib811da36d3510f4292aa310c52c0617b885947b7
Reviewed-by: Johannes Rosenqvist <xeroc81@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-05-11 22:59:13 +02:00
Thiago Macieira
72d6b897a4 QLibraryInfo: Use __VERSION__ with Clang too
Regular Clang:
 "Clang 14.0.3"

Apple Clang:
 "Apple LLVM 13.1.6 (clang-1316.0.21.2.3)"

Intel oneAPI DPC++:
 "Intel(R) oneAPI DPC++/C++ Compiler 2022.0.0 (2022.0.0.20211123)"

Change-Id: I5ff8e16fcdcb4ffd9ab6fffd16eb57c2673d3030
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-05-11 12:50:08 -07:00
Thiago Macieira
20104bb237 Remove remnants of the old Intel C++ compiler
We don't support it any more. I don't think it has ever properly
compiled Qt 6 (and it's no longer working for me against GCC 12's
libstdc++ headers). If you report a bug against it, Intel support's
first question is if you can try instead the new Clang/LLVM-based oneAPI
C++ compiler.

So we support only that one, which identifies itself as Q_CC_CLANG.

Change-Id: I5ff8e16fcdcb4ffd9ab6fffd16eb57a092c8439e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-05-11 12:50:08 -07:00
Thiago Macieira
5302857f5a Atomics: workaround GCC 12 warning about overflowing d->state
I don't see a way this can be anything but a bogus warning.

In member function ‘std::__atomic_base<_IntTp>::__int_type std::__atomic_base<_IntTp>::fetch_or(__int_type, std::memory_order) [with _ITp = int]’,
    inlined from ‘static T QAtomicOps<X>::fetchAndOrRelaxed(std::atomic<T>&, typename QAtomicAdditiveType<T>::AdditiveT) [with T = int; X = int]’ at qatomic_cxx11.h:449:33,
    inlined from ‘T QBasicAtomicInteger<T>::fetchAndOrRelaxed(T) [with T = int]’ at qbasicatomic.h:168:36,
    inlined from ‘int switch_on(QAtomicInt&, int)’ at qfutureinterface.cpp:97:31,
    inlined from ‘void QFutureInterfaceBase::setThrottled(bool)’ at qfutureinterface.cpp:194:18:
atomic_base.h:648:33: warning: ‘unsigned int __atomic_or_fetch_4(volatile void*, unsigned int, int)’ writing 4 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]

A few more of those appear in other modules. I'm not fixing them all,
assuming GCC will soon fix the warning.

Pick-to: 6.2 6.3
Change-Id: I7fb65b80b7844c8d8f26fffd16e93f68e278d048
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-05-11 12:50:08 -07:00
Marc Mutz
2984fcbb3d QNetworkCacheMetaData: replace qSwap with member-swap
This one seems to have been forgotten the first time around.

Amends f438d29b6f.

Task-number: QTBUG-97601
Pick-to: 6.3 6.2 5.15
Change-Id: Ia9b2667dd69cc4a9778f8c9bdf905ca11b4e079e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-05-11 21:11:42 +02:00
David Skoland
0c44dd3a33 Exclude network tests based on feature
Both tests in the conditional depend on the
qnetworkinterface feature, and will fail to build
if qt is configured without the networkinterface feature.

Additionally, a missing system header in a test was added.

Change-Id: Ife5989ee57675ebe117de2c92a4f96c7125cbab1
Pick-to: 6.3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-05-11 20:14:39 +02:00
Alexandru Croitor
ff0ee3d985 CMake: Handle strip wrapper creation more robustly
Unsetting CMAKE_STRIP and including CMakeFindBinUtils to find it again
is not safe, because CMakeFindBinUtils has logic to search for
additional tool names depending on the currently processed language.

The currently processed language is set in _CMAKE_PROCESSING_LANGUAGE
only when CMake is doing it's language introspection via
CMakeCXXCompiler.cmake.

This resulted in the build system finding a regular host-OS strip,
rather than an android specific llvm-strip when doing an Android
build, which then silently failed to strip the Android libraries
and caused us to ship big binaries.

Improve the strip wrapper creation in a few ways:
- Save the original strip value on first configuration
- Restore it if needed, without using CMakeFindBinUtils
- Don't apply the strip wrapper creation logic to Android,
  we currently don't need it there
- Add some informational messages about which CMAKE_STRIP
  ends up being used even if log-level is not DEBUG
- Fix a typo

Amends 39f657032b

Pick-to: 6.2 6.3
Fixes: QTBUG-103356
Task-number: QTBUG-101653
Change-Id: I23d98180446d5bb7628e783668f46e4e546ed700
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-05-11 18:53:37 +02:00
Joerg Bornemann
7f94aa23f5 CMake: Fix initialization of QT_BUILD_TOOLS_BY_DEFAULT
...when QT_BUILD_TOOLS_WHEN_CROSSCOMPILING is ON.

When QT_BUILD_TOOLS_WHEN_CROSSCOMPILING is ON, we want to set
QT_FORCE_BUILD_TOOLS.  But this happened too late: after the
initialization of QT_BUILD_TOOLS_BY_DEFAULT.  This value depends on
QT_FORCE_BUILD_TOOLS.

This amends commit acfbe3b779.

Change-Id: Ibdba54da943aea1b55618f10d2b8485f4390878a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-05-11 18:53:37 +02:00
Eskil Abrahamsen Blomfeldt
03782af2dd Fix -no-freetype build on Windows
Just a missing #ifdef.

Pick-to: 6.2 6.3
Fixes: QTBUG-103370
Change-Id: I4fc4605317d423acbf6280307362a087e427761b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-05-11 18:13:38 +02:00