Commit Graph

53458 Commits

Author SHA1 Message Date
Joerg Bornemann
f19668ce65 Don't use libs in /usr/local for configure tests by default on macOS
Since commit f3c7d22dd0 we do not use
libraries from /usr/local and other non-system locations on macOS.  But
our configure tests still did.  This led to discrepancies between
find_package calls in configure tests and the Qt project itself.

Mentioned commit removed /usr/local and friends from
CMAKE_SYSTEM_PREFIX_PATH.  But we can't pass this variable to the
configure tests, because CMake sets it up and overwrites our value.

Pass CMAKE_SYSTEM_PREFIX_PATH and CMAKE_SYSTEM_FRAMEWORK_PATH as
QT_CONFIGURE_TEST_CMAKE_SYSTEM_{PREFIX|FRAMEWORK}_PATH variables to
tests.

Tests with separate project files that call find_package() must add code
like this after the project() command:

if(DEFINED QT_CONFIGURE_TEST_CMAKE_SYSTEM_PREFIX_PATH)
    set(CMAKE_SYSTEM_PREFIX_PATH
        "${QT_CONFIGURE_TEST_CMAKE_SYSTEM_PREFIX_PATH}")
endif()
if(DEFINED QT_CONFIGURE_TEST_CMAKE_SYSTEM_FRAMEWORK_PATH)
    set(CMAKE_SYSTEM_FRAMEWORK_PATH
        "${QT_CONFIGURE_TEST_CMAKE_SYSTEM_FRAMEWORK_PATH}")
endif()

Adjust pro2cmake accordingly.

Task-number: QTBUG-97076
Change-Id: Iac1622768d1200e6ea63be569eef12b7eada6c76
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-10-08 23:15:31 +02:00
Fabian Kosmale
e5183c49dd androiddeployqt: Use QElapsedTimer to get elapsed time
No need to reinevent the wheel. Also, use nanoseconds
now that we have the precision available.

Change-Id: I287d06198edc3f5bdf7f85bd5f3e235b1fea95a3
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-10-08 20:03:22 +02:00
Sona Kurazyan
ce59ccb334 Optimize QPromise destructor
Unify cancel and finish in QPromise destructor in a single call. This
saves us one extra mutex lock and atomic state change.

Task-number: QTBUG-84977
Change-Id: Iac06302c39a2863008b27325fcf6792d4f58c8ae
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-08 17:17:20 +02:00
Mårten Nordheim
22248a4e96 QNI: Windows: Remove unneeded friend
Change-Id: I5d66a67a5c16a479f62b9f43cb769d5ee5f66b60
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-10-08 14:46:14 +02:00
Joerg Bornemann
01bfed1d0a CMake: Generate relative #line directives in qlalr output
When passing an absolute input file name to qlalr, the #line directives
in the output will contain absolute paths.  For reproducible builds,
it's desirable to have relative paths.

Pass the input file as relative path to qlalr to produce relative #line
directives.

Fixes: QTBUG-96267
Change-Id: I4ef1e4d5be7cbaf25a54a34ab7c2dbec06411a1d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-10-08 14:16:52 +02:00
Joerg Bornemann
08a0ba5733 Doc: Prettify -G cmake arguments in SQL drivers documentation
Use '-G Ninja' instead of '-G"Ninja"'.

Pick-to: 6.2
Change-Id: I53a77ea3b2d1547bb516b3ab756f5ae0f24092b1
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-10-08 14:16:51 +02:00
Joerg Bornemann
bf9f0844c2 Doc: Fix cmake build/install commands in SQL driver documentation
Pick-to: 6.2
Fixes: QTBUG-97098
Change-Id: I1c5214d66341aa412c5fc9b2de6d0e26ba4612aa
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-10-08 14:16:51 +02:00
Laszlo Agocs
46e6a9a759 gl: Try the local CacheLocation when the shared one fails
We prefer the shared cache path, because there is no reason to give up
benefitting from sharing the content between applications. If that path
is not QFileInfo().isWritable(), we fall back to the local cache path.

However, there are reportedly systems with security solutions such as
AppArmor where the writable check passes and yet attempting to create a
file still fails. Then there is no cache in effect, because nothing ever
gets written out.

Handle this better: if writing the file fails and we still use our first
choice, the global cache location, fall back to the secondary choice
(the app-local path) and try again.

Pick-to: 6.2 6.1 5.15
Fixes: QTBUG-96789
Change-Id: Ifea32e9af0cf85aa70f3069256ed3d6a7e2fbe90
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Dalton Durst <dalton@ubports.com>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-10-08 11:07:15 +02:00
Laszlo Agocs
cef788f398 rhi: metal: Query supported sample counts from the device
Check if 2, 4, 8 are actually supported.

Pick-to: 6.2
Fixes: QTBUG-97146
Change-Id: I23c22c2bfeb072b9658f3b5dfba51dd6dc850de3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-10-08 11:07:15 +02:00
Mitch Curtis
3fbf1f13ae Doc: clarify case sensitivity in QCompleter
This was confusing for me, being unfamiliar with the API.

Pick-to: 6.2 5.15
Change-Id: I831c6d0aa30847e069a7c21c279f147a1b24e486
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-08 08:00:39 +02:00
Thiago Macieira
1bac82fa99 QtTest: fix build with MinGW/GCC 9: no std::mutex support
Unfortunately we can't depend on the C++11, 14 or 17 Standard
Library, which is not properly and completely implemented
everywhere. All Library features above C++98 must be checked with
their corresponding __cpp_lib macro before use. This does not
apply to the C++17 Core Language.

qwaitcondition_p.h:144:20: error: 'mutex' in namespace 'std' does not name a type
  144 | using mutex = std::mutex;
      |                    ^~~~~
qwaitcondition_p.h:59:1: note: 'std::mutex' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
   58 | #include <condition_variable>
  +++ |+#include <mutex>
   59 | #include <mutex>
qwaitcondition_p.h:145:33: error: 'condition_variable' in namespace 'std' does not name a type
  145 | using condition_variable = std::condition_variable;
      |                                 ^~~~~~~~~~~~~~~~~~
qwaitcondition_p.h:59:1: note: 'std::condition_variable' is defined in header '<condition_variable>'; did you forget to '#include <condition_variable>'?
   58 | #include <condition_variable>
  +++ |+#include <condition_variable>
   59 | #include <mutex>

Pick-to: 6.2
Change-Id: I2bbf422288924c198645fffd16a9249e5330136a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-08 00:09:33 +00:00
Volker Hilsheimer
e0b6b27d39 Add style hint for preventing spin box selection on up/down
On a mobile device, selecting text in a line edit brings up the text
action popup for select/copy/cut. In a spinbox where the user changes the
value using the buttons, this can be very irritating, without providing
any usability - the user is unlikely to start typing, at least not
without first transferring focus into the lineedit first to bring up the
keyboard.

This style hint allows styles to override the default behavior of
QAbstractSpinBox. Implement the customization for the Android style, and
add a test case for QSpinBox.

[ChangeLog][QtWidgets][QStyle] A new style hint, SH_SpinBox_SelectOnStep,
specifies whether pressing the up/down buttons or keys in a spinbox will
automatically select the text.

Fixes: QTBUG-93366
Change-Id: If06365a7c62087a2213145e13119f56544ac33b5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-10-08 00:45:18 +02:00
Mårten Nordheim
e4a09b0194 QNI: Update the manual test 'transportMedium' naming
I staged the manual test a little too soon, forgetting it's not compiled
in CI

Change-Id: Iaae8b8caaf8433c45e66ff662bb9bb7b25a3b8bd
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-10-07 19:08:51 +02:00
Mårten Nordheim
1834fcad33 QNI: NetworkListManager: Extract the Events class
Moving the class out makes it easier to navigate the code

Change-Id: I8de67641512a7dbbf6446cdca9d8dea79a63c217
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-10-07 19:08:47 +02:00
Mårten Nordheim
5d941c7660 QNI:NetworkManager: Update dbus interface usage
We were using the non-standard interface for PropertiesChanged, and
support for this was dropped in a Network Manager update earlier this
year[0].

Switch to using the standard interface.

[0] https://networkmanager.dev/blog/networkmanager-1-32/

Pick-to: 6.2
Change-Id: Ibdf2b635ae13a3150c4d2faa028c15c70c8af5ca
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2021-10-07 19:08:39 +02:00
Mårten Nordheim
5d2fa94297 QNetworkInformation: support transportMedium with NetworkManager
Task-number: QTBUG-91023
Change-Id: Ie50e29ec321768ec6d0358d96a8c36b9b7cb10ba
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-10-07 19:08:35 +02:00
Mårten Nordheim
5b8a4c2063 QNI:Android: unify behavior of callbacks
The first callback added for the android backend does not have the value
as a parameter which is something the other callbacks have. Change it so
it does.

And promote the lambda to a real function.

Change-Id: I06f10f7c79f33a5ea3154f2fc6d20d550cd7eca7
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-10-07 19:08:30 +02:00
Mårten Nordheim
589389843c QNetworkInformation: add support for transportMedium on Android
It's part of the capabilities which we are already using. It also lets
us work around a pre-existing edge-case where, if you have a VPN enabled
and enable Airplane mode it will continue to tell you it is Online even
when it is not. This happens because VPN is reported as a transport and
when Airplane mode is enabled it may be left enabled as the _only_
transport.

At the same time clear the default filters (if any), and filter out
suspended connections. May not necessarily make any difference.

And add a comment for why we cannot use a technically more suitable
type of callback.

Task-number: QTBUG-91023
Change-Id: Ic26c4d4e8da139ec8606a0b1bf5fb7157bd0beaf
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-10-07 19:08:26 +02:00
Mårten Nordheim
7fb855e175 QNetworkInfo: Add transport medium detection API
The new public API returns and notifies changes to the currently active
transport medium for the application. And there's a new private API to
report it, with backends to follow.

Task-number: QTBUG-91023
Change-Id: I527985f9dabcd7bc4a32f36597e21bc4ab664c4e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-10-07 19:08:23 +02:00
Fabian Kosmale
d9f6fba385 Fix compilation with -trace
Fixes: QTBUG-97241
Pick-to: 6.2
Change-Id: I877c6f0792ad2281ccfc73b7549dad7d6bd68995
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-07 17:42:38 +02:00
Doris Verria
911c97f2b5 QCocoaWindow: Make window key if the app's modal window is hidden
On macOS, when showing a window, we decide if it should be made
key and therefore active, if the app has no active modal session
or if the window's worksWhenModal returns true.

However, the window needs to be made key also when a modal window
is present, but not visible. Add this condition when checking if
the window needs to be made key.

This makes the behavior consistent with what happens when a modal
is minimized on macOS. The input focus is passed to the next window,
and the window appears active, even if it can not be interacted with.

Fixes: QTBUG-85574
Pick-to: 5.15 6.2
Change-Id: I204d4f912128f4a46840789fc2ee08e1b2716bfc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-07 14:30:53 +00:00
Edward Welbourne
c1281c306c Fix handling of grouping characters when validating doubles
In QDoubleSpinBoxPrivate::validateAndInterpret() some code still
assumed checking one entry in a QString is enough (it isn't - the
grouping separator may be a surrogate pair) and nothing considered the
case of an empty grouping separator (as can arise if the user sets
that in their system configuration, as a brute-force way to suppress
digit-grouping). Failure to consider this case failed an assertion on
dereferencing the first character of the separator.

Handle the case of empty separator and suppress tests that try to
match a separator, when there is no separator.

Pick-to: 6.2
Fixes: QTBUG-96734
Change-Id: I63d3205ef8656a2cd2c0d855a25e712ad66e2429
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-07 14:22:56 +02:00
Edward Welbourne
f644a12212 Add a basic round-trip test for QStringConverter
For now it only has a trivial test (empty) and an all-surrogate test
(Chakma digits) - but at least now all conversions to and from UTF-16
are tested. In particular, there were previously no UTF-32 tests.

Pick-to: 6.2
Change-Id: I9317928a88b9990530126db80e4756b880a364df
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-07 14:22:56 +02:00
Morten Johan Sørvig
7b46ba165e Add message debug entry for DPI change events
WM_GETDPISCALEDSIZE and WM_DPICHANGED.

Pick-to: 6.2
Change-Id: I0614b0f552e52fc77d026dbc7e8c13b05f7d0e9e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-10-07 14:22:56 +02:00
Morten Johan Sørvig
81707951fe Fix programatic geometry change to different DPI
The event flow for programatic window geometry change
(e.g. from MoveWindow()) differs from user-interactive
geometry change: We still get WM_DPICHANGED, but this
event is not preceded by WM_GETDPISCALEDSIZE, so we don’t
get to override the window size.

However, Qt has already scaled the window size for the
new DPI in this case (the scaled size is provided to
QWindowsWindow::setGeometry()), so we can omit making
second native set-geometry call.

Pick-to: 6.2
Change-Id: Ia7d42d7fee49adf757e7fe75d77f1731405ad519
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-10-07 14:22:55 +02:00
Morten Johan Sørvig
2cfca7fd19 Handle WM_GETDPISCALEDSIZE
By handling WM_GETDPISCALEDSIZE we can keep QWindow’s
device independent size constant across DPI changes.
This is done by scaling QPlatformWindow’s native size
such that the change of scale factor and change of
QPlatformWindow size cancels out.

Qt now handles DPI change using two events:

WM_GETDPISCALEDSIZE: Compute the new size for the window.
WM_DPICHANGED: Apply the new DPI and window geometry.

The reason for this complication is that Windows retains
control over the window position during the DPI change,
in order to e.g. accurately track the cursor position
during a screen change.

The default WM_GETDPISCALEDSIZE implementation (provided
by Windows) scales the win32 window size linearly with
the DPI change. We want to use linear scaling as well,
however the win32 window size includes the margins, which
do not change linearly as the DPI changes.

Instead, scale the QPlatformWindow size, and then add
the new margins.

Pick-to: 6.2
Change-Id: I4f225be8fad56b1fa77e9e3cfd6538a206589d73
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-10-07 14:22:55 +02:00
Morten Johan Sørvig
cd96d87011 Move VM_DPICHANGE handling to QWindowsWindow
We want to have as little code in the QWindowsContext
event switch as possible.

Pick-to: 6.2
Change-Id: I04d578aae81c4ee804310a70bd87ee60b2890b6a
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-10-07 14:22:55 +02:00
Kai Köhne
3936648c60 Doc: Remove mentioning of CMake 3.9 minimum version
Change-Id: Ia63bc7f305e673588ec57a7405ed5c0fdf3f5074
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-10-07 14:22:55 +02:00
Volker Hilsheimer
51300566ff Fix closing and showing a window with a native child
Closing a window with a native child results in the native child's
QWidgetWindow being closed. That explicitly calls setVisible(false)
on the child, which will still have the ExplicitShowHide attribute
set from the initial (explicit) show. Even though we then reset
the ExplicitShowHide, the WState_Hidden attribute will still be
set, so Qt considers the window to have been hidden, and not show
it again when the parent becomes visible.

Add a test case.

Fixes: QTBUG-96286
Fixes: QTBUG-79012
Fixes: QTBUG-71519
Change-Id: I482e6d5236c959d82ce66798176b259a3176972c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2021-10-07 12:54:10 +02:00
Ulf Hermann
5d17487723 Return a plain QMetaObject* from toDynamicMetaObject()
The only place where we use it, we swiftly cast it to QMetaObject*
anyway. Generating an object with virtual methods, only to then cast to
its non-virtual base type is dangerous. Also, if we are required to
return a QAbstractDynamicMetaObject from a method of
QDynamicMetaObjectData, we cannot implement QDynamicMetaObjectData
without also implementing QAbstractDynamicMetaObject. This indirectly
forces us to copy metaobjects around as we cannot wrap an existing
metaobject into a QDynamicMetaObjectData subclass.

Copying metaobjects around makes QMetaObject::inherits() unusable
because inherits() assumes identity is determined by identity of the
pointer.

Change-Id: Icbe697efa6fd66649eef3c91260c95cda62e3c90
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-10-07 12:54:10 +02:00
Volker Hilsheimer
1453f048f5 Clean up tst_qwidget
Remove dead code
Make logic to position test widgets more consistent across test functions
Consistent cursor positioning logic
Get rid of unnecessary event processing
Reduce calls to qWait with hard coded values
Use qWaitFor to establish asynchronous preconditions
Ignore expected warning messages
Expect-fail (instead of blacklist or skip) some tests that always fail
Ignore unpredictable events in childEvents test
Split large "render" test in multiple test functions

Task-number: QTBUG-52974
Task-number: QTBUG-26424
Change-Id: I206e114c2c1d9801e08600d3341c2738dc881f17
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2021-10-07 12:54:10 +02:00
Volker Hilsheimer
638e0c3144 Silence static analyzer warning
The static analyzer can't see that the QPointer not being null implies
that the QWidget pointer is still valid. Since we reset the widget
pointer to nullptr earlier on if the QPointer is null, just test for the
widget pointer instead.

Amends f6befd3e63 and fixes report
020fbdde70065e8de370537304d13d21.

Change-Id: I715764956a02b1300766a3cea2d427f840f1cec8
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-10-07 10:54:10 +00:00
Eskil Abrahamsen Blomfeldt
4d47b18c81 Revert "Support family names that end/start with space"
This reverts commit 7fd9ed3201.

While trimming the font name worked for cases with application fonts,
it actually introduced an assert for system fonts that ended with a
space, because enumerating these failed. So the original assumption
that all Windows APIs also trimmed the family name was wrong.

The original bug was that the font with the trailing space could
not be selected, but when using setFamilies(), it can. So there is
a perfectly fine way around the original bug when using a font that
has this problem. Therefore, no additional fix is needed for that.

[ChangeLog][Windows] Fixed an assert that happened when the system
had a font with a trailing or leading space in its name.

Pick-to: 5.15 6.1 6.2
Fixes: QTBUG-93885
Task-number: QTBUG-79140
Change-Id: I6d9df31a4f2c6555d38d51da374f69b6fb0f1ecb
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-07 12:35:04 +02:00
Ulf Hermann
7ecb3d3f1a QPlatformFontDatabase: Don't copy metaobjects
This is expensive and unnecessary here.

Change-Id: I542c0309db5839c696f51b066cd5423a63468438
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-10-07 11:25:24 +02:00
Joerg Bornemann
6f1eb0b2bc Don't build tests/auto/tools when cross-compiling
There already was an attempt, but the wrong variable name was used.

Pick-to: 6.2
Change-Id: I4bdd73f86ff6aa5151e4427024b83daa57b54a39
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Craig Scott <craig.scott@qt.io>
2021-10-07 08:03:40 +02:00
Volker Hilsheimer
af31b6cf05 Silence compiler warning from int/size_t mismatch
Amends 4757b93b0e.

Change-Id: I678785cd61dbdecb3b1e7e68c7daf9f18cad4d02
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-07 00:49:17 +02:00
Ilya Fedin
62a81bddfa Always fallback opening URLs to the regular way if portal fails
Even if the code fails, the runtime will have a xdg-open binary
that supports the required API (portals in flatpak and userd launcher
in snap)

Task-number: QTBUG-83939
Change-Id: I8527cfe20411c535686b7171ff9ef285ab9e10aa
Reviewed-by: Jan Grulich <jgrulich@redhat.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-07 01:54:36 +04:00
Thiago Macieira
46fc01d7ca QElfParser: rewrite using elf.h
This rewrite uses the actual structures supplied by the system's C
library, so it should be easier to read. It removes hardcoded constants
with little evident meaning in favor of sizeof() and the macros from
that header. It also removes advancing the data pointer in favor of
having absolute offsets.

The resulting implementation is stricter than the original, checking
more fields in the header. Because the QPluginLoader and QFactoryLoader
users may make decisions based on availability of plugins before
attempting to load them, it's better to be stricter here than to fail
later when trying to dlopen() them.

Debugging and testing are much improved. Instead of stored artifacts, I
added a routine to modify a valid plugin to make it invalid, given the
conditions we've found so far.

If you turn debugging on for this category, you'll see things like:

 not-elf.fcqdMq.so : Not an ELF file (invalid signature)
 wrong-word-size.QrnSAx.so : ELF 32-bit LSB (GNU/Linux), version 1, shared library or PIC executable, x86-64
 invalid-word-size.bOkXvp.so : Invalid ELF file (class 0), LSB (GNU/Linux)
 unknown-word-size.ogYKeF.so : Invalid ELF file (class 66), LSB (GNU/Linux)
 wrong-endian.owiElX.so : ELF 64-bit MSB (GNU/Linux), version 1, shared library or PIC executable, x86-64
 invalid-endian.FRxClR.so : ELF 64-bit invalid endianness (0) (GNU/Linux)
 unknown-endian.FfvRrP.so : ELF 64-bit invalid endianness (65) (GNU/Linux)
 elf-version-0.gPTdpQ.so : ELF 64-bit LSB (GNU/Linux), file version 0
 elf-version-2.jlIUUg.so : ELF 64-bit LSB (GNU/Linux), file version 2
 executable.LlXiFp.so : ELF 64-bit LSB (GNU/Linux), version 1, executable, x86-64
 relocatable.UsOYuy.so : ELF 64-bit LSB (GNU/Linux), version 1, relocatable, x86-64
 core-file.hqvNRz.so : ELF 64-bit LSB (GNU/Linux), version 1, core dump, x86-64
 invalid-type.CIJgfS.so : ELF 64-bit LSB (GNU/Linux), version 1, unknown type 259, x86-64
 wrong-arch.UcNmgz.so : ELF 64-bit LSB (GNU/Linux), version 1, shared library or PIC executable, AArch64
 file-version-0.lZYuda.so : ELF 64-bit LSB (GNU/Linux), version 0, shared library or PIC executable, x86-64
 file-version-2.ucfdwL.so : ELF 64-bit LSB (GNU/Linux), version 2, shared library or PIC executable, x86-64
 no-sections.rSjsHh.so : ELF 64-bit LSB (GNU/Linux), version 1, shared library or PIC executable, x86-64
 no-sections.rSjsHh.so : contains 0 sections of 64 bytes at offset 0 ; section header string table (shstrtab) is entry 0
 no-sections.rSjsHh.so : no section table present, not able to find Qt metadata
 qtmetadata-executable.vrxcIf.so : ELF 64-bit LSB (GNU/Linux), version 1, shared library or PIC executable, x86-64
 qtmetadata-executable.vrxcIf.so : contains 42 sections of 64 bytes at offset 997256 ; section header string table (shstrtab) is entry 41
 qtmetadata-executable.vrxcIf.so : shstrtab section is located at offset 996831 size 423
 qtmetadata-executable.vrxcIf.so : section 0 name "" type NULL flags X offset 0x0 size 0x0
 qtmetadata-executable.vrxcIf.so : section 1 name ".note.gnu.property" type NOTE flags AX offset 0x2a8 size 0x30
 qtmetadata-executable.vrxcIf.so : section 2 name ".note.gnu.build-id" type NOTE flags AX offset 0x2d8 size 0x24
 qtmetadata-executable.vrxcIf.so : section 3 name ".hash" type HASH flags AX offset 0x300 size 0x44c
 qtmetadata-executable.vrxcIf.so : section 4 name ".gnu.hash" type 0x6ffffff6 flags AX offset 0x750 size 0x3b8
 qtmetadata-executable.vrxcIf.so : section 5 name ".dynsym" type DYNSYM flags AX offset 0xb08 size 0xd50
 qtmetadata-executable.vrxcIf.so : section 6 name ".dynstr" type STRTAB flags AX offset 0x1858 size 0x15d8
 qtmetadata-executable.vrxcIf.so : section 7 name ".gnu.version" type 0x6fffffff flags AX offset 0x2e30 size 0x11c
 qtmetadata-executable.vrxcIf.so : section 8 name ".gnu.version_r" type 0x6ffffffe flags AX offset 0x2f50 size 0xb0
 qtmetadata-executable.vrxcIf.so : section 9 name ".rela.dyn" type RELA flags AX offset 0x3000 size 0x480
 qtmetadata-executable.vrxcIf.so : section 10 name ".rela.plt" type RELA flags AX offset 0x3480 size 0x7e0
 qtmetadata-executable.vrxcIf.so : section 11 name ".init" type PROGBITS flags AX offset 0x4000 size 0x1b
 qtmetadata-executable.vrxcIf.so : section 12 name ".plt" type PROGBITS flags AX offset 0x4020 size 0x550
 qtmetadata-executable.vrxcIf.so : section 13 name ".plt.got" type PROGBITS flags AX offset 0x4570 size 0x8
 qtmetadata-executable.vrxcIf.so : section 14 name ".text" type PROGBITS flags AX offset 0x4580 size 0x110e
 qtmetadata-executable.vrxcIf.so : section 15 name ".fini" type PROGBITS flags AX offset 0x5690 size 0xd
 qtmetadata-executable.vrxcIf.so : section 16 name ".rodata" type PROGBITS flags AX offset 0x6000 size 0x473
 qtmetadata-executable.vrxcIf.so : section 17 name ".qtversion" type PROGBITS flags AX offset 0x6478 size 0x10
 qtmetadata-executable.vrxcIf.so : section 18 name ".qtmetadata" type PROGBITS flags AX offset 0x64a0 size 0x19b
 qtmetadata-executable.vrxcIf.so : found .qtmetadata section
 qtmetadata-writable.stzwrk.so : ELF 64-bit LSB (GNU/Linux), version 1, shared library or PIC executable, x86-64

Change-Id: I42eb903a916645db9900fffd16a4437af9728eea
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-10-06 12:12:53 -07:00
Timur Pocheptsov
3abcff49eb QTlsBackend (OpenSSL) : detect incompatible versions
OpenSSL v3 among other nice things brought some nasty crashes
(essentially, finally breaking what was already not so nice
in 1.x: see, e.g. ASN1_ITEM_free and ASN1_ITEM_ptr that we
have to use to free resources allocated by openssl). Let's,
at least, not use v3 from Qt built with 1.1.1 and vice
versa.

Pick-to: 6.2 5.15
Change-Id: If14a2a0ce2189a1b7967b7ab7248d11d0f2fc423
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-06 21:12:53 +02:00
Volker Hilsheimer
e7cd245628 Silence compiler warning
clang warns that: local variable 'big' will be copied despite being
returned by name [-Wreturn-std-move]

So force the intended move using std::move.

Change-Id: If5ff557c1b577789e6659783d8106295fafb3485
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-10-06 15:05:20 +02:00
Kai Köhne
0fe44fb8b9 Document that schannel is on by default
Since d385158d52 , schannel is built by default on Windows.

Pick-to: 6.2
Change-Id: I46cd437c9cbfae9ba74d1aebb5f1e8db3383ec2a
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-10-06 15:05:20 +02:00
Assam Boudjelthia
b02d88e416 Android: Update and add missing gradle files for jar folders
Update the build.gradle for main Qt jar code, and add same files for
network and network information backend, so the code can be managed
from Android Studio.

This also adds .gitignore to ignore Android Studio build artefacts.

Pick-to: 6.2
Change-Id: Ic06e9d12708070fad112f17e58b8754608d184f3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-06 16:05:19 +03:00
Assam Boudjelthia
3dbca82f86 Android: use gradle repo mavenCentral() instead of jcenter()
jcenter() is deprecated and will be shutdown by next year [1], thus
the replacement mavenCentral() could be used instead.

[1] https://blog.gradle.org/jcenter-shutdown

Pick-to: 6.2
Change-Id: Ic9d1c15d657f23712ee4c866d5c1a45706353429
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-06 16:05:18 +03:00
Allan Sandfeld Jensen
733923c81c Add a safer way to use QThreadPool::reserveThread
Add startOnReservedThread that specifically releases a reserved thread
and uses it atomically for a given task. This can make a positive
number of reserved threads work.

Change-Id: I4bd1dced24bb46fcb365f12cbc9c7905dc66cdf1
Reviewed-by: David Faure <david.faure@kdab.com>
2021-10-06 14:55:20 +02:00
Giuseppe D'Angelo
2c3617dfcb Always enable QRegularExpression's JIT when testing
Given on most CI configurations we run tests only on debug builds, this
means that effectively we don't test JIT paths (JIT is kept disabled in
debug builds). To keep it enabled in a test, we have a few options:

* export a developer-build-only variable from QtCore, to force JIT
usage, and set it in the test. This is still suboptimal as many
configurations aren't using developer builds in the first place;

* use the already existing QT_REGEXP_USE_JIT environment variable,
setting it from CMake/CTest. The problem here is that although add_test
does support it, we don't expose it through our wrapper functions;

* just set that env variable from within the test itself. I went for
this option.

Change-Id: I73abfb7fc0d76ec77e881f24c5daf5be304ab948
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-06 13:34:17 +02:00
Ilya Fedin
816c5de460 Add support for EGL_EXT_platform_xcb
This allows to create EGL context without involving Xlib.
This extension was created a year ago and is present in Mesa since 21.0

Change-Id: Id9bcbffe8c46cb00d9cc0a9a425c1706d1b52b28
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2021-10-06 15:34:17 +04:00
Alex Trotsenko
82b86960c0 QLocalSocket/Win: stop reading in close()
After calling close(), the socket can enter 'Closing' state, in which
we try to write buffered data before disconnecting. As the device is
already closed, we must disable any pipe reader activity and clear the
read buffer.

Change-Id: I8994df32bf324325d54dd36cbe1a1ee3f08022d1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-10-06 10:16:14 +03:00
Tor Arne Vestbø
b689d8dccd macOS: Disable PCRE JIT when running under Rosetta
Although the Apple docs claim that Rosetta can translate apps that
contain just-in-time (JIT) compilers, it seems to have problems with
the PCRE JIT.

https://developer.apple.com/documentation/apple-silicon/about-the-rosetta-translation-environment

To be on the safe side we disable the JIT explicitly when detecting that
we are running under Rosetta. It's already disabled when we're running
on macOS ARM natively (see 2f8df4d1a8).

Fixes: QTBUG-97085
Pick-to: 6.2
Change-Id: I0e133939f28087560d4bc8354b7e49013e94a9f9
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-10-05 20:28:41 +00:00
Wang Chuan
60caec953f macOS: Ensure cancelOperation is sent as regular key event
Since 9e1875483c the logic of sending
QKeyEvent was changed to only happen when we explicitly decided to not
treat input as complex text, or when a selector for a command was not
found. This missed the case where we handle cancelOperation by falling
back to sending a regular key event. We now set m_sendKeyEvent to true
to trigger this logic.

Fixes: QTBUG-97119
Pick-to: 6.2
Change-Id: Ibb72f4b068cce735db8d76e5e0a1882aae115207
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-10-05 20:28:41 +00:00
Ievgenii Meshcheriakov
906cb8d4ef Remove util/harfbuzz/update-harfbuzz
This is not the correct script to update harfbuzz. The correct one is
src/3rdparty/harfbuzz-ng/import_from_tarball.sh

Change-Id: Ic9ed43cae591cd6957effb10f557166c43498ad9
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2021-10-05 21:53:10 +02:00