Commit Graph

56341 Commits

Author SHA1 Message Date
Marc Mutz
d8e03bb02d QHash: port away from std::aligned_storage
It's deprecated in C++23. Just use an explicitly-aligned char array
directly, wrapped in a struct to avoid decays to char*.

Task-number: QTBUG-99122
Pick-to: 6.3 6.2
Change-Id: I802761c1af62efa6ffc006b07837a7deed1ea4cc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-05-07 20:47:42 +02:00
Ulf Hermann
38002df206 Endian: Provide special integer bitfield unions
Our previous approach of creating a union from individual special
integer bitfields leads to undefined values because only one member of a
union can be active at any given time. Compilers have finally caught up
with us on that and have started removing "no-op" writes to members.

The primary user of the special integer bitfield unions is
qv4compileddata_p.h in qtdeclarative. We want our on-disk format of
QML compilation units to be platform agnostic and space efficient.

Pick-to: 5.15 6.2 6.3
Task-number: QTBUG-99545
Change-Id: I24847bda2c364eb8ba75f074cde2a9bec25ced06
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-05-07 08:37:42 +02:00
Marc Mutz
b94ec982c1 QXmlStreamReader: port Value::len from int to qsizetype
It's a stretch of characters in a QString, so it has to be qsizetype.

This enlarges the Value struct further; created QTBUG-103306 to track
ideas to shrink it again.

Pick-to: 6.3 6.2
Fixes: QTBUG-102465
Change-Id: I753cfd801030c834989452eb5422b2cd72d4ef16
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-05-07 00:51:23 +02:00
Marc Mutz
5beb4f8516 QXmlStreamReader: port the last two int/qsizetype mismatches
... before the port of Value::len to qsizetype.

Pick-to: 6.3 6.2
Task-number: QTBUG-102465
Change-Id: I7d3823dc5b39d2afade735cdcf61f77ead89738b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-05-07 00:51:19 +02:00
Marc Mutz
dffba486d1 QXmlStreamReader: port Value::prefix from int to qint16
The prefix is a part of a name, the length of which is bounded to 4k
in fastScanName(), so qint16 suffices.

The length field also shouldn't stay int, but that's a different
patch, because it's just a relative offset to pos, and so isn't as
easily overflown.

This shrinks the Value struct a tiny bit; created QTBUG-103306 to
track ideas to shrink it further.

Pick-to: 6.3 6.2
Task-number: QTBUG-102465
Change-Id: I579815e72501a091360f55e750af63cb4dc5a5a7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-05-07 00:51:15 +02:00
Marc Mutz
61c83dfb22 QXmlStreamReader: port Value::pos from int to qsizetype
It's an index into a QString, so it has to be qsizetype.

The length and prefix fields also shouldn't stay ints, but that's a
different patch, because they're just relative offsets to pos, and so
aren't as easily overflown.

This enlarges the Value struct; created QTBUG-103306 to track ideas to
shrink it again.

Pick-to: 6.3 6.2
Task-number: QTBUG-102465
Change-Id: Ib318e131420c2c535e26cb03cbf450e031626e64
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-05-07 00:51:11 +02:00
Marc Mutz
6245d7dd3b QXmlStreamReader: port another indexed to ranged for loop
... fixing yet another int/qsizetype mismatch.

This is clearly safe, as the loop body trivially doesn't modifiy the
container we're iterating over.

Pick-to: 6.3 6.2
Task-number: QTBUG-102465
Change-Id: I7db65455019cf75663432078d39805be5816cf24
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-05-07 00:51:06 +02:00
Marc Mutz
f7fb3735cf Sync qxmlstream.g with qxmlstreamparser_p.h [2/2]: QT_NAMESPACE macros
Amends 6eb1cdd1c6.

Pick-to: 6.3 6.2
Change-Id: I73f744a537de1ce813e52a6e9934391985d5d5cc
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-05-07 00:51:03 +02:00
Marc Mutz
2678adffde Sync qxmlstream.g with qxmlstreamparser_p.h [1/2]: switched lines
Amends 366bdcde97.

Pick-to: 6.3 6.2 5.15
Change-Id: Id18da42b15c8095154408f58bb5e0c5f0d31739b
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-05-07 00:50:59 +02:00
Marc Mutz
507b9963b8 QXmlStreamWriter: port Private::write(p, n) from int to qsizetype
We have at least one caller which passes QtContainer::size() as the
length, so don't truncate.

Pick-to: 6.3 6.2
Task-number: QTBUG-102465
Change-Id: I8a692bd6a7b75e745c08b072f53b6efe901d5436
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-05-07 00:50:56 +02:00
Marc Mutz
66b62bd1ab QXmlStreamReader: port some int → qsizetype
Port function-local variables where local static reasoning dictates
they should have been qsizetype, not int.

Pick-to: 6.3 6.2
Task-number: QTBUG-102465
Change-Id: I0d7b07699b6dd379bce4b44f172815fb6335b1a1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-05-07 00:50:52 +02:00
Marc Mutz
389fdd6d8d QXmlStreamReader: fix integer truncation (qint64 → int)
We don't care about the actual type of oldLineNumber here, we just
need it to be of the same type as lineNumber, to avoid truncation, so
we use auto.

This was already broken in 5.15 (lineNumber was already a qint64).

Pick-to: 6.3 6.2 5.15
Change-Id: I68d7e6e91c8122bf426c9c10e8cc91ff55c61a20
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-05-07 00:50:49 +02:00
Marc Mutz
2438551152 QXmlStreamWriter: replace indexed with ranged for loops
Simpler, and fixes the int/qsizetype mismatches.

Pick-to: 6.3 6.2
Task-number: QTBUG-102465
Change-Id: I8ac139a14c4c790348acd76b95d1bee83bb2797d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-05-07 00:50:46 +02:00
Marc Mutz
ba741fd310 QXmlStreamReader: port readBufferPos from int to qsizetype
The variable represents an offset into the QString readBuffer data
member. Given a QString with more than 2Gi of characters, the variable
would overflow before we've consumed all of readBuffer's
contents.

Signed integer overflow is UB, so anything could happen.

Task-number: QTBUG-102465
Pick-to: 6.3 6.2
Change-Id: I05d35a5e7f02f05462b318c86b17fdab7f1afec6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-05-07 00:50:42 +02:00
Alexey Edelev
f087e63bf5 CMake: Make possible building Qt tools without the use of core library
Replace BOOTSTRAP option with the single value CORE_LIBRARY argument
in qt_internal_add_tool and qt_internal_add_executable functions.
The introduced argument now may accept 'Bootstap' and 'None' values.
Use 'Bootstap' to link Qt::Boostrap library instead Qt::Core or 'None'
to avoid any core library linking. This is useful for tools that need
to use the CMake deployment routines, but not require the Qt::Core
functionality.

Task-number: QTBUG-87480
Change-Id: I64a8b17f16ac5fe43c6b385252dc21def0c88d2c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-05-06 22:06:22 +02:00
Tor Arne Vestbø
a1437ce162 Implement missing QSupportedWritingSystems comparison operators
The operators were exported, but not implemented.

Change-Id: I6c89c1f4b76040d2388b3a10afc6eeeb52638e1b
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-05-06 21:58:04 +02:00
Volker Hilsheimer
13e4cf6eac Fix enum value for WindowAboutToChangeInternal event
Value 220 is already used in the (poorly, but consistently) placed
GraphicsSceneLeave event type.

Change-Id: I2fd90645475a70380e43e906c5f8459b3119f22f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-05-06 20:52:38 +02:00
David Skoland
70898c144c Fix window states and transitions in wasm
Window states and their transitions do not currently work
correctly in wasm (eg. showFullScreen -> showNormal).

In order to fix this, we need to conform to Qt's way of
handling windows and their geometry, which involves
deferring much of the actual geometry changes to when
it actually becomes visible, or else the QWidget code
interferes with what we're trying to do.

Change-Id: I8c7da0be76760363e444dc5dc676036e70863f6e
Fixes: QTBUG-102190
Pick-to: 6.3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-05-06 18:52:38 +00:00
Thiago Macieira
3bcd6026ed util/x86simdgen: update with the copyright header
Matching update done in https://github.com/opendcdiag/opendcdiag/pull/78

Change-Id: I5ff8e16fcdcb4ffd9ab6fffd16ec02591cb5ed70
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-05-06 10:27:18 -07:00
Thiago Macieira
db56a966e6 QObjectPrivate: rename the internal disconnect() to removeConnection()
Matches its counterpart addConnection().

Change-Id: If2e0f4b2190341ebaa31fffd16e315916eaaca37
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-05-06 10:27:18 -07:00
Thiago Macieira
3b46f07ffa QObjectPrivate: mark inline functions not meant to be used elsewhere
The `inline` keyword does not control inlining, as we all know (use
Q_ALWAYS_INLINE to force inlining, if required). However, it does
control the emission of the out-of-line copy of an inline function, if
the compiler did inline it where it got used: with the keyword, no copy
is required, which is our objective here.

Furthermore, we compile with -fvisibility-inlines-hidden with
GCC-compatible compilers (all but MSVC and Integrity's), which means
those functions will never be in the ABI of QtCore: they'll either have
been inlined with no out-of-line copy, or that out-of-line emission is
hidden.

Change-Id: If2e0f4b2190341ebaa31fffd16e31584561669f2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-05-06 10:27:18 -07:00
Stefan Wastl
67b9baac52 macOS: Forward hover-events for embedded windows
If a QWindow is embedded into a native view it's effectively the
root window, similar to a top level QWindow, and we need to forward
hover events on behalf of itself and all child windows.

Fixes: QTBUG-103084
Pick-to: 6.3
Change-Id: I1e94b9447fb561c1b02db87738de235c5d12b3a4
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: <stefan.wastl@native-instruments.de>
2022-05-06 17:09:25 +02:00
Alexandru Croitor
a783c3d574 qmake: Use qVersion for version reporting instead of QT_VERSION_STR
Apart from being consistent with qtpaths (which uses qVersion()),
this also ensures that Qt Creator loads correct debug helpers for types
like QString when debugging qmake.

As a drive by, remove all QT_VERSION_MAJOR, QT_VERSION_MINOR,
QT_VERSION_PATCH defines which are not used anywhere.

Change-Id: Ibc8f2a6af833e1ec6e6cd6e1937ac3c1ab328555
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-05-06 12:51:12 +02:00
Liang Qi
9b92c5314e Revert "xcb: stablilize xkb state when keymap updated"
This reverts commit 27c25fc909.

Currently Qt only supports core device of keyboard, not every
real keyboard. Create a new xkb state during
xcb_xkb_new_keyboard_notify_event_t, it will lose the correct
state before the event, for example, when using the second
or later layout than the first one. The new xkb state will
use the first layout. It's difficult to sync the xkb states.

Fixes: QTBUG-102493
Fixes: QTBUG-102640
Task-number: QTBUG-95933
Pick-to: 6.3 6.2 5.15
Change-Id: Iaa5369ff9f5495e194577dcbb8f78303158c9a73
Reviewed-by: Lu YaNing <luyaning@uniontech.com>
Reviewed-by: Zhang Hao <543985125@qq.com>
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Ilya Fedin <fedin-ilja2010@ya.ru>
2022-05-06 11:13:02 +02:00
Iikka Eklund
71684763b7 Conan: Use 'android_sdk_version' and 'android_ndk_version' for package_id
We can not alter the value of 'android_sdk' and 'android_ndk' options
when qtbase's package_id is being calculated. We have attempted to
convert the option values (paths to file system) to actual version
strings.

While the conversion itself works the usage of Conan lock files in CI
fails: "Locked options do not match computed options".

Exclude 'android_sdk' and 'android_ndk' from package_id. Instead the
'android_sdk_version' and 'android_ndk_version' will be used for
package_id which affects the binary compatibility.

Pick-to: 6.3
Change-Id: Ia99a69d9b91cebb8dea821fd8b9c6c59091f1a41
Reviewed-by: Toni Saario <toni.saario@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-05-06 07:52:47 +00:00
Tim Blechmann
948e1f9d82 cmake: moc - remove duplicate includes/defines
the generated `-D` and `-I` flags contain quite a number of duplicate
entries. since cmake-3.15 it is easy to strip them via a generator
expression

Change-Id: I83915c9074e0e2e62e79cd932cad2fa07e8a12aa
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-05-06 15:52:47 +08:00
Marc Mutz
cdd4a95317 Use Q_CC_{GNU,MSVC}_ONLY when comparing to particular versions
This prevents false-negatives and false-positives, as e.g. Clang
10.0.0 masks as GCC 4.2, so Q_CC_GNU is 402 on that
compiler. Depending on the test (Q_CC_GNU > NNN or Q_CC_GNU < NNN),
the result of the test is almost random.

Q_CC_<comp>_ONLY makes sure we match only GCC or MSVC, not bycatch
such as Clang or ICC.

Pick-to: 6.3 6.2 5.15
Change-Id: I4c550a11ecf85fc9a2216b330b69bd03d45b47e0
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-06 09:52:46 +02:00
JiDe Zhang
5b246e15f1 xcb: Remove unused codes
Removed the "QByteArray ba = connection()->atomName(monitorInfo->name);"
from QXcbScreen::setMonitor.

Pick-to: 6.3
Change-Id: I3b613510669ce9fa6f5e1a4c2491bffe4887ff88
Reviewed-by: Liang Qi <liang.qi@qt.io>
2022-05-06 04:03:50 +00:00
Thiago Macieira
046bc971c3 qtestcase/Unix: remove fprintf from signal handler
It's not async-signal-safe, so don't use it. Instead, let's use writev()
(which should write atomically and we won't need to have a buffer) and
std::to_chars to format numbers where available (where not, we roll out
our own implementation with divisions).

Pick-to: 6.3
Change-Id: I5ff8e16fcdcb4ffd9ab6fffd16eb70a158f44864
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-05-05 20:35:42 -07:00
Marc Mutz
f1f29c35cb QSemaphore: port non-futex case from (QWaitCondition, QMutex) to std::{condition_variable, mutex}
The std variant is faster and more compact.

Use the QtPrivate wrappers to avoid the Integrity mess.

Change-Id: I4a1b1626d29472af059fee55ca26c31d9522b179
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-06 04:50:06 +02:00
Joerg Bornemann
6608e63298 Fix build of util/glgen
Don't use QSet::toList(), and fix an obvious typo.
Also, core5compat is now needed due to the use of QRegExp.

Change-Id: I766455996c07d354e97a4ed4939f1774fc449331
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-05-06 03:48:09 +02:00
Volker Hilsheimer
2b99a71b22 Stylesheet: Don't ignore item check indicator styling
Amends cf52d725156811754cd4e094b0984864795d1d58, after which most
indicator styling was no longer taken into account unless some other
item aspects were styled. Calling the baseStyle to draw the entire item
doesn't call back into the style sheet style for the indicator itself.

The QCommonStyle code that breaks the item up into individual sub
elements cannot be called for each element. E.g. turning off the check
indicator feature changes the layout of the item.

So if the indicator is styled, then we have to draw an otherwise empty
item with the style sheet style, and then clip the already painted rect
before calling the base style to draw text and highlighting with the
correct palette.

Add baseline test for QTreeView with different style sheets.

Fixes: QTBUG-102820
Pick-to: 6.3 6.2
Change-Id: I1da5676cc63556230eac525bc550457ebd495a58
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-05-06 03:48:09 +02:00
Volker Hilsheimer
58df315ad1 Fix compiler warning from deprecated QString conversion
Use the string literals instead.

Change-Id: Ic85d0845c211744a79af7e48b180129797d3d612
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-05-06 03:22:14 +02:00
Iikka Eklund
b0e613d10e Conan: Move Qt option parsers to qt-conan-common
Move the QtConfigureOption and QtOptionParser to qt-conan-common where
existing shared functionality can be further re-used by these parsers.

Pick-to: 6.3
Task-number: QTIFW-2585
Change-Id: Ief56762f3a27bb0d6d474e8d1668234856afd732
Reviewed-by: Toni Saario <toni.saario@qt.io>
2022-05-06 01:20:35 +00:00
Morten Sørvig
e4cda635b1 wasm: destroy compositor and screen in order
The QWasmCompositor destructor deregisters event handlers, which
means it needs to look up the the canvas element, which again means
that this needs to happen before we clear the canvas from
specialHTMLTargets.

Also, calling destroy() is not needed since the QWasmCompositor
destructor makes this call.

Change-Id: I3004b94d0459c28642d3bd8bf9fe794c9b658477
Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-05-06 01:20:35 +00:00
Kai Köhne
b8b3a8047f Fix alignment of next/prev links in offline style
With the old value, they were placed above the
header bar. Moving them a few pixels below looks
less broken.

Pick-to: 6.2 6.3 5.15
Change-Id: Iddd9d5e0b5c199fe35a9c8b8a7cac9a472901a21
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2022-05-06 00:55:34 +00:00
Tim Blechmann
3ce1642f4c plugins: image formats - fix odr violation
When linking Qt statically, the image fomats are not separated into
different DSOs.  when linking them into the same target, gcc warns
about an ODR violation between icohandler and bmphandler:

```
/usr/src/debug/qtbase/6.3.0-r0/build/include/QtGui/6.3.0/QtGui/private/../../../../../../git/src/gui/image/qbmphandler_p.h:69:8: warning: type ‘struct BMP_INFOHDR’ violates the C++ One Definition Rule [-Wodr]
/usr/src/debug/qtbase/6.3.0-r0/git/src/plugins/imageformats/ico/qicohandler.cpp:98: note: a different type is defined in another translation unit
/usr/src/debug/qtbase/6.3.0-r0/build/include/QtGui/6.3.0/QtGui/private/../../../../../../git/src/gui/image/qbmphandler_p.h:70:13: note: the first difference of corresponding definitions is field ‘biSize’
/usr/src/debug/qtbase/6.3.0-r0/git/src/plugins/imageformats/ico/qicohandler.cpp:87: note: a field of same name but different type is defined in another translation unit
/usr/src/debug/qtbase/6.3.0-r0/build/include/QtGui/6.3.0/QtGui/private/../../../../../../git/src/gui/image/qbmphandler_p.h:69:8: note: type ‘qint32’ should match type ‘struct quint32_le’
```

we therefore wrap the `BMP_INFOHDR` into an anonymous namespace

Change-Id: I0e6ee66dd09ebda0c3e399738b5c172a57beb8f4
Pick-to: 5.15 6.2 6.3
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-05-06 00:55:34 +00:00
Kai Köhne
9bf52680bc Revert "Windows QPA: Remove dependency on swprintf_s() pulled in via _com_error::ErrorMessage()."
This reverts commit 043529c9dc, that
was introduced to keep compatibility with Windows XP. This is not
necessary anymore, as support for Windows XP got dropped.

The now removed code also had an issue in the format of the fifth
argument of FormatMessage, that is supposed to be a pointer to a
pointer for FORMAT_MESSAGE_ALLOCATE_BUFFER.

Pick-to: 6.2 6.3
Change-Id: Ib75b6a53a778801388d71388701340d3b79dacce
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Ihor Dutchak <ihor.youw@gmail.com>
2022-05-06 02:54:33 +02:00
Marc Mutz
c95fd3a7ce qcompilerdetection.h: add Q_CC_{GNU,MSVC,CLANG}_ONLY macros
As the standard compilers on their respective platforms, other
compilers tend to mask as Clang, GCC, or MSVC, leading to complicated
code when you actually mean just one of these compilers:

  #if defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && !defined(Q_CC_INTEL)

This is particularly problematic when combined with version checks:

  #if defined(Q_CC_GNU) && Q_CC_GNU >= 900

will, e.g., not match Clang 10.0.0, which masks as GCC 4.2. The
correct way (until a new kid on the block starts to mask as GCC, too)
to check for GCC >= 9.0 atm is:

  #if defined(Q_CC_CLANG) || defined(Q_CC_INTEL) || !(defined(Q_CC_GNU) && Q_CC_GNU >= 900)

The new macros make such checks intuitive and hard-to-misuse:

  #if defined(Q_CC_GNU_ONLY) && Q_CC_GNU >= 900

Use it in qcompilerdetection.h.

Pick-to: 6.3 6.2 5.15
Change-Id: Idcdf973fbc4708f58ed91c800be3d5e599e5b7e6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-06 02:41:06 +02:00
Fabian Kosmale
02c2ad6cbe Revert "a11y: Do not cache classes that don't have a factory plugin"
This reverts commit 583668005d, and
provides an alternative fix for QTBUG-75106.

Reason: This introduced QTBUG-103009, due to lack of caching. To fix the
original issue, we still reduce the amount of caching we do, by only
considering the first non-dynamic meta-object for QML related objects.

Task-number: QTBUG-75106
Fixes: QTBUG-103009
Pick-to: 6.3 6.2 5.15
Change-Id: Ic76af26a719d1114208be9555286239c6c6df615
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-05-06 00:00:20 +00:00
Edward Welbourne
93125d3a05 Refine QRoundingDown::qDiv() to avoid underflow
Subtracting denominator - 1 from the numerator ran into trouble if the
numerator was close to its type's minimum representable value. Adding
1 before division, then subtracting it after, avoids that underflow
while getting the same answer.

Change-Id: I0bb85deaa2ad36f8744ed6dbfdb4817442dddebe
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-05-06 00:20:52 +02:00
Volker Hilsheimer
4222d117d2 Baseline tests: slow down cursor blinking
Override the default cursor blink time so that we don't get mismatches
from line edits. We need to set the time to > 0 so that QStyleHints does
not fall back to the platform integration.

Pick-to: 6.3
Change-Id: Ib1d04f7450c01c352c13098886aee032dcb14c72
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-05-05 16:50:31 +02:00
Volker Hilsheimer
dc96d812ec Baseline testing of widget: wait before taking snapshot
Widgets and styles might use fade effects or other asynchronous mechanisms
as part of hovering. This results in mismatches when the snapshot is
taken before those effects are completed.

Since we can't control all such animations from the outside, process
events for some milliseconds before taking the snapshot.

Pick-to: 6.3
Change-Id: I771658300628238552bddcd14a6751c3f6c0c63d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-05-05 16:50:31 +02:00
Marc Mutz
664b84c137 De-pessimize QBenchmarkValgrindUtils::extractResult()
As if QIODevice::readLine() and QIODevice::Text open-mode aren't slow
enough, the old code took the line QByteArray, converted it to a
QString so it could apply a trivial regex to it: '^summary: (\d+)'.

We can, of course, use QByteArray::startsWith("summary: ") followed by
std::from_chars(), these days, to get the same effect, without having
to JIT-compile an RX and convert every line into UTF-16 first.

Change-Id: I20d80ffb469329d3c3efd08c71fcf5abf9f486d3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-05-05 10:39:37 +02:00
Marc Mutz
8ece12e466 QBuffer: add missing <limits> include
Amends 4bc85b9850.

Pick-to: 6.3 6.2 5.15
Task-number: QTBUG-102274
Change-Id: If826043f01155f9854cc69079a09f1b50b47994c
Reviewed-by: Mikko Gronoff <mikko.gronoff@qt.io>
2022-05-05 08:39:37 +00:00
Marc Mutz
9641b68c9c includemocs (updated script)
The updated script found some more.

Task-number: QTBUG-102886
Pick-to: 6.3 6.2 5.15
Change-Id: Ic8062e8a441c4d1a3718598a21f7f2e050a17cae
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-05-05 10:39:37 +02:00
Marc Mutz
1fa72be230 QXcbNativeInterface: remove unused field m_sysTraySelectionAtom
Says Clang:

qxcbnativeinterface.h:141:16: error: private field 'm_sysTraySelectionAtom' is not used [-Werror,-Wunused-private-field]
    xcb_atom_t m_sysTraySelectionAtom = XCB_ATOM_NONE;
               ^
Detected by includemocs.

Pick-to: 6.3 6.2 5.15
Change-Id: Ie08c2b268b508ed87e63010fc22311ab6c8d0e40
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-05 10:39:37 +02:00
Vladimir Belyavsky
a3a07dd16d QWindowsFontDatabase: fix handling of default EUDC font
There was a problem if default EUDC font is specified in user's
Windows Registry as a font file name instead of full path. In that
case we didn't handle this font properly and the warning was
generated.

Fixes: QTBUG-103003
Pick-to: 6.2 6.3
Change-Id: I946082af8dc31e6cf82cebca94ebbb03726239e0
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-05-05 05:42:39 +00:00
Volker Hilsheimer
a085a14d76 Generate JNI signature strings at compile time
Introduce an internal QtJniTypes namespace with types that allow us to
concatenate string literals at compile time. This makes it possible to
generate arbitrary strings based on types, which we can then use as
signatures to JNI method calls.

Move some of the private members of QJniObject into the QtJniTypes
namespace for consistency, and to allow further template specialization
by user code to make other types and their JNI signature string known.
Remove the "Jni" prefix from names.

Use the compile-time generated string in QJniObject methods that created
the signature string at runtime, which involved a temporary memory
allocation.

Treat 'void' as a primitive type (with signature string 'V'), and
remove redundant template specializations.

Add a test case to verify the the strings are constructed correctly
at compile time.

Change-Id: I5e3895a97f7dc1b86961f7a7855b899d9203037d
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-05-05 07:29:25 +02:00
Marc Mutz
dffca8bb0e Add a simple Qt 6/CMake-compatible script a la includemocs.py
Perl is dead and I don't speak Python, so if someone wants to port it,
be my guest. I needed something that I can use to roll out includemocs
across all Qt modules, and this is it. It works for me™, so I don't
expect to do much development with it.

This is an automated committer script I've been using so far:

    # SRCDIR=~~~
    # BUILDDIR=~~~~
    cd $BUILDDIR
    find */src -name mocs_compilation.cpp | while read FILE; do
        if grep -qsE '^#include' "$FILE"; then
            DIR="$(dirname "$FILE")"
            LIB="$(basename "$DIR")"
            case "$LIB" in
            Q*)
                LIB="${LIB%%_autogen}"
                ;;
            *)
                LIB="Qt${LIB%%_autogen}"
                ;;
            esac
            DIR="${DIR%/*}"
            path/to/includemocs6.sh "$SRCROOT/$DIR" "$DIR" "$FILE"
            (cd "$SRCROOT/$DIR" && git commit -am "$LIB: includemocs

$(cat "$SRCROOT/commit-msg.txt")" --no-edit)
        fi
    done

If the script cannot associate a moc file with a cpp file, it will
print a warning and continue.

The script tries to include the moc-file right after the
QT_END_NAMESPACE to work around many TUs ending in an #endif from some
#if QT_CONFIG or other. If there's no QT_END_NAMESPACE, it appends
the include and prints a warning.

Fixes: QTBUG-102886
Pick-to: 6.3 6.2
Change-Id: I16c5a9f845777ea2e82f15611b4fdd32f98ce0bb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-05-05 04:26:19 +00:00