Commit Graph

56888 Commits

Author SHA1 Message Date
Kai Köhne
c2505751de Doc: Document missing methods in QDropEvent
Fixes: QTBUG-104484
Pick-to: 6.2 6.3 6.4
Change-Id: I20068bb9e641545edad67910b4586aa38aec093b
Reviewed-by: Kevin Keating
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-06-28 19:52:43 +02:00
Dimitrios Apostolou
d23dcc0542 qtestlib: exit with error if a test is invoked with unknown data tag
Previously trying to execute a test function with an unknown data tag
would print an error message but exit with 0.

This patch stores a test failure, and continues trying to execute the
rest of the command line arguments, if any. In the end the process exits
with the usual exit code (number of failed tests) which is now !=0.

Pick-to: 6.4 6.3 6.2
Fixes: QTBUG-24240
Change-Id: Id4d422035f173e01e77ca88028dfd94dc0f9085c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-06-28 18:06:33 +02:00
Moody Liu
8a96c8a22c fix androiddeployqt with user application with in-tree QML modules
when deploying user applications with QML modules located under user's
subdirectories, (e.g. some third-party QML components used as git
submomdule). The qmldir for such QML modules will be, typically,
generated under BUILD_DIR/android-qml.

if a BUILD_DIR is under the source directory, androiddeployqt will skip
those QML modules incorrectly because they "appeared to be under the
QML root path so that seems can be imported", however without deploying
them, it's impossible to import those modules on an Android device.

this patch adds a check that also tests if a root path plus the module's
url can actually lead to the correct module path, so a QML module under
android-qml subdir would not pass the test, and thus won't be skipped.

Task-number: QTBUG-103593
Pick-to: 6.4 6.3
Change-Id: I8af76bd38cd55700e17794cf2fff0e50a90ac87e
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-06-28 17:06:33 +01:00
Allan Sandfeld Jensen
aefb5c5a56 Avoid overflowing coverage in rasterizer
A single examined pixel might have sampled corners outside the logical
constraints, that needs to be ignore.

Pick-to: 6.4 6.3 6.2
Fixes: QTBUG-92485
Change-Id: I105fd42d3388a48f3bb03c00d640832e8e99477c
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-06-28 17:16:47 +02:00
Eirik Aavitsland
3709bc3699 Ensure consistent cursor width under fractional scaling
Under fractional scaling, an N units wide rectangle can in general
cover either M or M+1 pixels, depending on placement. For a tall thin
recangle like the cursor, this difference becomes very visible as the
cursor moves from position to position. Avoid by instead painting the
cursor as a cosmetic line in such cases, since that keeps its width
independently of the current transformation.

Fixes: QTBUG-95319
Pick-to: 6.4 6.3 6.2 5.15
Change-Id: I31a31f89fe7eac3037694946aa452a9f2bd6e5be
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-06-28 11:04:10 +02:00
Ville Voutilainen
40ddf2c7f3 Fix an incorrect invocation of llvm-readobj
It's never been entirely sound or necessarily correct to use single-dash
options for long options. Various other things invoked by androiddeployqt
seem to provide only single-dash options, but llvm tools and GNU tools
always provide a double-dash option. Therefore we can just change the
--needed-libs option to use double-dash without any particular version
checks or differences.

Task-number: QTBUG-104580
Pick-to: 6.4 6.3 6.2 5.15
Change-Id: I5649b0f9565989157d934c802da1f3c4c43fca0f
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-06-28 09:03:52 +00:00
Alexey Edelev
d4b27d9b52 Avoid including qopenglfunctions header files if Qt is built with GLES2
Change-Id: I3a7a69f5eef604408713934811efb984e78d68dd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-06-28 10:52:23 +02:00
Laszlo Agocs
f814cc6a79 rhi: metal: Switch back to presentDrawable
This convenience should be, according to the Apple docs, equivalent to
calling present from a scheduled handler. (which on its own makes it
unclear why we switched in the first place)

In practice it seems the two approaches are not identical. It looks
like that once a frame is submitted earlier than the next display link
callback, the throttling behavior we implement in beginFrame()
(waiting on the semaphore for the completion of the appropriate
command list etc.) starts exhibiting unexpected behavior, not
correctly throttling the thread to the refresh rate. Changing back to
presentDrawable does not exhibit this at all.

The suspicion is that presentDrawable is probably doing more than what
the docs suggest, and so is not fully equivalent to calling present
manually from a scheduled handler.

Therefore, switch to presentDrawable now, which restores the expected
cross-platform behavior, but make a note of the oddity, and also
prepare the hellominimalcrossgfxtriangle manual test to provide an
easy, self-contained application to allow experimenting in the future,
if needed.

This allows Qt Quick render thread animations to advance at the
expected speed (because the render thread is correctly throttled to
the refresh rate), even if the render thread decides to generate a new
frame right away, without waiting for the next display link update.

Without this patch, attempting to get updates not via requestUpdate(),
but by other means (timer etc.) leads to incorrect throttling, and so
the triangle in the test app is rotating faster than expected - but
only with Metal. Running with OpenGL on macOS or with any API on any
other platform the behavior will be correct. Even if scheduling
updates without display link is not efficient, and should be
discouraged, not doing so cannot break the core contract of vsync
throttling, i.e. the thread cannot run faster just because it renders
a frame not in response to an UpdateRequest.

Amends 98b60450f7 (effectively reverts
but keeps the code and the notes because we might want to clear this
up some day)

Pick-to: 6.4 6.3 6.2
Fixes: QTBUG-103415
Change-Id: Id3bd43e94785384142337564ce4b2644bf257100
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-06-28 10:47:41 +02:00
Laszlo Papp
82309305a7 QStyledItemDelegate: Fix the event filter doc
The class actually also avoids filtering the tab and backtab keys for
the mentioned classes: QTextEdit and QPlainTextEdit.

So, the documentation needs to be extended to cover the hidden gems.

Pick-to: 6.4 6.3 6.2
Change-Id: Id993b055a105c6cfe5ee57be3863ce8bff448396
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-06-28 08:30:04 +00:00
Thiago Macieira
db342f42a4 CMake: update the x86 intrinsic checks
Merge all the existing checks into a single one, which is a simple pass
or fail, since all our supported compilers support all the intrinsics up
to Cannon Lake. The two I've recently added (AVX512VBMI2 and VAES)
aren't yet supported everywhere, so they stay.

For some reason, all intrinsics seem to be disabled on Android. It looks
like some support was missing during the CMake port and this was never
again looked at. I'm leaving it be.

As for WASM, discussion with maintainers is that the WASM emulation of
x86 intrinsics is too hit-and-miss. No one is testing the performance,
particularly the person writing such code (me). They also have some
non-obvious selection of what is supported natively and what is
merely emulated. Using the actual WASM intrinsics is preferred, but
someone else's job.

Change-Id: Ib42b3adc93bf4d43bd55fffd16c10d66208e8384
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2022-06-28 03:28:42 +00:00
Thiago Macieira
500c116ced CMake: disable the attempt to force SIMD on iOS simulator builds
This will stop working with the next commit, which merges all basic x86
SIMD intrinsics into one configure test. As a result, linking almost
anything graphical on iOS (which is almost everything) causes the linker
to fail with undefined references to SIMD-optimized versions that didn't
get compiled.

Change-Id: Ib42b3adc93bf4d43bd55fffd16c288f4104a6ccc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-06-27 20:28:41 -07:00
Laszlo Papp
dedf11a53b QAction: Fix the obsolete menu() doc
35ddf34988 added QMenu::menuInAction, but
the documentation added to cover it contains a typo.

The method added to replace QAction::menu() is menuInAction, not
menuForAction. It was probably just an oversight.

Pick-to: 6.4 6.3 6.2
Change-Id: I2a6ec846bbe7ac8dd9e0c285bc62dd7e08820459
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-06-28 00:39:35 +00:00
Thiago Macieira
159a52bf3e QDateTime: remove a few hardcoded values in favor of <chrono> constants
Change-Id: I6d3880c7d99d4fc494c8fffd16fb01b9d9480c67
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2022-06-27 17:39:35 -07:00
Thiago Macieira
5e67e7efaa FatalSignalHandler: print some more information from siginfo_t
The siginfo_t parameter allows us to show what process sent a signal or
the crashing address. Additionally, it allows us to determine if the
crashing signal was indeed sent due to a crash.

The selftest tst_crashes produces now:

$ QTEST_DISABLE_STACK_DUMP=1 ./crashes
********* Start testing of tst_Crashes *********
Config: Using QtTest library 6.4.0, Qt 6.4.0 (x86_64-little_endian-lp64 shared (dynamic) debug build; by GCC 11.2.1 20220420 [revision 691af15031e00227ba6d5935c1d737026cda4129]), opensuse-tumbleweed 20220428
PASS   : tst_Crashes::initTestCase()
Received signal 11 (SIGSEGV), code 1, for address 0x0000000000000004
         Function time: 0ms, total time: 0ms
[1]    201995 segmentation fault (core dumped)  QTEST_DISABLE_STACK_DUMP=1 ./crashes

The last line comes from the shell. The code isn't decoded, but on Linux
it's a SEGV_MAPERR. macOS prints exactly the same thing.

I've updated one of the expected_crashes_*.txt output that doesn't seem
possible (the "Received a fatal error" message does not appear in Qt
anywhere).

Pick-to: 6.4
Change-Id: I5ff8e16fcdcb4ffd9ab6fffd16ebc8391234f0e2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-06-28 00:39:35 +00:00
Thiago Macieira
68a1f9582b QFont: don't detach the families list in family()
Pick-to: 6.3 6.4
Change-Id: Id0fb9ab0089845ee8843fffd16f93a8b9306b89b
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-06-27 17:39:35 -07:00
Thiago Macieira
5e60b2ab16 QProcess: re-enable pdfork() on FreeBSD
The forkfd_pidfd is a Linux feature, but we ended up disabling the
equivalent functionality on FreeBSD.

Pick-to: 6.3 6.4
Change-Id: I6d3880c7d99d4fc494c8fffd16fabfbc38865f94
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-06-27 17:39:35 -07:00
Mårten Nordheim
44927b801a QTest: switch some text-conversion functions to use qsizetype
To avoid potential narrowing.

Pick-to: 6.4
Task-number: QTBUG-104125
Change-Id: I37bfc5c49e7c919f5204a76a905758a92527d864
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-06-28 00:39:35 +00:00
Alexandru Croitor
3eaf6a4cad CMake: Remove Gui dependency of androidtestrunner
It doesn't use any Gui classes and thus shouldn't depend on Gui.
Also change PUBLIC_LIBRARIES to LIBRARIES, executables don't need to
propagate library dependencies.

Pick-to: 6.2 6.3 6.4
Change-Id: I9edae7e555e1d74d63b00afbf9e3931963b502c2
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-06-28 00:52:38 +02:00
Fabian Kosmale
ba2ae1720a QString(En|De)coder: Remove noexcept from ctor taking name
It is necessary as the QStringConverter ctor is no longer noexcept, as
it can now allocate memory.
This change is ABI-wise safe, as the method was only changed to be
noexcept in 6.4.
Amends 122270d6be.

Pick-to: 6.4
Change-Id: Ifab4302d659524e27f38f0f90e5813a2c2a4a452
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-06-27 18:25:06 +02:00
Allan Sandfeld Jensen
a2501fff81 Avoid reading outside allocated buffer
Bound the inverse lookup result on the low end as well.

Pick-to: 6.4 6.3 6.2
Fixes: QTBUG-104583
Change-Id: Id357fe1c39c88776075d737b08fc2864a2b6e829
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-06-27 16:16:20 +00:00
David Skoland
a0ecc14f30 Minor fixes for qt-configure-module
Put quotes around args var and add e and u flags, which
do the following:

e - terminates the script if an error occurs. This is
certainly desirable behavior. We don't want the script to chug
along with unpredictable behavior if an error occurred.

u - terminates the script if an undefined variable is encountered.
It is also desirable to terminate here because it might lead to
unexpected behavior.

Change-Id: Ia02196ef3eab64521e36771530d033a15bb40ecc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-06-27 17:55:19 +02:00
Topi Reinio
4a14a9c014 Doc: Fix QJniObject::construct() documentation
Even though QDoc accepted the \fn signature without a class scope,
the documentation does not end up on the class reference unless we
mark construct() as a member of QJniObject.

Pick-to: 6.4
Change-Id: Icae44f8eb24aa6b269242084479e735f2637c312
Reviewed-by: Luca Di Sera <luca.disera@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-06-27 16:03:52 +02:00
Laszlo Papp
9521a07af2 QKeySequenceEdit: add a maximumSquenceLength property
At the very least, it would be important to have a single combination
key sequence. This is commonly seen in keyboard shortcut editors where
QKeySequenceEdit is very much applicable.

[ChangeLog][QtWidgets][QKeySequenceEdit] Added a maximumSquenceLength
property.

Done-with: Marc Mutz <marc.mutz@qt.io>
Change-Id: Id7fa5a8593eb150fa67d7e89308492c0a200ac36
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-06-27 12:02:47 +00:00
Mårten Nordheim
4d60ba61dc Fix QDBusInterface crashing with empty path on construction
On some machines having an empty path passed to QDBusInterface
would cause a crash.

This happened because the code created a QDBusMessage and manually
marked it as validated when it was not. The validation would not
pass for this object.

Change-Id: I496dd922fa64353399655a1e84996b99990f5879
Pick-to: 6.4 6.3 6.2 5.15
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-06-27 14:02:47 +02:00
Mårten Nordheim
2ba153dd5f QHttpHeaderParser: fix int/qsizetype nags
These values won't extend past MAX_INT but it may produce warnings
nonetheless.

Found by clang-tidy.

Pick-to: 6.4 6.3
Task-number: QTBUG-104452
Change-Id: Icd8aa80a318274be00a3b32ad26a92745903cecb
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-06-27 14:02:47 +02:00
Mårten Nordheim
f5138d3065 QHttpHeaderParser: fix clang-tidy nags
"use empty instead of checking size"
"no else following return"
"initialize your variables"

Change-Id: I4512471ec15a00f7ac1fccf88a3c87b8aa983ad7
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-06-27 14:02:47 +02:00
Lars Schmertmann
e3ea1d02e6 QHttpHeaderParser: Allow larger fields but restrict total size
Our limit of 8k for a single header field was too small for certain
services which returned Location values or WWW-Authenticate challenges
longer than 8k.

Instead, taking inspiration from Chromium, we have a limit of 250k for
the full header itself. And increasing our field limit to 100k, which
would occupy almost half of what the total header allows.

Also took the opportunity to make it adjustable from the outside so we
can set more strict limits in other components.

Fixes: QTBUG-104132
Pick-to: 6.3 6.4
Change-Id: Ibbe139445e79baaef30829cfbc9a59f884e96293
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2022-06-27 14:02:47 +02:00
Andreas Eliasson
e8a782fb2c Doc: Document QML_IMPORTS_PATH and QMLPATHS
Fixes: QTBUG-101615
Pick-to: 6.4 6.3 6.2 5.15
Change-Id: I0c83f36db4e4731095610683c4a722438f9b804e
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2022-06-27 12:02:47 +00:00
Andrei Golubev
e1abacfdf7 moc: Cleanup handling of default arguments in functions
Change-Id: I0a381525b92ce5f0b51296a02d9ab98c7a204efc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-06-27 11:05:23 +00:00
Ulf Hermann
7415e53a8b moc: Strip parentheses from RESET methods in JSON output
READ, WRITE, NOTIFY etc all come without parentheses. What we actually
want to check in the generator is whether the reset method is empty.

Task-number: QTBUG-104508
Change-Id: If8c70c7491b25e3c4d9a39dc2c0add0212e64dea
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2022-06-27 13:05:23 +02:00
Toni Saario
bc8ee34e87 Adjust documentation build dir for out of source builds
As the build dir was changed the location of CMake build files changed,
which resulted in "could not load cache" error.

Change-Id: I97d55d060bfab08ab54d1b15d9eabbede1776155
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-06-27 11:05:23 +00:00
Andreas Eliasson
a6df765b03 Doc: Revise Qt Test Module landing page
Most of the module landing pages now follow a certain content structure.
In this case, the reference section should be placed before the
licenses and attributions section. Also, to make the wording consistent
across all module landing pages, use the globally available word
snippets.

Pick-to: 6.4
Change-Id: I2b2164eb1b8a0eb91db0f1efea8390956d54b29e
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2022-06-27 11:05:23 +00:00
Laszlo Agocs
c0509ef586 vulkan: Have a dummy format type if there is no Vulkan header
...at application build time.

Follow what is already done for some other Vk* types.

Supports 1df2cf6bad7207f16ddca17344cc1324e50f287e in qtdeclarative,
which puts now also VkFormat into a header. We need the function
declaration to compile without a Vulkan SDK (so without vulkan.h).

Pick-to: 6.4
Fixes: QTBUG-104501
Change-Id: I09c87149a53a45f03c9f75b87baec4323db16b1d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-06-27 12:23:31 +02:00
Eskil Abrahamsen Blomfeldt
20ae170b35 Enabler for fractional scaling of text in Qt Quick
As opposed to the raster engine, in Qt Quick we are using
unscaled positions for the glyphs and using the vertex shader
to scale these after the fact. However, when picking the
correct subpixel rendering for each glyph, we would use the
unscaled position's fractional part, meaning that we
essentially rendered the glyphs at the wrong subpixel position.

This was especially visible when doing fractional scaling, e.g.
125%.

Thus we need to get the fraction of the actual on-screen position
instead. This has to be done both when populating the cache for
the Qt Quick case (this enabler adds it as opt-in) and also when
actually selecting the correct rendering of the glyph (change in
Qt Declarative).

Pick-to: 5.15 6.2 6.3 6.4
Task-number: QTBUG-101008
Change-Id: Ie67948b138f578b5f40d6a950c4aa92394a8f09a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-06-27 06:19:39 +00:00
Bartlomiej Moskal
9efaf8bae9 Android: Do not set release flag for signed package
Before this change, signing package by androiddeployqt automatically
implied the --release option.
It is possible to create both debug and release packages when signing on
Android, so we shouldn't be enforcing this restriction on Qt app builds.

Commit removes setting releasePackage option, when processing the --sign
argument in androiddeployqt.

Task-number: QTBUG-103281
Change-Id: Id40a41255e51d6820b44f078667dc8318a90bbc5
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-06-27 07:48:35 +02:00
Giuseppe D'Angelo
7466422e9c Add a way to declare _exported_ logging categories
If a library declares a logging category that needs to be used
by clients (e.g. via inline methods, macros, etc.), then the
logging category function generated by Q_DECLARE_LOGGING_CATEGORY
has to be exported.

We've seen this problem with Q_NAMESPACE, Q_GADGET, etc.: these
macros also declare functions or objects that in some cases need to
be exported.

And precisely like Q_NAMESPACE, Q_GADGET, etc., people end up
relying on the implementation details of Q_DECLARE_LOGGING_CATEGORY
(specifically, what does it expand to) in order to place the
export directives in the right place.

Introduce a more robust solution and apply it around qtbase.
Cleanup some minor code as a drive-by (remove `extern` and useless
semicolons).

[ChangeLog][QtCore][QLoggingCategory] Added the
Q_DECLARE_EXPORTED_LOGGING_CATEGORY macro, in order to allow dynamic
libraries to declare a logging category that can be then used by
client code.

Change-Id: I18f40cc937cfe8277b8d62ebc824c27a0773de04
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2022-06-27 00:12:56 +02:00
Allan Sandfeld Jensen
821aa1ff09 Avoid SSE2 punning
It is technical UB, even if GCC promises to let it work, but it also
generates inefficient code.

Pick-to: 6.4
Change-Id: I8f0cae3490d32287ecbaa16b1e9ace84223cda2a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-06-25 19:49:23 +02:00
Allan Sandfeld Jensen
7a146019e4 Sync qt_scale_image_argb32_on_argb32_sse2 and qt_scale_image_32bit
The rounding was different in the SSE2 version compared to the C
version.

Pick-to: 6.4 6.3 6.2
Fixes: QTBUG-85109
Change-Id: I81f0a71ee5425b93da80b6a438e1778a02b9bcfa
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-06-25 19:49:15 +02:00
Thiago Macieira
5db3fd29b4 qmetatype.h: add QT_FOR_EACH_STATIC_PRIMITIVE_NON_VOID_TYPE
This allows us to simplify the explicit specialization of the
QMetaTypeInterface<void> explicit specialization, dropping the warning
push/pop, and remove an unnecessary explicit instantiation.

Pick-to: 6.3 6.4
Change-Id: Id0fb9ab0089845ee8843fffd16f9bdccf1965b95
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-06-24 20:01:43 -07:00
Thiago Macieira
97fbf7d151 qmetatype.h: remove unnecessary EXPORT macro
It was introduced in commit d9f9bc9bad for
Qt 6.0 to avoid extern __declspec(dllexport), which MSVC doesn't like,
but was made obsolete by commit 77b99e8111
that removed the extern templates altogether for MSVC.

This change is NOT a no-op because Q_CORE_EXPORT expands to
Q_DECL_IMPORT which is __attribute__((visibility("default"))) on ELF
platforms. That's actually a good thing, because the symbol is not
defined in any library that is not called QtCore anyway. GCC and Linux
are also going towards properly requiring imported symbols to be
explicitly marked, which this is.

Task-number: QTBUG-93471
Pick-to: 6.3 6.4
Change-Id: Id0fb9ab0089845ee8843fffd16f99616883281e3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-06-24 20:01:32 -07:00
Thiago Macieira
8726647df4 moc: put the qt_meta_stringdata_XXXX_t type in an unnamed namespace
Not all user code is compiled with hidden visibility, so make sure one
of the types in the template parameters (the one that is supposed to be
unique anyway) is local and therefore causes the full symbol for the
inline variable not to be exported outside of the translation unit.

Pick-to: 6.4
Change-Id: I6d3880c7d99d4fc494c8fffd16fb262a59b81283
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-06-24 19:05:58 -07:00
Thiago Macieira
0978646a65 moc: remove the attempt to create one large string literal
Commit dda9c9e2bc fixed some outstanding
issues with moc's calculation of the maximum string length, but it
missed one. This commit instead opts to remove the calculation entirely
and instead have multiple char array members in the qt_meta_stringdata.
We needed a single string back in Qt 4.0 when the stringdata *was* a
single char array.

Since 5.0, we've used a structure with multiple members and pointer
arithmetic going past the end of the arrays, from the top of the object.
That's UB, but since it's always been UB and can't be fixed until Qt 7
anyway, let's go full monty on it and have one char array per meta
object string.

The struct qt_meta_stringdata_Qt_t for namespace Qt now has 1217
stringdataXXX members.

Pick-to: 6.2 6.3 6.4
Change-Id: I6d3880c7d99d4fc494c8fffd16fb0d1573e387dc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-06-24 19:05:57 -07:00
Thiago Macieira
3816b14ee8 moc: properly indent the output for the metatype array
Commit 7ff7d73f6a added the indentation,
but there were a few mistakes and it was off by 4 spaces anyway. So re-do
it and take the opportunity to add some comments to explain what we're
seeing.

Before:
qt_incomplete_metaTypeArray<qt_meta_stringdata_QTimer_t,
    QtPrivate::TypeAndForceComplete<bool, std::true_type>,
    QtPrivate::TypeAndForceComplete<int, std::true_type>,
    QtPrivate::TypeAndForceComplete<int, std::true_type>,
    QtPrivate::TypeAndForceComplete<Qt::TimerType, std::true_type>,
    QtPrivate::TypeAndForceComplete<bool, std::true_type>,
    QtPrivate::TypeAndForceComplete<QTimer, std::true_type>,
    QtPrivate::TypeAndForceComplete<void, std::false_type>
,
    QtPrivate::TypeAndForceComplete<void, std::false_type>,
    QtPrivate::TypeAndForceComplete<int, std::false_type>,
    QtPrivate::TypeAndForceComplete<void, std::false_type>,
    QtPrivate::TypeAndForceComplete<void, std::false_type>

>,

After:
    qt_incomplete_metaTypeArray<qt_meta_stringdata_QTimer_t,
        // property 'singleShot'
        QtPrivate::TypeAndForceComplete<bool, std::true_type>,
        // property 'interval'
        QtPrivate::TypeAndForceComplete<int, std::true_type>,
        // property 'remainingTime'
        QtPrivate::TypeAndForceComplete<int, std::true_type>,
        // property 'timerType'
        QtPrivate::TypeAndForceComplete<Qt::TimerType, std::true_type>,
        // property 'active'
        QtPrivate::TypeAndForceComplete<bool, std::true_type>,
        // Q_OBJECT / Q_GADGET
        QtPrivate::TypeAndForceComplete<QTimer, std::true_type>,
        // method 'timeout'
        QtPrivate::TypeAndForceComplete<void, std::false_type>,
        // method 'start'
        QtPrivate::TypeAndForceComplete<void, std::false_type>,
        QtPrivate::TypeAndForceComplete<int, std::false_type>,
        // method 'start'
        QtPrivate::TypeAndForceComplete<void, std::false_type>,
        // method 'stop'
        QtPrivate::TypeAndForceComplete<void, std::false_type>
    >,

Pick-to: 6.4
Change-Id: Id0fb9ab0089845ee8843fffd16fa152d040ef922
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2022-06-24 19:05:57 -07:00
Thiago Macieira
f5697d2b2a tst_moc: fix build with GCC 12
You can't mismatch the export macros. The QT_MOC_EXPORT_PLUGIN_V2 macro
defines these functions as Q_DECL_EXPORT so they can be found by
QPluginLoader. We must match the macro here, otherwise GCC 12 complains
(tst_moc.cpp is compiled with -fvisibility=hidden):

tst_moc.cpp.o: non-canonical reference to canonical protected function `qt_plugin_instance' in moc_plugin_metadata.cpp.o

Pick-to: 6.4
Change-Id: Id0fb9ab0089845ee8843fffd16f99893d5730da5
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-06-24 19:05:53 -07:00
Shawn Rutledge
846b314aaf Emit autolinks in QTextMarkdownWriter
When a markdown document contains a "naked" URL, or an angle-bracketed
<URL>, md4c recognizes it, and we set the AnchorHref charfmt property.
There's no need to expand it into the [text](url) form if the text is
the same as the url, there is no tooltip, and the url is valid.
QTextMarkdownWriter now writes a CommonMark "autolink" in that case:
https://spec.commonmark.org/0.30/#autolinks

[ChangeLog][QtGui][Text] QTextMarkdownWriter now writes an autolink
whenever a hyperlink has no custom text and no tooltip, including
when the document was parsed from Markdown containing a naked URL.

Pick-to: 6.4
Fixes: QTBUG-94713
Change-Id: I432db8499c62e1e0b1e913bfd8ef2147e3c2bb2a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-06-24 22:42:43 +02:00
Shawn Rutledge
56f0ebfe86 Support markdown in QTextEditMimeData; fix pasting trailing newlines
- Since 4edcea762d the dropsite example
  shows markdown if available; and now it shows that when we do DnD
  of a selection from the richtext example, text/markdown is available.
- If we artificially make html unavailable, copying and pasting between
  widget-based rich text editors uses markdown.

In case markdown writer output contains unnecessary backticks due to
monospace fonts getting used, the workaround from
1ad456c908 is applied.

Pick-to: 6.4
Task-number: QTBUG-76105
Task-number: QTBUG-103484
Change-Id: Ie6ca4dbb450dbc36b3d09fd0df1ae5909aaebca7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-06-24 22:42:28 +02:00
Toni Saario
ec0ecedf2a Blacklist qtcpsocket bind on arm macOS
This was unblacklisted in b885820c39
however it is still very flaky.

Change-Id: If9796231c584c894387106dfeb262c9eb4ce73f5
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-06-24 17:20:02 +00:00
Mårten Nordheim
6cbe8f74ce Network: Update expired cert
Pick-to: 6.4 6.3 6.2 5.15
Change-Id: I233ffee5b720c0554071c1d49d4fb861736b2e2a
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-06-24 17:20:00 +00:00
Ulf Hermann
c52e0a9582 QAbstractItemModel: Add revisions to new methods
These methods show up in QML-exposed types. They should be revisioned in
order to keep those types backwards-compatible.

Pick-to: 6.4
Change-Id: I8e826dc2e7db49d8abe69f67605dfb1991855b96
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2022-06-24 19:14:17 +02:00
Duan Ting
cd268e9e1d Fix typo in code
Found by codespell

Pick-to: 6.4 6.3 6.2 5.15
Change-Id: I75f4b14f3eded035a0c904d8a7174cb6f5b7d9ef
Reviewed-by: Wang Bo <wangbo@uniontech.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-06-23 12:34:00 +08:00