Commit Graph

56400 Commits

Author SHA1 Message Date
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
Tatiana Borisova
a73fdd1555 INTEGRITY: enable C99 globally
PCRE 10.40 requires C99 now. While all GHS compiler versions we support
in Qt 6 default to C99, GHS v2016.5.4, which we use in Qt 5.15, still
defaults to C89, so set QMAKE_CFLAGS_C99 for that compiler. It doesn't
hurt in Qt 6, but enables the updated PCRE in Qt 5.15.

Pick-to: 6.3 6.2 5.15
Change-Id: I0a2d3254f80136210289a415ede7c2409b07af9b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Kimmo Ollila <kimmo.ollila@qt.io>
2022-05-11 14:56:55 +00:00
Laszlo Papp
d9be9fedfb Add a clear action to QKeySequenceEdit
This can be really helpful for deleting shortcuts that one may never
intend to use so that they do not accidentally get in the way while
interacting with the user interface.

The workaround is to try to find the QLineEdit child of the
QKeySequenceEdit widget, but it is suboptimal. Some first-class citizen
API for this would be a more stable and cleaner solution as opposed to
poking implementation details as a user of the QKeySequenceEdit API.

The clear action would be configurable and opt-in as not everyone may
potentially want this to be turned on. Or at least, not by default
anyway. Also, not to suddenly change existing QKeySequenceEdit uses with
surprising UI changes after a Qt upgrade, this needs to be opt-in.

Moreover, some customers may have already used findChild<QLineEdit *>()
to add actions to QKeySequenceEdit in this way on the client side. So,
if it was enabled by default, they would suddenly get multiple actions
potentially for the same clear action. This would be certainly
undesirable.

The new clear property is based on the corresponding QLineEdit API for
consistency.

[ChangeLog][QtWidgets][QKeySequenceEdit] Added a clear action to
QKeySequenceEdit to be able to remove existing hotkey configurations.

Change-Id: I3a90bfacd49bff10c1284abb155d7edd4f537900
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-05-11 15:56:55 +01:00
Liang Qi
4872392925 Update shared-mime-info to the 2.2 release
This also includes the fix for x-objc++src mimetype.

Fixes: QTBUG-70739
Pick-to: 6.3 6.2 5.15
Change-Id: I24f70fa5cea2e5b1a7877569be98d36878fcfe72
Reviewed-by: David Faure <david.faure@kdab.com>
2022-05-11 11:36:49 +02:00
Richard Moe Gustavsen
7f72622c0f QIOSTextResponder: recreate responder upon reset
Apple introduced UITextInteraction in iOS 13, which
caused issues with our text handling, and resulted in
e00d888dae. This, again, seems to be the reason why
UIKit in some cases simply removes the input delegate
from our text responder. This typically happens after
a QPlatformInputContext::reset(), and then when the
next character is typed on the input panel (and hence,
leaves no informative stack trace).

The result of removing the input delegate, which is the
interface that let's Qt communicate IM changes back to
UIKit, leads Qt and the UIKit out of IM sync. E.g for a
japanese keyboard, after a QPlatformInputContext::reset(),
the Qt input field would remove the marked text, but
UIKit would still show japanese characters
based on what used to be marked text.

To work around this issue, this patch will therefore
recreate the text responder when Qt tells us to reset.
This will cause the first responder to change, which will
apparently also reset the UIKit IM state.

Fixes: QTBUG-102960
Pick-to: 6.3 6.2 5.15
Change-Id: I00901e980874fae819cc7d89a68fa34ae44808c2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-05-10 18:10:09 +02:00
Alexandru Croitor
1c3e6b2cec CMake: Don't require system freetype
We provide a bundled version.
We didn't before when the commit was initially introduced, because we
thought we'd depend on a 3rd party package manager, but we didn't
follow through on that.

Amends 5668522413

Pick-to: 6.2 6.3
Fixes: QTBUG-103245
Change-Id: Ia4cb1340bbf3f4ffb3849d658d72e7cb6c7e2fb0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-05-10 17:41:04 +02:00
Laszlo Agocs
2d3894f356 rhi: d3d: Fix not resetting the pipeline tracking between passes
Do what all other backends do. If we did not want to reset the pipeline
tracking pointer, then more logic would be needed, in order not to end
up in trouble with clients that do:

loop:
  create a pipeline // [1]
  beginpass
  ... // use the pipeline
  endpass
  readback
  finish
  destroy the pipeline
  goto loop

...because we may get the exact same pipeline pointer (with a matching
generation even since it's always 1 in this case) in the different
passes, just because malloc decided to do so in [1]. This could be
solved by checking the global resource id but won't do that now as no
other backends do it either.

This solves random broken rendering with the Qt Quick 3D lightmapper.
The above outline is exactly what the UV rasterization stage does.

Pick-to: 6.3 6.2
Change-Id: Id74a0a336634d99092181b09dd7137eaec355d48
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-05-10 15:51:04 +02:00
Marc Mutz
a1903eb941 QPolygon: add toPolygonF()
This was forgotten when implementing QTBUG-73160, but suggested in
passing in QTBUG-64.

[ChangeLog][QtGui][QPolygon] Added toPolygonF().

Task-number: QTBUG-73160
Task-number: QTBUG-64
Change-Id: I9b33cf47a0d432aa842ab0f8337001c66e4ca41c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-05-10 15:51:04 +02:00
Morten Sørvig
83779c858b Windows QPA: Send screen change before geometry change
Fix bug where the device independent QWindow size was
set incorrectly, due to usage of incorrect screen and
scale factor. This could happen when a window's screen
was set to QGuiApplication::primaryScreen() as a fallback,
before QWindowsWindow::initialize() would determine the
correct screen.

By sending the screen change first we make sure that
that QWindowSystemInterface::handleGeeometryChange()
uses the correct screen for the window.

Change-Id: I5520ae67a4db60903d38db856fc314c75a3c0219
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Piotr Srebrny <piotr.srebrny@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2022-05-10 13:51:04 +00:00
David Faure
3bc80195df QWidgetTextControl: port to new-style connects (faster)
This speeds up creating a QGraphicsTextItem by 14% in an optimized build
Before: 0.070 msecs per iteration
After: 0.060 msecs per iteration

Those connects were showing up when profiling, because of the string
parsing that is necessary when using SIGNAL/SLOT macros.
The stacktrace was connect() => decodeMethodSignature() => argumentTypesFromString()
=> QArgumentType constructor => qMetaTypeInternal(const char*).

Pick-to: 6.3 6.2 5.15
Change-Id: I3cf5655c5450f121005140bdb587fafa083cce6a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-05-10 15:20:57 +02:00
Lars Knoll
b51712f136 Fix namespaced builds on ARM
Use uint64_t instead of quint64 as this code is not namespaced
and to align it with the x86 code path.

Pick-to: 6.2 6.3
Change-Id: I887ef9314a80cfcc17701eac1ec9a086f3cd5bf7
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-05-10 11:51:11 +02:00
Kai Köhne
01b50bfcda qdoc: Remove dependencies to non-existing help modules
Pick-to: 6.2 6.3
Change-Id: I953b714db27dc8bd9ecc1f65bbfd3e02d6068785
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
2022-05-10 11:51:11 +02:00
Joni Poikelin
691541023a Prevent crashing when FcFontList fails
FcFontList can return null pointer in failure cases which would lead to
null pointer dereference further down.

Pick-to: 5.15 6.2 6.3
Change-Id: I6b407cf2f27ead9eb471d3ee7a521468cebf7572
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-05-10 06:24:44 +00:00
Lorn Potter
d490501641 wasm: add support for drag into browser window
Drag and drop into the browser will work.
Drag and drop out of the browser will not.

Fixes: QTBUG-102242
Change-Id: Id9981ab6f9514535e1409bec18068790833a67a6
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-05-10 01:20:45 +00:00
Marc Mutz
877c158c59 Add ARM YIELD support to qYieldCpu()
YIELD is ARM's equivalent of x86's PAUSE, available since ARMv6k,
which should be old enough that we can use it unconditionally.

The ARM manual[1] defines the __yield() intrinsic for this, however:

- Clang has __builtin_arm_yield, the naming is compatible with what
  GCC would use, so we use that if available, to avoid having to
  include even more headers.

- GCC (incl. 12) doesn't have __yield() in arm_acle.h or anywhere
  else, and it doesn't seem to have the builtin (yet, one can always
  hope), so we use asm() there.

- Windows doesn't have an arm_acle.h header, but the docs[2] say it
  should have __yield(). Unfortunately, the docs don't say where
  the intrinsic is hiding, but we already include <intrin.h>, and
  godbolt[3] confirms that's sufficient to use __yield(). We could use
  YieldProcessor(), but we'd need to include qt_windows.h, I guess,
  which I'd rather not.

- Integrity doesn't have the arm_acle.h header, we use asm(), here, too.

[1] https://developer.arm.com/documentation/dui0472/k/Compiler-specific-Features/--yield-intrinsic
[2] https://docs.microsoft.com/en-us/cpp/intrinsics/arm-intrinsics?view=msvc-140
[3] https://godbolt.org/z/Evfe79xhE

Pick-to: 6.3
Fixes: QTBUG-103011
Change-Id: Ibf496dfe9949f9a3d24c0dcf75a703c5fdbbb4b8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-05-10 00:09:04 +00:00