Commit Graph

53084 Commits

Author SHA1 Message Date
Fan RuiJie
586d9e6013 Fix text ellipsis not implemented in Tibetan
The original code checks the existence of an ellipsis character first.If
this does not exist (glyph == 0,which is an invalid glyph index), then
it falls back to looking up '.'. But in the Tibetan environment,the
glyphIndex('.') also returns 0, so that it simply doesn't add any form
of "...", and cuts the text instead.

If both the attempts at getting something from the main font fails,
we can do a third pass on the "multi" font engine.

Fixes: QTBUG-95942
Pick-to: 6.1 6.2
Done-with: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Change-Id: I251de3fe92e19be0462c58c2059ecf7d354bfbb0
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2021-08-31 14:53:45 +00:00
Yang Yuyin
6e9cae0b77 QFileDialogComboBox: member variable is not initialized
initialize d_ptr in the constructor

Pick-to: 6.2
Change-Id: I5a8062dd0a81023e6c1a5858bb8603d279cdbcee
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-08-31 13:18:15 +02:00
Craig Scott
08180e76e6 Ensure versionless wrappers do not introduce a new variable scope
Using function instead of macro prevented the wrappers from being able
to pass back any variables set in the wrapped function. In some cases,
these variables were being explicitly passed back to the caller, but
that isn't needed if you just make each wrapper a macro. This also
makes things more future-proof because any newly introduced output
variables will work without having to update the wrappers.

Task-number: QTBUG-96121
Pick-to: 6.2
Change-Id: Ic4486de668694c06b47e466587b2cdcb969ea047
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-08-31 17:05:15 +10:00
Robert Löhning
d54d91c0ad Fuzzing: Discard more logging output from QSslCertificate
When linked to OpenSSL, qt.tlsbackend.ossl will log.

Change-Id: I6f0e3c3e6af73b29cff93b8efe39933e5b36d493
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-08-30 22:05:49 +02:00
Volker Hilsheimer
6e2a5312db Revert "Forward touchEvents to children inside QGraphicsProxyWidget"
This reverts commit 1ecf2212fa.

The fix is not correct after all. TouchBegin goes to the correct
widget with the fix, but following TouchUpdate and TouchEnd events
now go to the viewport, as QApplication::translateRawTouchEvent always
gives precedence to the widget that Qt recorded to be the touch
grabber, which is the viewport. This results in infinite recursion,
as the proxy widget trying to send the touch events to the embedded
widget (expecting that translateRawTouchEvent will split it up) ends
up sending the events back to the viewport.

Leave the added test case as QEXPECT_FAIL, reactivate the (never run,
hence unnoticed) test that the fix broke.

Pick-to: 6.2 6.1
Task-number: QTBUG-45737
Task-number: QTBUG-67819
Change-Id: I4810affb3cd066743ae94ab7beb2f0c06b60d211
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-08-30 19:34:50 +00:00
Assam Boudjelthia
d9381bc7c3 Enable building and uploading tests for Android targets if tests enabled
Enable building and uploading test artefacts for all modules in case
tests are enabled.

Pick-to: 6.2
Task-number: QTBUG-88846
Change-Id: I30832820dea348187b517e170fa1c5266db85604
Reviewed-by: Toni Saario <toni.saario@qt.io>
2021-08-30 20:51:47 +03:00
Edward Welbourne
c8144681aa Add note to QList benchmark about known bug
Task-number: QTBUG-95096
Change-Id: I08f789f2e6ed70507da18e629140404f09bfae12
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-08-30 19:21:08 +02:00
Edward Welbourne
9004a2412b Standardise layout and naming in corelib benchmarks
Make file names match CMake's test names (and those follow dir-name)
and class names follow tst_ClassName pattern when testing
ClassName. Purge comments about the qmake configs the CMakeLists.txt
are generated from.  Purge empty constructors and init/cleanup methods
of classes.  Fix petty coding style violations.

Add qdir/tree/, qurl, qbench and qset benchmarks to their parent directories'
lists of subdirs. Fix unused return error from qurl benchmark.

Change-Id: Ifc15a3a46e71cf82ad0637753517e0df34049763
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-08-30 19:21:08 +02:00
Edward Welbourne
c2a6749af7 Clean up QLocaleData::validateChars() and fix its double-handling
Decrementing decDigits and checking for zero is less complicated than
incrementing a counter to check against it if it's not negative.

A plethora of unenlightening local variables could be replaced by
keeping track of the last character and of a simple state variable
that make checks easier to understand (and explain).
Various conditions could be expressed more simply.

Comment on the condition for omitting grouping characters from the
transcript - it was easy to mistake the comma for a dot !
Comment on the lack of checking of grouping sizes.

Change-Id: Iff8da2376507d2abbbaf5739baf6cbb23e55edaf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-08-30 18:48:39 +02:00
Volker Hilsheimer
5c7c2f84bc Move QGraphicsProxyWidget test into correct test case
The test case was previously disabled, so tests were added to the
QGraphicsView test instead. With the QGraphicsProxyWidget test active
again, move the test cases where they belong.

Amends 1ecf2212fa,
01aeb5f7e4, and
06235d36ae

Pick-to: 6.2
Change-Id: I208b8a418653cf0640c2e7c9f716fa69538ad7e9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-08-30 18:20:08 +02:00
Volker Hilsheimer
a49ba9265f Reactivate QGraphics(Proxy)Widget unit tests
They were de-facto disabled in the qmake build system, and didn't make
it into the cmake build system either. The dependency to the fusion
style is not a build-time dependency since the test uses the
QStyleFactory to create the style, and if that fails, tests can be
skipped at runtime.

As a consequence of not being executed in CI for a long time, many
tests failed. Also, many tests were commented out or skipped as
broken, ambivalent, or nonsensical. Remove that dead code. The
QGraphicsWidget::initialShow test doesn't test anything that initialShow2
doesn't test, but makes incorrect assumptions, so remove it and rename
initialShow2 to initialShow.

Failing tests frequently left QWidget objects undeleted, causing all
subsequent tests to fails as well. Fix that with std::unique_ptr.

Some tests are still unstable and fail on some platforms, handle that
using QEXPECT_FAIL. The forwardTouchEvent test fails due to a bug
in Qt introduced recently. Skipping it for now.

Pick-to: 6.2
Change-Id: I405122ea9d4d150bd1d505d40b83fe39604de0f9
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-08-30 16:20:08 +00:00
Edward Welbourne
4e9efb0b60 Teach QByteArrayView how to parse numbers
Now that we don't need '\0'-termination on the data, this is possible.
Moved QByteArray's tests to tst_QByteArrayApiSymmetry and added some
more test-cases.

[ChangeLog][QtCore][QByteArrayView] Added numeric parsing methods.

Change-Id: Ic0df91ecfe5dbf6f008d344dd0464d7927f32273
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-08-30 17:46:00 +02:00
Edward Welbourne
6db5fd5918 Avoid UB (and the consequent need to suppress an MSVC warning)
Converting a negative signed value to its absolute value in the
matching unsigned type can be done by adding one, negating (which we
can now do without the UB), casting and then adding one again.
This is cleaner than casting the negative value to the unsigned type
in order to then "negate" it within that type, about which MSVC
grumbles; we can now avoid the need to suppress that grumble.

Change-Id: I9148ead23c928aeb2b90884a2f2e292fdf3af5e3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-08-30 17:46:00 +02:00
Edward Welbourne
0564e4afba Remove temporary inlines for qstrtou?ll()
All callers are now converted to use qstrntou?ll().

Change-Id: I279a800a9f19944e544cc8a7ebaba579d18643b3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-08-30 17:46:00 +02:00
Edward Welbourne
88b54cc22a Rework QLocalePrivate::bytearrayToU?LongLong()
Change it to take a QByteArrayView instead of a plain char *; all its
callers do know the size and propagating it enables the implementation
to call strntou?ll() rather than strtou?ll(), thereby escaping the
need for '\0'-termination.

Fixes: QTBUG-74286
Change-Id: Ie9394786e9fcf25c1d1be2421805f47c018d13bb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-08-30 17:46:00 +02:00
Edward Welbourne
7d33779a79 Convert various callers of strtou?ll() to call strntou?ll()
Where size is known or can readily be determined.

Change-Id: I442e7ebb3757fdbf7d021a15e19aeba533b590a5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-08-30 17:46:00 +02:00
Edward Welbourne
5644af6f8a Replace FreeBSD's strtou?ll() with std::from_chars()-based strntou?ll()
Remove third-party code in favor of STL. Implement (for now)
strtou?ll() as inlines on strntou?ll() calling strlen() for the size
parameter. (This is not entirely safe, as a string lacking
'\0'-termination but with at least some non-matching text after the
numeric portion would formerly be parsed just fine, but would now
produce a crash. However, strtou?ll() are internal and callers should
be ensuring '\0'-termination.)

Task-number: QTBUG-74286
Change-Id: I0c8ca7d4f6110367e93b4c0164854a82c5a545e1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-08-30 17:46:00 +02:00
Mårten Nordheim
522ca997d3 TLS plugins: Prefix with 'q'
For consistency with other plugins.

Pick-to: 6.2
Change-Id: I45507389a42e645c94f1ca3f32262a2181f282f7
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-08-30 12:35:41 +00:00
Iikka Eklund
83752fcd2b Conan: Rename 'extra_cmake_args' Conan option as 'cmake_args_qtbase'
It turns out that we need to support two ways to pass cmake args as
Conan options. Those that are meant for qtbase only,
like "-DCMAKE_TOOLCHAIN_FILE={{.Env.ANDROID_NDK_ROOT}}", and those
that are meant for leaf modules only.

Rename the current 'extra_cmake_args' Conan recipe option as
'cmake_args_qtbase' to make it clear these cmake args are passed
to qtbase build only.

The leaf modules will be using 'cmake_args_leaf_module' as the
Conan option name.

Pick-to: 6.2
Change-Id: I456b8b07da5684f386cac668a5cd3e2509c733ac
Reviewed-by: Toni Saario <toni.saario@qt.io>
2021-08-30 05:51:36 +00:00
Iikka Eklund
122a45cd73 Conan: recipe cleanups
- Fix license reference in the recipe.
- Fix line lengths exceeding 100 characters.
- Code formatting changes as suggested by 'black' tool.
- Remove superfluous Path() usage.
- Improve Qt version parsing from file.

Pick-to: 6.2
Change-Id: Ie0534a1d4fb7b2c1dc697117bd4cb2d4ceda0622
Reviewed-by: Toni Saario <toni.saario@qt.io>
2021-08-30 05:51:12 +00:00
Assam Boudjelthia
07283f1527 Android: pass -g to testrunner to grant run time permissions
Some Qt modules/tests go through features that require run-time
Android permissions which are granted by user input, that of
course is not ideally possible while running unit tests. So when
installing the app adb can do that for us.

Pick-to: 6.2
Change-Id: I92d33d5213c3779d7ca246ec0fb359d2ead4fa6f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-08-29 19:39:42 +03:00
Tor Arne Vestbø
52f635b9a0 macOS: Hide mouse cursor when initiating IM enabled text input
Fixes: QTBUG-72744
Pick-to: 6.2
Change-Id: I952710e88a11fd00498562c9011461a010f02f7b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-08-27 22:41:09 +02:00
Tor Arne Vestbø
3de396590c macOS: Correctly implement attributedSubstringForProposedRange
The substring range refers to the entire text of the focus object,
not just the selection.

As there is no way to pull out the entire text via input method queries
we do the best we can via ImTextBeforeCursor and ImTextAfterCursor.

Returning the correct substring enables input method features such
as backtracking into already committed text with the Hiragana IM,
as well as the Keyboard Viewer's 'Current Text' toolbar.

Pick-to: 6.2
Change-Id: I53286ef1e8e7c5fba37858dda7317ae74d95b528
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-08-27 22:41:06 +02:00
Tor Arne Vestbø
9e1875483c macOS: Assume input method handles key event
When input methods are enabled for the focus object we send key events
through interpretKeyEvents, which will involve the input method in the
key event processing. The input method will get back to us with callbacks
such as insertText, setMarkedText, or doCommandBySelector.

In the case of insertText, when the inserted text matches the originating
key event's text, we opt to not send the text as an QInputMethodEvent,
and instead fall back to sending it as a normal QKeyEvent. The reason
for this is that Qt's IM protocol was designed to handle composited
text, so sending non-composited (but IM-initiated) text input as IM
events is unexpected (see 2d05d3bd28).

However, we cannot assume that the input method will always call us
back with one of the above mentioned methods. The input method can
very well eat the event as part of its own operation. This happens
for example when pressing and holding 'a' in a US English keyboard
layout, which will pop up an input panel for the various accents
available. Or it may happen when using the AquaSKK third party IM,
which uses the 'l' key to switch the input mode to latin without
producing any characters.

To allow these input methods the freedom to control the processing
of key events we need to reverse the logic for when we send key
events as QKeyEvent. We now assume that the IM will handle the
event, and only trigger QKeyEvent in two cases where we explicitly
were called back by the IM, but decided that a QKeyEvent is needed:

 - If the IM calls insertText and we consider the text simple text
 - If the IM calls doCommandBySelector and we can't find a matching
   selector for the command. We only implement insertNewline and
   cancel, so in all other cases we want to pass on the key event
   to let the focus object handle it, for example for 'Select All'
   and similar key combinations.

Fixes: QTBUG-46300
Fixes: QTBUG-71394
Pick-to: 6.2
Inspired-by: Vladimir Belyavsky
Change-Id: I9a73a8e1baa2ebe0c5df1166a9ec3d9843632bb1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-08-27 22:41:03 +02:00
Mårten Nordheim
587d64507a QNetworkAccessCache: Remove unused code
The function was never called. As a consequence receiverQueue was
only ever read and never written.

Change-Id: I30905446452d9f263124d3af08c42e2e1b0cafbe
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-27 21:17:04 +02:00
Shawn Rutledge
ba8f9d8d92 Fix deprecation of QMouseEvent::source() and flags()
Amends 53496e67f0:
- move flags() out of the QT_DEPRECATED_SINCE block in the header
- add QT_DEPRECATED_SINCE block around source() implementation

Pick-to: 6.1 6.2
Change-Id: Id52fa6b04a13efbede3e6ac440060f90b283e773
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-08-27 20:31:18 +02:00
Edward Welbourne
9810cbcd18 Include what you use ! filesystem.h uses QOperatingSystemVersion
So include that; and sort the includes while I'm about it.

Change-Id: I0f922f7883f1e32b8bbcf555617588fa9cfacaaa
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-08-27 20:31:18 +02:00
Edward Welbourne
d95f4d0018 qlocale_win: Simplify and explain month-name format lookup
Retain the given month number and simply subtract one from it in the
one place it's used (once the two array dereferencs are unified). That
makes it clear that the off-by-one numbering is just down to our
arrays, not some weired quirk of the MS API. Simplify a condition by
inverting it: compare to LongFormat instead of ||-ing comparisons to
the other two members of the enum.

Change-Id: Ia03486b7869255ecdb1372de62d5c745d35d0a0a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-08-27 20:31:18 +02:00
Juha Vuolle
17d7a8dc2e Update Android default SDK from 29 to 30
By the time of Qt 6.2 release all new apps targeting Play store must
target API level 30 (Android 11) or above (starting in 08/2021 for
new apps and 11/2021 for existing apps' updates).

Pick-to: 6.2 5.15
Task-number: QTBUG-94451
Change-Id: Id7fa2fd62899a7259e365c917292c6c3ac0d2b0d
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-08-27 18:31:17 +00:00
Edward Welbourne
1bdc35bfe0 Add more tests of blacklisting, combined with XPASS and XFAIL
Include counting of test types, to catch two more cases where totals
don't add up.

Task-number: QTBUG-95661
Change-Id: I9fe5424bc6652c61a065bf2889333e2ed9437c81
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-08-27 20:16:18 +02:00
Edward Welbourne
be72cb9cfd Include check for the Totals line in testlib's expectedfail selftest
Count how many we expect to pass, fail and be skipped, so we can
report that for comparison with the actual totals line: this reveals
some double-counting, marked with a FIXME.

Task-number: QTBUG-95661
Change-Id: I8b0f13ded5202ed476d8abfee70ed60f9e639bf9
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-08-27 20:16:18 +02:00
Edward Welbourne
7af79ba091 Make clear why QTestLog::addB?XFail() don't add to counters
This reverts commit 904617dfb8 and makes
clear to future readers why that wouldn't be a sensible change.
Update the test's data, eliminating a case of duplicate counting that
was caused by the reverted commit.

Task-number: QTBUG-95661
Pick-to: 5.12 5.15 6.1 6.2
Change-Id: Ice6d3ab06ca171e0d6eb0fac757f1ab774e229f0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-08-27 20:16:18 +02:00
Tor Arne Vestbø
a56b915f71 macOS: Handle replacement range during marking of text
The input method may include already committed text when marking text,
in which case the replacement range reflects the position and length
of the existing text.

We handle this the same way we do replacement ranges in insertText.

Pick-to: 6.2
Change-Id: I148e4701318a59c7e0d9441d157199d7c8606f43
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-08-27 19:49:55 +02:00
Tor Arne Vestbø
f97e936049 macOS: Handle IM insertNewline by sending synthetic Qt::Key_Return
Depending on the input method, pressing enter may result in simply
dismissing the input method editor, without confirming the composition.
For example with Hiragana, pressing 'a', then 'Tab', and then 'Enter'.

In other cases it may confirm the composition as well, for example
with Hiragana, pressing 'a' and then 'Enter'.

And in some cases the IME will produce an explicit new line, for
example with US English, pressing '~' and then 'Enter', or with
2-Set Korean, pressing 'a', then 'j', and then 'Enter'.

Semantically, the input method has then asked us to insert a newline,
and we should probably do so via an QInputMethodEvent, either directly
or via [self insertText:@"\r"]. This is also how NSTextView handles
the command. But, if we did, we would bypass all the code in Qt (and
clients) that assume that pressing the return key results in a key
event, for example the QLineEdit::returnPressed logic.

To ensure that clients will still see the Qt::Key_Return key event,
we send it as a normal key event. But, we can not fall back to
handleKeyEvent for this, as the original key event may have text
that reflects the combination of the inserted text and the newline,
e.g. "~\r". We have already inserted the composition, so we need to
follow up with a single newline event.

Task-number: QTBUG-39125
Pick-to: 6.2
Change-Id: If1e95687e6d5b06011692175a325f457b0b8a72f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-08-27 19:49:55 +02:00
Tor Arne Vestbø
f563203f60 macOS: Factor out key event handling into helper struct
This allows us to share code between handleKeyEvent: and flagsChanged:
for parsing the incoming NSEvent, and allows for sending key events
from other call sites in the future without duplicating the parsing
and sending logic.

Pick-to: 6.2
Change-Id: Ic63f740523496a9432e439663a20f78b5bc234c5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-08-27 19:49:55 +02:00
Tor Arne Vestbø
2945c6223b macOS: Return early from key handler if shortcut was handled
The code paths after accepting a shortcut event can never be hit.

Pick-to: 6.2
Change-Id: Ida77417adb8fcfd25a4b20c4eb86056b3769f014
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-08-27 19:49:55 +02:00
Mårten Nordheim
b33ccd99e1 QNetworkCookie: Clean up
Rewrite the regex to not capture the things we ignore anyway.
Use capturedView to avoid allocating a string just to turn it into an
int.
Fix a (usually) ifdef-ed out piece of code that was still calling
a QRegExp function.
Make the QRegularExpression static const to save it from having to
recompile every time.

Change-Id: I2f4841a2bc35df4e6cea44aec72432410583f770
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-27 19:22:28 +02:00
Edward Welbourne
9935dfe289 New QByteArray::toU?LongLong() benchmark
Change-Id: Ic0581dd5625f9b2750646c73dc80d89741d97a1d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-08-27 18:44:50 +02:00
Laszlo Agocs
8043a1a75a rhi: gl: Set the screen on the context, if possible
Take the screen from the window, if the window was specified.

When it comes to Qt Quick, this is in fact required in order to
make the behavior on par with Qt 5, see
https://code.qt.io/cgit/qt/qtdeclarative.git/tree/src/quick/scenegraph/qsgthreadedrenderloop.cpp?h=5.15#n1336
try to mirror that in Qt 6 as well. There are still subtle differences
between Qt 5 and Qt 6 in particular when qt_gl_global_share_context is
set (do we set the screen from that or from the window?), for now leave
that question unsettled.

What exactly setting the screen on the context does is platform
specific, and can become relevant with multi screen, multi GPU
systems.

Pick-to: 6.2
Change-Id: Icc90b8fea87bf1e34ecf1dec0702f4d3c411db00
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2021-08-27 18:10:33 +02:00
Joerg Bornemann
f9e9d21a11 CMake: Error out if ccache is requested but not found
Before, we would just issue a warning which is likely to get overlooked
in CMake's output.  Also, the configure summary would report "Using
ccache ... yes" but CMAKE_<LANG>_COMPILER_LAUNCHER stays unset, which is
inconsistent.

Make QT_USE_CCACHE=ON and missing ccache a hard error.

Task-number: QTBUG-88308
Change-Id: Iddc7f3a91428fd96ad0defbb1ca72bd46a90aa98
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-08-27 16:29:49 +02:00
Joerg Bornemann
d94652f792 Call MinGW's ld with -Bstatic when requesting static runtime linkage
The -static argument we used before is supported by ld, but not lld.
The latter requires --static or -Bstatic.  Use -Bstatic, which is
supported by both.

Pick-to: 6.2
Fixes: QTBUG-89549
Change-Id: I3c3069661bf4cd20e3298aff4714163b7419d3ef
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-08-27 15:45:25 +02:00
Giuseppe D'Angelo
7d4d47de70 QObject::connect(): fail to connect to a functor if UniqueConnection is passed
The connect() documentation makes it clear that UniqueConnection does
not work with free functions / function objects and the like; only with
actual PMFs. Rather than silently *ignoring* the flag, be vocal about its
presence by warning, and make the connection fail (as the user has
passed an illegal argument).

[ChangeLog][QtCore][QObject] QObject::connect() now will refuse to
connect a signal to a free function / function object if UniqueConnection
is passed. Note that UniqueConnection has never worked for such
connections -- the flag was simply ignored, and they were established
multiple times. Now, the flag is not ignored and results in a connection
failure (as well as a runtime warning by Qt).

Change-Id: I6509667018c74f9bd24910cde0a1b16c5f84f064
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-08-27 15:45:25 +02:00
Giuseppe D'Angelo
c9830c2fb9 QToolButton: reimplement the fix for QTBUG-95255
The code in 188d739400 uses a connect() to
a lambda, passing UniqueConnection to avoid establishing the connection
more than once. The problem is that UniqueConnection does not work
with lambdas; it works only with "regular" PMFs to QObject subclasses.

Re-do the same fix, but without a connection: use the checkStateSet()
virtual from the base class that will notify us if setChecked() is
being called on the tool button, and from there synchronize the state
of the default action.

Change-Id: Id512812c562cd6d20bc1a489753b33c269919d32
Fixes: QTBUG-95255
Pick-to: 6.2 6.1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-08-27 13:45:25 +00:00
Morten Johan Sørvig
89cda52d66 wasm: enable the new event dispatcher for qtcore
Use the new event dispatcher for all non-GUI threads,
nn practice for the main thread when using QCoreApplication,
and when calling QThread::exec().

Change-Id: I9184d52532e06da7e6a87ee27c7d53e0d15e693a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-08-27 15:45:25 +02:00
Morten Johan Sørvig
ecb92aacab wasm: add new event dispatcher implementation
Add QEventDispatcherWasm to QtCore. The event dispatcher
supports managing event queue wakeups and timers, both
for the main thread or for secondary threads.

Blocking in processEvents() (using QEventLoop::WaitForMoreEvents)
is supported when running on a secondary thread, or
on the main thread when Qt is built with Emscripten’s
asyncify support.

Code is shared for all both modes as far as possible,
with breakout functions which handle main and secondary
thread as well as asyncify specifics,. Some functions
like wakeUp() can be called from any thread, and needs
to take the calling thread into consideration as well.

The current asyncify implementation in Emscripten is
restricted to one level of suspend, and this restriction
carries over to Qt as well. In practice this means we
support one level of exec()-like API.

Note that this commit does not _enable_ use of the
new event dispatcher. This will be done in separate
commits.

Task-number: QTBUG-76007
Task-number: QTBUG-64020
Change-Id: I77dc9ba34bcff59ef05dd23a46dbf1873cbe6780
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-08-27 15:45:25 +02:00
Morten Johan Sørvig
82f14a95b5 wasm: add manual tests for main() and exec()
Add minimal examples which demonstrates how exec() works
on Qt for WebAssembly and how to implement main() without
calling QApplication::exec().

Change-Id: I44f1d16af19c538380cc56faf3f0f4cc9d66cf11
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-08-27 15:45:24 +02:00
Morten Johan Sørvig
c6362cd55c wasm: add Emscripten module accessor to qtloader.js
After enabling -s MODULARIZE=1 there is no longer a
global MODULE object. Add module() accessor which can
be used to retrieve the Emscripten module.

This does not really fit with the current state tracking
since the app transitions from “loading” to “running” before
the module object is ready. We’ll have to revisit this
at some point.

Change-Id: Ib7191cf4ce436e1de99f84b63ed4c10936fa62b1
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2021-08-27 15:45:24 +02:00
Alexey Edelev
e1fe816d46 Implement generating of private cpp exports
Add the generating of private cpp exports for Qt modules.

Add the GENERATE_PRIVATE_CPP_EXPORTS option to qt_internal_add_module
that is the manual switch for private exports generator. Existing
modules in qtbase doesn't follow any strict convention of using
private cpp export. So there is no clue how to detect if generating of
the private exports is required or not for the module.

Use autogenerated private cpp exports in QtNetwork module.

CPP_EXPORT_HEADER_NAME argument of the qt_internal_add_module function
is replaced by the CPP_EXPORT_HEADER_BASE_NAME and has a different
meaning. The provided name is used as a base name for the private and
non-private headers that contains cpp exports. Header files suffixes
are constant: .h and _p.h for the non-private and private header files
accordingly.

Pick-to: 6.2
Task-number: QTBUG-90492
Change-Id: Icf11304e00379fb8521a865965c19b974e01e62f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-08-27 11:01:47 +02:00
Alexey Edelev
928ffbd1e2 Use correct module include name across the project
Module may have specific module include name that should be taken into
account when specifying module include directories in different places.
The INTERFACE_MODULE_INCLUDE_NAME module property name is aligned to
the common naming rules and the property is used to preform include
paths instead of the direct use of the module name.

Add additional paths generated by qt_internal_module_info to keep them
consistent across all cmake files.

Pick-to: 6.2
Change-Id: I4c94017abc322c48616f47e65e371bd863bb087d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-08-27 11:01:38 +02:00
Tor Arne Vestbø
abdd524519 macOS: Check NSEvent.characters to determine dead key state
We map NSEvent.characters to text that we pass on in our QKeyEvent,
but for Qt 4 compatibility we explicitly skip function keys and arrow
keys, as the text these events produce are control characters. See
4dbce2a469.

However, these keys are not dead keys, so we can't use the resolved
text we're planning to pass on to Qt to determine if they are.

Pick-to: 6.2
Change-Id: Ib59f0489ae014379c699600f14634c55161ccc8a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-08-27 00:29:08 +02:00