Commit Graph

56708 Commits

Author SHA1 Message Date
Alexey Edelev
38bb294fb7 Avoid using add_custom_command with PRE_LINK for version script
add_custom_command with PRE_LINK doesn't work correctly with
Multi-Config builds. The better solution is to introduce a custom
target that generates the final version script and link the target to
the library target as the dependency.

Change-Id: Ib7420af752a6a46f29f411f9f0dc8557410b4f22
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-05-19 15:34:26 +02:00
Shawn Rutledge
04a60bb033 Convert <pre> to Markdown ``` and vice-versa with nonBreakableLines
The HTML parser calls QTextBlockFormat::setNonBreakableLines(true) when
it sees a <pre> tag; so for symmetry, the markdown reader now does the
same when it sees a fenced code block, and the markdown writer honors
the nonBreakableLines property by writing a fenced code block. This
preserves the meaning better when reading HTML and writing markdown or
vice-versa, without modifying HTML reading or writing code.

Added a test tst_QTextMarkdownImporter::fencedCodeBlocks() which
unfortunately also highlights a known bug in the markdown reader: each
fenced code block ends with an extra empty block. That can be fixed
separately.

tst_QTextMarkdownWriter::fromHtml(preformats with embedded backticks)
that we re-enabled in 1abaf9d5d6 was not a
very useful test: ``` with a space and some words but no newline is not
a fence: it's just like a `monospace` span. We have had trouble with
those in CI because of missing monospace fonts, or inconsistency when
a supposedly mono font's QFontInfo::fixedPitch() returns false.
So just test proper <pre>/fence conversion for now.

Pick-to: 6.3
Fixes: QTBUG-100515
Fixes: QTBUG-100981
Task-number: QTBUG-101031
Change-Id: I88f0ede0810d8a9480b30eb0cd780e1af67cc5f2
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-05-19 14:43:39 +02:00
Assam Boudjelthia
53604df833 Android: fix default name of the CI emulator
This name was changed in qt5/coin but wasn't reflected here. Currently,
things works correctly because the test target provide the correct name
as an env var.

Pick-to: 6.2 6.3
Change-Id: I8968285de2c7759d16f303c48d6295295dffbef6
Reviewed-by: Simo Fält <simo.falt@qt.io>
2022-05-19 15:43:38 +03:00
David Faure
1e938c348b QTextDocument: add setLayoutEnabled()
This allows to set up everything first - without paying for layouting
at every step - and only then trigger layouting.

Same performance behavior as setTextWidth(0), but this is a more
explicit/readable API.

Change-Id: I044dbd8b1301b1c97a92f9a29ccde2baf27a7665
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-05-19 12:26:57 +00:00
Luca Di Sera
e5a5c099af Add an exception in testrunner for QDoc
QDoc recently added some tests that use Catch2 instead of testlib.
Similarly to selftests, the normal behavior of `qt-testrunner.py` will
fail, trying to pass an argument that is not supported by Catch2 when
running the tests in CI.

To avoid the issue, an exception for the test executables that QDoc uses
was added to `qt-testrunner.py`, using the already available mechanism
that is used for selftests.

Change-Id: I5eb4b75f239eda0c493fb06ece164545d159372b
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
2022-05-19 12:51:46 +02:00
Marc Mutz
d1c31191a0 De-pessimize QTlsBackendOpenSSL::clearErrorQueue()
We don't need to format the error messages into a QString just to
clear the error queue. Just looping over q_ERR_get_error() does the
trick, too, and isn't less readable.

Pick-to: 6.3
Change-Id: Idc42f8c4ae4374d952cb357fca6c0fca0e04d086
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-05-19 11:10:40 +02:00
Marc Mutz
adc025cef6 QCoreApplication/QPostEventList: fix int/qsizetype mismatches
Includes fixes in indexed for loops that are either known to modify
the container under iteration, or else aren't known not to do it, so
were kept as indexed loops, instead of being ported to ranged ones.

Pick-to: 6.3 6.2
Task-number: QTBUG-103532
Change-Id: I7047b6127fbc4ac16ee113cfd6d1c71f2caba1e7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-19 11:10:39 +02:00
Marc Mutz
a887891271 QCoreApplication: port some indexed to ranged for loops
... fixing the int/qsizetype mismatches in the old code.

These loops trivially don't modify the container under iteration, so
using a ranged for loop is safe.

Pick-to: 6.3 6.2
Task-number: QTBUG-103532
Change-Id: I1c9e1bffceea0ada54007d313aebe2e688fa9122
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-05-19 11:10:39 +02:00
Iikka Eklund
13d1a6095d Conan: Improve 'QT_HOST_PATH' handling in build recipe
If cross-building pass the '-o qt_host_path=/foo' option into
'-DQT_HOST_PATH=/foo' for CMake so the user should not need to export
that in the environment explicitly.

The signature of 'append_cmake_prefix_path()' was changed to
'append_cmake_arg()' as the same functionality can be utilized
for any CMake argument in the recipes.

Pick-to: 6.3
Change-Id: I700d0acc86debbb8ee670330c22c167f3a585a3d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-05-19 08:17:08 +03:00
Morten Sørvig
e3201e7124 windows: make native styles support QT_SCALE_FACTOR
Calculate the native metrics scale factor using DPI from the screen
instead of using devicePixelRatio from the widget.

This way the native metrics scale factor becomes independent
of whatever modifications QtGui applies to the DPR. This matches
its use case of scaling native metrics returned by win32 API.

Task-number: QTBUG-86344
Change-Id: I0d3c73956520e2bc4a56b23ea3cb8e1f0c36fcf1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2022-05-19 02:28:38 +02:00
Anna Wojciechowska
2a34d4bc66 unblacklist passing tests 2022
Pick-to: 6.2 6.3
Change-Id: I7d37dd58eaede1bd0d1b53fe264b45be83cbca57
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-05-18 23:59:19 +02:00
Thiago Macieira
56dcb3b496 qglobal.h: #include <stdbool.h> in C mode
It's C99 and we require C11.

Change-Id: Ieb9a2aa1ea914b1b956bfffd16eff4556b99f976
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-05-18 09:14:18 -07:00
Marc Mutz
042bab072a Fix return value of qGlobalPostedEventsCount()
The unsigned return value was very un-Qt-ish, and, indeed,
tst_QCoreApplication just stored the result in ints.

Port to qsizetype, being the type of the expression that the function
calculates.

Task-number: QTBUG-103532
Change-Id: I95a81a686439b0686faad7a430adeaab66dc9e8d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-05-18 17:54:15 +02:00
Marc Mutz
7b736e1faf Make qGlobalPostedEventsCount() auto-test-exported-only
The only in-tree user outside QtCore is tst_QCoreApplication, guard
the (single) test function there with QT_BUILD_INTERNAL.

Change-Id: Ibc87ba76f2135cd8283acd75318f80a95e4b5c45
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-05-18 17:54:15 +02:00
Marc Mutz
f2fea2325d Remove manual declarations of qGlobalPostedEventsCount()
... in favor of including qabstracteventdispatcher_p.h, where needed.

Keeps the code DRY.

Change-Id: I5bee2e653cb29ffac2601ff03c952a4b3adbdb9c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-05-18 17:54:15 +02:00
Nicolas Fella
de09aefcd6 [qtx11extras] Replace references to QDesktopWidget with QScreen
QDesktopWidget doesn't exist any more

Pick-to: 6.3 6.2
Change-Id: Ie4e2f9ce14ebe89b52224a0be798cd3cc9ff6134
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-05-18 15:54:15 +00:00
Marc Mutz
20d5f8461f QKeySequenceEdit: Extract Method Private::rebuildKeySequence()
Factor the construction of Private::keySequence from Private::key into
a helper function, as we'll need this functionality in more places
when we add a maxKeyCount property to the class.

Change-Id: I6b08a619c3b6b2a9ff660e9f51b02632c2359a47
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-05-18 12:36:44 +00:00
Shawn Rutledge
1ad456c908 Un-blacklist markdown tests: QSKIP when fonts are scrambled
On QNX in CI we see
system fonts: fixed: monospace 9; general: Sans Serif 9
and "monospace" isn't really a fixed pitch font.
On B2Qt arm7 in CI we see
system fonts: fixed: monospace 9; general Sans Serif 9
and Sans Serif is actually fixed pitch.

So these tests can go wrong both ways; we need to skip them whenever
the fonts would lead QTextMarkdownWriter astray.

Pick-to: 6.3 6.2
Task-number: QTBUG-89819
Task-number: QTBUG-99676
Task-number: QTBUG-100515
Task-number: QTBUG-103484
Change-Id: I7b9adca967eaf9b8d33d1e03ef2627f70f375196
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-05-18 14:30:07 +02:00
Laszlo Papp
3e78f501b7 QKeySequence: Add support for Eject and Clear glyphs on macOS
Presumably, these glyphs have not been needed thus far, hence missing
from the corresponding list.

Pick-to: 6.2 6.3
Change-Id: I72cb8811f087c40229105f65d52a9c1048d9f9eb
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-05-18 12:30:07 +00:00
Volker Hilsheimer
9d41bd4312 Stylesheet: Another positioning fix for the menu indicator
Draw tool button menu indicator relative to frame, not content, so that
padding added in the stylesheet creates room between text and indicator.

Also, prevent another double-arrow by ignoring menu indicator rendering
when a menu button subcontrol is used, as the two are mutually
exclusive. This amends 1c338e6d07.

Add problematic case to stylesheet baseline test.

Fixes: QTBUG-102866
Pick-to: 6.3 6.2
Change-Id: I5d79e65b33a2e41ac07c8efe0c15697c5be65201
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-05-18 13:15:00 +02:00
Andreas Buhr
2f35653a30 Use QAbstractItemModelTester or QFileSystemModel
This patch enables usage of QAbstractItemModelTester on
QFileSystemModel. QAbstractItemModelTester called fetchMore()
on all items. QFileSystemModel represents the whole file system.
This led to very long test runs. To avoid this, this patch
introduces a new feature in QAbstractItemModelTester, namely
to disable calling of fetchMore().

Change-Id: Ie5d2e22fa4c143be7c080d9f79632cd2cbe07aac
Reviewed-by: David Faure <david.faure@kdab.com>
2022-05-18 12:58:06 +02:00
Andreas Buhr
ec7989aa66 Fix memory leak in tst_qtreewidget
Invalid inserts of items are tested. However, on an invalid insert
of QTreeWidgetItem into QTreeWidget, the QTreeWidget does not take
ownership of the to-be-inserted items. These items were leaked in
the past.
This patch introduces a scope-guard, so the items are not leaked.

Change-Id: Ib53ac02605c3a3c0bd1ae69bbd0876f860d08093
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-05-18 10:58:05 +00:00
Volker Hilsheimer
76e441c9ee Make uic generate correct C++ comments
Revert the change to uic of 05fc3aef53.

Task-number: QTBUG-67283
Change-Id: Icfd83bb6d80b91d4e58f1be460f6772ba49a6921
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-18 11:53:26 +02:00
Marc Mutz
ae765813d0 Optimize atomics in QObject::moveToThread() [2/2]: de-duplicate loads
We don't need to reload d->threadData, as we've already loaded it into
a register three lines above, so use the already-loaded value.

We don't care whether we might have read a different value the second
time around, because that would mean we had a race condition elsewhere
in the program (e.g. concurrent moveToThread() calls).

Pick-to: 6.3
Change-Id: I29a27ca23302288b5900ac6b45b8690a80e85680
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-18 06:37:50 +02:00
Marc Mutz
adb4a3beb7 Optimize atomics in QObject::moveToThread() [1/2]: relax a pointer load
We don't need an acquire fence for checking a pointer for nullness,
and we're not dereferencing the pointer later, so use a relaxed load
there.

Pick-to: 6.3
Change-Id: Id84e6fc50100f1bf6a4e33f89424f8b1cbb250cd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-05-18 06:37:46 +02:00
Marc Mutz
5dc724d98d Fix data race in QObject::moveToThread()
We dereference thisThreadData in the next line, at a point in time
where we haven't, yet, verified that it's this_thread's QThreadData,
so we need an acquire fence.

The alternative would be to re-arrange the code so that dereferencing
the pointer is delayed until after we verified it's this_thread's, but
that doesn't seem readily possible.

Even if it was easy, we'd first need to verify whether there are any
writes into QThreadData objects after they've been constructed, in
which case the acquire fence may be needed even in case it's 'ours'.

So just add the acquire fence.

Pick-to: 6.3 6.2 5.15
Change-Id: I468bc1f971bd87345bfcd6c13b7384bdf09d086a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-05-18 06:37:42 +02:00
Giuseppe D'Angelo
07d80deeab QtWidgets: restore Qt 5 compatibility for save/restore state
Several classes in QWidget use QDataStream internally in order
to save and restore state. These QDataStream usages were not
versioned, meaning that if Qt changes the serialization for some
datatype, then the data saved between different Qt versions becomes
incompatible. Note that the save/restore API in question just produce
opaque blobs as QByteArrays -- the user has no control over the
QDataStream objects and thus versions.

Fix by version the usages.

In QHeaderView this has caused a regression because QBitArray *did*
change version between Qt 5 and 6. In general, using QDataStream without
explicit versioning is a mistake, so deploy the same fix elsewhere as
well.

Fixes: QTBUG-99487
Pick-to: 5.15 6.2 6.3
Change-Id: I82bb5c266f4e5dedc0887cbef855dccab1015e29
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: <doctor.whom@gmail.com>
2022-05-18 02:21:31 +02:00
Friedemann Kleint
cf3843a268 moc: Add line breaks to the qt_incomplete_metaTypeArray<>
The code is hard to read due to the long line generated.

Task-number: QTBUG-100145
Change-Id: I1d1a7a547db71cca1e710d39df809f079fc2dafe
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-05-18 00:07:34 +02:00
David Faure
bb2f4d08d9 QTextDocument/QGraphicsTextItem: skip layout in setTextWidth(0)
In a QGraphicsTextItem without a width yet, there's no need to do any
layouting. The use case is obviously items with an app-defined size,
not the default where text items adapt to their contents.

Results:
 0.065 msecs to create a QGraphicsTextItem with some text (layouted)
 0.036 msecs to set everything up in a QGraphicsTextItem with 0 width

QTextEdit was abusing the width 0 to mean "no wrap, width comes from
contents", but since the value -1 means that already in QTextDocument,
QTextEdit now uses a width of -1 for that meaning.

Change-Id: I67ad59c305e5dd34830886e4e6c56dde03c93668
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-05-17 22:37:40 +02:00
Marc Mutz
7fa17b5f79 QTlsBackendOpenSSL: don't allocate memory for a QString appendee
Use the QLatin1String overload of QString::append().

Pick-to: 6.3
Change-Id: Id8ddfd72199cfb627c2d6648ce3011979f92094e
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-05-17 21:20:05 +02:00
Marc Mutz
21e0cb7a42 QKeySequence/Mac: remove NumEntries variable
Keep it DRY. Just let the compiler figure out the size.

Pick-to: 6.3 6.2
Change-Id: I2bf1c44d4e2060a9398700d16ab98d67c849814c
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2022-05-17 19:20:05 +00:00
Marc Mutz
22ae4ba3b7 Remove more unused qreadwritelock.h includes
Pick-to: 6.3 6.2
Change-Id: I4962c1abcc58d36500a56ccca680f6f36c3b5d89
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-05-17 18:49:31 +02:00
Marc Mutz
e4309df71a qobject_p.h: remove unused qreadwritelock.h include
Only qcoreapplication_p.h uses a QReadWriteLock (tanslationMutex), so
include it only there.

This include has caused QAtomicPointer<QReadWriteLockPrivate> to
percolate to the top-5 of template instantiation hogs when compiling
QtWidgets, as reported by Clang -ftime-trace.

This patch improves that, because qcoreapplication_p.h isn't part of
the PCH and is much less frequently included into QtWidgets TUs (68
instead of 142 times).

Pick-to: 6.3 6.2
Change-Id: I2518040d83a04e7cef0645d7f4bf641fb50f49ff
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-05-17 18:49:31 +02:00
Marc Mutz
9080a810ad QPropertyBindingPrivate: de-inline functions that modify heapObservers
Manipulating owning containers is costly at runtime, but also at
compile-time, so don't do it in inline functions, do it
out-of-line.

Removes the top-2 entries[1] in a Clang -ftime-trace QtWidget build.

[1] at the time of writing of this patch

Change-Id: I5da5030788b0d976a0ab7875f87ba3b51dbb1231
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-05-17 18:49:31 +02:00
Marc Mutz
0ca2cf42e0 QReadWriteLock: fix another data race in stateForWaitCondition()
The writerCount member variable is only ever accessed under
Private::mutex protection, so we need to lock the mutex here, too.

Pick-to: 6.3 6.2 5.15
Change-Id: I1717e5282eed2ecc14ccdc5090b9fc41174cccc8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-05-17 16:49:31 +00:00
Marc Mutz
ff053b39a3 Fix int/qsizetype mismatches in qstring.h
[ChangeLog][QtCore][QString] Fixed result truncation mod INT_MAX in
fromStdSstring(), fromStdU16string(), fromStdU32string(), and
fromStdWstring().

[ChangeLog][QtCore][QAnyStringView] Fixed result truncation mod
INT_MAX in asLatin1StringView().

[ChangeLog][QtCore][QUtf8StringView] Fixed result truncation mod
INT_MAX in toString().

Pick-to: 6.3 6.2
Change-Id: I944c561018a6ab4581ad6b1d71ec1ba1accba4a4
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-05-17 18:49:31 +02:00
Marc Mutz
53a842f66b Give some TLC to FlaggedDebugSignatures
- add noexcept
- use std::array instead of C array
- add comment explaining locations.size()

Change-Id: Ied6c043e693fecc232878a00ea882c97bda150b6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-05-17 18:49:31 +02:00
Marc Mutz
fd31177c45 QObject: Turn flaggedSignatures into a thread_local static
... out of QThreadData.

No-one except two functions in qobject.cpp uses the object, and its
creation is constinit, so there's no advantage to expose it to the
world as a QThreadData member.

Remove it from QThreadData, move the class' definition to the unnamed
namespace in qobject.cpp, ensure constinit'ability by letting the
language zero out the members (as opposed to an STL algorithm call),
declare it constinit thread_local static, and adapt the two users
(basically, removing the retrieval of QThreadData::current()).

Almost no effect on Clang, but saves ~400 bytes on optimized GCC 11.2
Linux AMD64 C++20 builds.

Change-Id: I22432d4ec5eb4ab59920656409b21768983fb4db
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-05-17 18:49:31 +02:00
Marc Mutz
20d8383cb4 QJniHelpers: don't rely on qreadwritelock.h transitive include
... from qcoreapplication_p.h

Amends 5fd6704091.

Pick-to: 6.3
Change-Id: I00bda35aa7bfd590105d7fe275af181ba7b53446
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-05-17 11:16:10 +00:00
Joerg Bornemann
c93d279222 Doc: Document qt_add_resources' OUTPUT_TARGETS argument
Originally, this argument was meant for internal use only.  But it
turned out useful for user projects too.

Pick-to: 6.2 6.3
Change-Id: I58af5ca8303fa9166d41a0538a60913d1fba9784
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-05-17 11:49:40 +02:00
Joerg Bornemann
6dffc1c438 CMake: Fix line endings of wrapper scripts
If QT_GENERATE_WRAPPER_SCRIPTS_FOR_ALL_HOSTS is ON then we generate
Windows scripts on Unix and vice versa.  We always used the host
platforms line endings for generating the scripts.  This leads to
Windows line endings in Unix scripts and vice versa.

Explicitly specify the line endings style when generating wrapper
scripts.

Fixes: QTBUG-102747
Pick-to: 6.2 6.3
Change-Id: I1603add46f276a5d91bbf0f103a261cdd84c343b
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-05-17 11:09:19 +02:00
Antti Määttä
a382134a40 Widgets: Use effect region bounds when drawing with repaint manager
When drawing widgets with graphics effect using repaint manager,
if we do not combine the effect region some child widgets are not
affected by the graphics effect since they are not included in the dirty
region. However always using region bounds breaks the referenced bug use case.

Fixes: QTBUG-102374
Pick-to: 6.3 6.2 5.15
Change-Id: Iaf4eaba34db863500a0600b344e5062f2b36b9bf
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-05-17 08:22:16 +03:00
Alexey Edelev
b576d7f6d1 Guard the use of QWinEventNotifier in tests
Add the Q_OS_WIN32 guard for the include of QWinEventNotifier.

Change-Id: I7824b2ee236a370c83fd85a2f594a39cf36b36e6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-17 02:51:22 +02:00
Alexey Edelev
282f4e5d3a Add qsimd_x86_p.h to the QtCore source tree
Need to collect all header files that belong to the module to make
them visible in CMake source tree. In future commit they will be used
to consider what headers need to be installed for each platform.

Amends 28b4bd7dbb

Change-Id: I7ab4063350254324869d5c2d0ba0f7e336da96fb
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-05-17 02:51:22 +02:00
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