Commit Graph

53339 Commits

Author SHA1 Message Date
Ievgenii Meshcheriakov
e0b87edd73 tst_qthread: Don't use QVERIFY in multiple threads in threadIdReuse()
Testlib is not thread safe. Store the status into variable and check
it in the main thread instead.

Pick-to: 6.2
Change-Id: I840c8a3dceb1115a1b81ffeaa0fab96f9d2f1ff0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-10-01 02:46:17 +02:00
Ievgenii Meshcheriakov
44a7412795 Remove checks for C++ standard versions C++17 and below
Qt requires a compiler that support C++17 thus __cplusplus
is always 201703L or higher. This patch removes checks
for __cplusplus value that always succeed.

Change-Id: I4b830683ecefab8f913d8b09604086d53209d2e3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-10-01 02:46:09 +02:00
Volker Hilsheimer
79f62380f0 QAbstractItemView: Fix IM input starting edit session
Item views can open an editor widget on the first key press, and need to
take special care not to break input methods. The initial key press
starts compositing by the system input method, which is then interrupted
by the focus transfer to the editor.

To solve this problem, the widget needs to keep focus while the initial
composition is ongoing, and only transfer focus to the editor once the
composition is either accepted or cancelled by the user. Add a state flag
that is set during this initial preedit phase.

During this initial composition, the item view will receive all input
method events, and needs to forward these to the open, but not yet focused
editor for the user to get the correct visual feedback during the preedit
phase. The item view also needs to report to input method queries on
behalf of the editor to make sure that the IM UI is correctly positioned
without covering the user input.

Implement a test that simulates the sequences through synthesized
QInputMethodEvents; we can't simulate the entire system input stack.

Fixes: QTBUG-54848
Change-Id: Ief3fe349f9d7542949032905c7f9ca2beb197611
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-10-01 01:48:50 +02:00
Karsten Heimrich
55ab987c9a Fix QDir::entryList to work for directories that end with '.lnk'
In addition to checking the .lnk extension, check that the
the specified path is not a path to a directory.

Pick-to: 6.2
Fixes: QTBUG-85058
Change-Id: I83cef3d94c6ffa82a88f374c5b41779e88fe40b8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-09-30 21:20:25 +02:00
Volker Hilsheimer
6ad88e7898 Add testcase for QWidgetRepaintManager
At the current state, Qt::WA_StaticContents is not respected on any
platform, and optimizations for opaque widgets is not implemented on
Cocoa.

Task-number: QTBUG-73117
Change-Id: I48b7b0c4436da5a609fdbe51bb1c9789a2a059bd
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-30 21:10:48 +02:00
Paul Olav Tvete
b869d9b768 Add manual test for window activation
This is a manual test of QWindow::requestActivate() and how it
interacts with implicit activation from the window system. Written in
order to test QtWayland, but hopefully also useful for testing on other
platforms.

Task-number: QTBUG-91542
Change-Id: Id18dc6d146d213a7c730cff343d9fc25f6c42514
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2021-09-30 20:51:52 +02:00
Volker Hilsheimer
b1b75326f4 macOS: fix window deactivation when a popup is open
On macOS, we get explicit notifications when a window becomes or resigns
the key, before we have had a chance to close open popups. The popup is
then closed later, but the delivery of the WindowDeactivate event has
already been aborted as QApplication interprets such notifications while
in popup mode as delayed focus events.

This leaves the focus widget still displaying focus even though its
window is no longer active. Trying to activate the window again then
does not correctly transfer focus.

To fix this, close all popup explicitly when a window resigns key.

Task-number: QTBUG-78750
Fixes: QTBUG-66513
Fixes: QTBUG-69710
Pick-to: 6.2
Change-Id: I590757c7d3532dbe4b5358a8e121ce8aa871a699
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-30 18:35:12 +02:00
Andreas Buhr
07cfab07a2 Specify Android architecture in gradle files
When building for armeabi-v7a, building and APK using
"ninja foo_make_apk" works. Building it by calling
"gradlew assembleDebug" works. Opening the "android-build" folder
in Android Studio and clicking the "Build" button works.
But clicking the "Run" or "Debug" button in Android Studio does not
work when the attached phone is arm64-v8a. Then Android Studio
automatically selects the v8 architecture which does not find the Qt
libraries. This patch adds explicit ABI selection to the gradle
configuration files. With explicit ABI selection, Android Studio does
not try to outsmart you.

Pick-to: 6.2
Fixes: QTBUG-96701
Task-number: QTBUG-87022
Change-Id: I4ad6356c38b7eca004c0e0dbbb357cab7de84c0f
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-09-30 17:27:16 +02:00
Topi Reinio
725b52141d CMake: Introduce QT_BUILD_ONLINE_DOCS flag for documentation builds
QDoc modifies its linking behavior depending on whether the -installdir
command line option was set or not; Without -installdir, QDoc will
use 'https://<url>' to link to targets loaded from external
documentation modules, instead of using relative paths.

Drop the -installdir if QT_BUILD_ONLINE_DOCS was set. This behavior matches
the 'build_online_docs' scope that was used for qmake documentation
targets, and is useful for documentation projects that are not part of
Qt but want to link to Qt docs simply by loading the index files of Qt's
modules.

Pick-to: 6.2
Change-Id: Ib1bbf7b9d784e0c276d2bc520240af4a6c8ba903
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-09-30 15:38:07 +02:00
Morten Johan Sørvig
8d8448a1f5 wasm: limit exec() workarounds to the main thread
This fixes a bug where calling exec() on a secondary
thread would make the thread exit.

Task-number: QTBUG-94344
Pick-to: 6.2
Change-Id: I259c7ebbd53271609af88aca141d88c282cbcd34
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2021-09-30 11:58:34 +00:00
Oliver Wolff
8d6e825ddf windows qpa: Handle invisible child windows gracefully on dpi changes
Fixes: QTBUG-96466
Pick-to: 6.2
Change-Id: I58d90e85b4bb837df2dc5fd89abe984dadcd468d
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-09-30 13:58:34 +02:00
Andreas Buhr
95ef193715 Rename variable to not reference Qt5
In the Android gradle files, the variable qt5AndroidDir refers to Qt5
and might confuse users. This patch renames to qtAndroidDir.

Pick-to: 6.2
Change-Id: Ib18a3cd2c38646e4c6c0435dae9234f0f7887eb5
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-09-30 13:58:34 +02:00
Volker Hilsheimer
f6befd3e63 Clean up QApplication::notify code
Store isWidgetType and isWindowType once to avoid multiple tests, and
use a single QWidget* variable for widget receivers once we handle those
explicitly, rather than separate declarations for each event type.

Fix indentation to make it more obvious that the entire switch statement
is only executed for widget receivers.

Remove unreachable code for QGraphicsWidget key handling. At that point,
we already know that the receiver is a widget, which QGraphicsWidget is
not, so this code was never executed anyway.

Minor clean-ups, coding style improvements, and standardisations of
repeating patterns.

Change-Id: Idfe944f041ae82372b17082a5ffc4df13802359b
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-09-30 13:41:55 +02:00
Andreas Buhr
44c8ae5543 Add error messages in case system library directory does not exist
On Android, when the system library directory does not exist,
no error message was given. This led in turn to error messages like
Can't find 'nulllibQt6Core_armeabi-v7a.so'
which are not very helpful.

Pick-to: 6.2
Task-number: QTBUG-80766
Task-number: QTBUG-96701
Change-Id: I4187e4a68d9e78e198152306a3e664c30c51ab18
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-09-30 12:27:59 +02:00
Heikki Halmet
755f7c7ff2 Add support for Microsoft Visual Studio 2022 Preview version
When official version is available variableValue path need to be
changed.

Task-number: QTQAINFRA-4540
Change-Id: Ie5fe676962297aa5f18f225eb4b8dfe0957671c8
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2021-09-30 09:32:11 +00:00
Fabian Kosmale
4f897584ec QMetaType: Expand and clean up converter/view function documentation
This adds a few snippets to show how the functions can be used, and also
removes workarounds for oldver versions of qdoc that weren't clang based
- those workarounds also seem to have caused some bitrot.

Remove documentation for an overload of registerMutableView that
currently does not exist (for a member function with an ok parameter).

Fixes: QTBUG-96963
Pick-to: 6.2
Change-Id: Ibc867d08bcacbc7add8c965df9864d6f339a5d54
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-09-30 08:26:13 +02:00
Thiago Macieira
684c9b82b9 QDateTime: fix build with MinGW: need unistd.h very early
qobject.h has #include <chrono>, which #includes <ctime>, which includes
<time.h>.

datetime.cpp:2621:23: error: 'localtime_r' was not declared in this scope; did you mean 'localtime_s'?

Pick-to: 6.2
Change-Id: I2bbf422288924c198645fffd16a922719c4ce7d4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-09-29 13:18:21 -07:00
Eirik Aavitsland
6d41b64d45 Avoid generating large pdf files when using dashed cosmetic pens
There was a bug in the pdf writer for cosmetic pens when they were
drawn using native pdf strokes (QTBUG-68537). The workaround that was
done for that bug was to disable native atroking for such pens, so
they would always be emulated. The drawback of that was that painting
with dashed cosmetic pens would then produce unexpectedly large pdf
files, since it would contain individual strokes for every dash.

This change fixes the original bug and removes the workaround,
re-enabling native stroking for cosmetic lines.

Pick-to: 6.2 5.15
Fixes: QTBUG-86094
Change-Id: I58d06ad2db81206025ca2de394f072e822c03d47
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
2021-09-29 22:07:43 +02:00
Eirik Aavitsland
2cb42cd849 PDF generation: disentangle native pen from transforms
In the PDF engine, transforms are implented with a global pdf
transform if and only if the current pen is "simple", that is,
renderable by a native pdf pen. For non-simple pens, the painted
objects are transformed by QTransform instead. Hence, the internal
simplePen flag was used to indicate both a pen state and a transform
state.

This commit splits these two states into separate flags. No behavior
is changed, but it prepares for an improved implementation of cosmetic
pen rendering.

Pick-to: 6.2 5.15
Task-number: QTBUG-86094
Change-Id: If02e1dfc021778e3db7c9ff9a1ed35b3d6cbf3f8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
2021-09-29 22:07:43 +02:00
Mårten Nordheim
ce988284c4 Add transport info to the QNetworkInformation manual test
Task-number: QTBUG-91023
Change-Id: I0015bc18b0f5c7faf5826a46ee880add09a7b244
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-09-29 20:42:35 +02:00
Mårten Nordheim
11d2524bc4 Refactor QNetworkInformation manual test
To make it a little cleaner

Task-number: QTBUG-91023
Change-Id: Ib99cc722b47835d13707beeeea35573729e4b032
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-09-29 20:42:35 +02:00
Giuseppe D'Angelo
0dc6cc0551 MSVC: enforce that we are under /permissive-
MSVC defaults to a C++ dialect which is not standard-compliant. For
a number of years, it has offered a switch (/permissive-) to enable
standards conformance, but it was entirely opt-in. While we do build
(and test) Qt under /permissive-, our users do not necessarily do
that for their own software.

Meaning, we risk subtle bugs and build issues for the code present
in our headers (because users may use them in non-/permissive- mode).
This has already happened multiple times (QTBUG-95880, as well as
19b5520abf).

So far, we couldn't *enforce* /permissive- for client code, as MSVC
didn't deem it stable, and various SDKs (like Windows') were not even
building under it.

This has now changed. /permissive- is now deemed fully stable and
supported, and turned on by default when using /std:c++20 (since VS 2019
16.11 [1]). So, starting from 6.3, we can now pretend its presence.

Unfortunately /permissive- does not set any special macros for us to
test [2], so test one of its side-effects: that an implicit conversion
from std::nullptr_t to bool is ill-formed (the conversion is explicit).

[1] https://devblogs.microsoft.com/cppblog/msvc-cpp20-and-the-std-cpp20-switch/
[2] https://developercommunity.visualstudio.com/t/Pre-define-a-macro-when-compiling-under/1253982?space=62&q=permissive-+sfinae&entry=myfeedback

[ChangeLog][Platform Specific Changes][Windows] When using MSVC
Qt now requires standards compliance mode. This requires passing
the /permissive- command line switch. Note that when using C++20 or
above, the /permissive- switch is implied by default.

Change-Id: I464ed36ff707fa3ada52c543433a6b0ab715748e
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-09-29 18:01:29 +00:00
Andreas Buhr
00a5d9f849 Fix building of unit tests for Android in developer build
Currently it is not possible to build unit tests for
Android in a developer build.
This patch fixes this.

Fixes: QTBUG-94882
Change-Id: I30ccacc4536032ee3a7fbf05ce90bbbcdb8331a6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-09-29 17:50:49 +02:00
Dan Ackers
a0e605e458 Remove hack fix from vulkan qnx building
Pick-to: 6.2
Task-number: QTQAINFRA-4502
Change-Id: I3ca6cb79f60e18f64323d30e44ea1660efdc54bb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-09-29 14:59:25 +00:00
Ilya Fedin
4e71603412 Implement preview support for GTK file dialog
This adds preview support in GTK file dialog implementation,
this is helpful for a lot of applications
like image viewers, messengers and etc.

[ChangeLog][Platform Specific Changes][Linux] A native GTK
file dialog (created via QFileDialog or QtQuick.Dialogs)
now shows an image preview pane.

Task-number: QTBUG-3796
Task-number: QTBUG-53167
Change-Id: Ib80108c09b84d774440a0445adcccab4b64652ef
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-09-29 11:17:03 +00:00
JiDe Zhang
71ba53e3a7 Fix memory leak
Destroy the QDBusPendingCallWatcher object when received
the QDBusPendingCallWatcher::finished signal later.

Pick-to: 5.15 6.2
Change-Id: I1ec67bf7c286f38200c374ad92df2a1579588a8a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-09-29 01:33:01 +00:00
Ievgenii Meshcheriakov
52ad59f9ea QThread: Reset the system thread ID when thread exits on Unix
Unix QThread implementation stores pthread_t as a system thread ID
when the thread is created, but never resets the system ID when
those threads are destroyed. Some implementations may reuse the
same thread IDs for new threads, and this may cause QThread::wait()
to erroneously complain that "Thread tried to wait on itself".

This patch sets the system thread ID to nullptr when the thread is
about to exit and be destroyed by the system.

A regression test is added to tst_qthread.

Fixes: QTBUG-96846
Pick-to: 5.15 6.2
Change-Id: I0850425dd0e09af50e59c9038e7e662a2a624beb
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-09-29 01:53:49 +02:00
Joerg Bornemann
acde9784ca CMake: Only write device prefix to target_qt.conf if necessary
The device prefix in target_qt.conf is necessary if and only if the
prefix on the host is different from the prefix on the device - in CMake
terms: if CMAKE_STAGING_PREFIX is different from CMAKE_INSTALL_PREFIX.

This removes the [Devices] section from target_qt.conf from our iOS and
Android packages, because we don't set CMAKE_STAGING_PREFIX for those
platforms.

Pick-to: 6.2
Fixes: QTBUG-96906
Change-Id: I1390e952e544e57d5dd3bc09d688a612db9b4247
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-09-28 22:18:13 +02:00
Laszlo Agocs
fea1d57c2b rhi: gl: Do not issue memory barriers when we do not have to
First, issue glMemoryBarrier() only if the read-after-write or
write-after-write occurs for a write involving incoherent memory
access.  In practice this means a QRhiTexture with UsedWithLoadStore
or a QRhiBuffer used as an SSBO. Doing the barrier call for other
types of texture or buffers is pointless, and potentially
wasteful. What is more, some OpenGL implementations feature bugs that
manifest themselves when glMemoryBarrier() is called, see associated
Jira issue for details.

Second, reduce GL_ALL_BARRIER_BITS to the ones relevant for the type
of the resource, in an attempt to provide a minor optimization. Real
fine-grained resource usage tracking is not implemented for OpenGL so
this still means specifying all buffer-related or all texture-related
barriers together, but this is still better than all. As the usage of
compute is quite close to zero in Qt at the moment, this won't make
much of a difference in practice.

Fixes: QTBUG-96322
Pick-to: 6.2
Change-Id: Ibf794e2e8a4cbc3c69acaa88476e85de6646b605
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-09-28 17:58:56 +02:00
Samuel Thibault
6802065da8 Accessibility Linux: Fix caps lock state
Currently in QSpiApplicationAdaptor::eventFilter, the
ATSPI_MODIFIER_SHIFTLOCK flag (actually capslock modifier) only set
when the capslock key is kept pressed, not when the capslock modifier
is enabled.

Orca however really needs to know the capslock modifier state, to be
able to properly determine whether to enable/disable capslock when the
user presses double-capslock.

Task-number: QTBUG-84225
Pick-to: 6.2 5.15 5.12
Change-Id: I98ab8b7261c5560ebad49410b1358b2279080ec8
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2021-09-28 15:58:56 +00:00
Volker Hilsheimer
223066d431 Don't clear focus if setParent doesn't change the parent
QWidget::setParent might be called to change the window flags, without
changing the parent. For those cases, we don't have to clear the focus.

Decouple the newParent state from the wasCreated flag. In most places
where newParent was tested, wasCreated was either tested previously and
can't be false anyway, or the code executed is irrelevant for widgets
that are not yet created (there can't be a paint manager). In the
remaining case, test wasCreated explicitly to maintain existing logic.

Add test for the cases where the previous code broke the focus, both
for QWidget and QDialog.

Fixes: QTBUG-93005
Pick-to: 6.2
Change-Id: I39dc179c2d348054de3927aa8b69eecef4935511
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Doris Verria <doris.verria@qt.io>
2021-09-28 17:42:57 +02:00
Eirik Aavitsland
5e2725772a Add testing of QPdfWriter output to QPainter lancelot test
Utilizes the native pdf renderer of macOS, so the test is only enabled
on that platform. As the PDF generation should be platform independent
anyway, this should not matter.

Pick-to: 6.2 5.15
Change-Id: I8b6b70562d1f24fdb77795aa7eb5843279aaae85
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-09-28 17:06:57 +02:00
Eirik Aavitsland
fbd3b00e0b Update the COPYRIGHT.txt file
With the contents from src/jversion.h

Pick-to: 6.2 5.15 5.12
Change-Id: I3d4d2b40b3ed6576655b97b1709ee42c9c81ebe7
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-09-28 17:06:57 +02:00
Joerg Bornemann
5ef0e3435e Fix separate_debug_info configure test for cross-compilation
The separate_debug_info configure test uses the CMake variable
CMAKE_OBJCOPY.  CMakeFindBinUtils in the test project finds the host's
objcopy despite CMAKE_TOOLCHAIN_FILE being correctly set.

We now add CMAKE_OBJCOPY to the list of variables that are passed to
configure test projects and remove the CMakeFindBinUtils include, which
looks rather internal anyways.

Pick-to: 6.2
Fixes: QTBUG-96798
Change-Id: I164c6bd1771e8789e9dd19b50573b33b8866bd3b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-09-28 15:59:31 +02:00
Eirik Aavitsland
66a44f4eba Preserve QImage metadata when converting format with color table
Unlike the other conversion functions, convertWithPalette() did not
call copyMetadata().

Fixes: QTBUG-96926
Pick-to: 6.2 5.15
Change-Id: I2b171cec16bc5a90d33e80d6fe178c650ed3fe36
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-09-28 15:59:31 +02:00
Gong Weia
a2ab67c8b2 qwindowswindow: fix return nullptr
fix return nullptr rather than 0

Change-Id: Ic8e04e5b8bc732a7ffba5a708caee4326abf7168
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2021-09-28 21:51:26 +08:00
Ievgenii Meshcheriakov
05870db7d0 QThread: Remove superfluous initialization of threadId on Unix
The thread ID is already initialized inside QThread::start() while
the thread lock is taken. This is completed before the attempted
initialization in QThreadPrivate::start() because it tries to take
the same lock.

Task-number: QTBUG-96846
Pick-to: 5.15 6.2
Change-Id: Ic9588f3e2e2f3c2180afbed8ec01155b33043eb3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-09-28 13:42:16 +02:00
Eskil Abrahamsen Blomfeldt
416fbfa5a0 Use Yu Gothic UI as the main fallback font for Japanese
Using MS Gothic UI as the fallback on Japanese locale has been
outdated for many years. The default font on Japanese is Yu Gothic UI,
and this caused mismatches between Japanese text when using the
fallback and when just relying on the default.

[ChangeLog][Text] Made the primary fallback font on Japanese
locale "Yu Gothic UI" (the default system font).

Fixes: QTBUG-96689
Pick-to: 6.2
Change-Id: I9cf34410619ff4a2ceb9b03d523018c5061c3634
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-09-28 06:19:54 +00:00
Alexandru Croitor
9665929706 pro2cmake: Generate public CMake API code for projects by default
Previously pro2cmake assumed that all .pro were internal Qt projects
like qtbase/src/corelib.pro and generated private api calls like
qt_internal_add_module().

Public CMake API calls (like qt_add_executable) were only generated if
an --is-example command line flag was passed to the script or if the
.pro file was located under the examples subfolder of a qt repo source
directory (indicated by the presence of a .qmake.conf file).

Change the logic to always generate public CMake API code by default,
unless a .cmake.conf/.qmake.conf file is encountered with a valid repo
module version inside, in which case apply the old heuristic of
checking for the ./examples subfolder.

The intention is to have a sensible default so that Qt users can use
the script to more easily migrate their qmake projects without having
to explicitly specify the --is-example flag.

Pick-to: 6.2
Task-number: QTBUG-96799
Change-Id: I38f4f1b349a5b9688cf7bc5914d4fde72e660a98
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-09-27 21:36:36 +02:00
Alexandru Croitor
124f7c681f pro2cmake: Augment searching of .qmake.conf with .cmake.conf
Adapt to fb656c036d which removes
.qmake.conf files in repos by searching for either .qmake.conf or
.cmake.conf.

The locations of those files are only used to compute relative paths
based on the directory where the conf file is.

For now, remove the warning if a conf file is not found, because we
intend to change the script to generate user project code by default,
instead of Qt internal project code and the warning looks scary.

Pick-to: 6.2
Task-number: QTBUG-96799
Change-Id: I301e93d2ce5c05a52877eb6ed9eb9cee54fc5b15
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-09-27 21:36:33 +02:00
Volker Hilsheimer
e7bb3a8bd3 Fix crash if receiver destroys itself in closeEvent
We allow QWidget::closeEvent to "delete this", and verify that this works
in the tst_QWidget::testDeletionInEventHandlers test function. Sadly,
that test didn't reliably catch the issue introduced in
28b14b966f, where the receiver is accessed
after the delivery of QEvent::Close.

Handle the QWindow event delivery explicitly so that we don't need to
access the receiver after the event has been delivered.

There's nothing we can do to make the test fail more reliably in CI.
A QWindow deleting itself in closeEvent will still crash; perhaps we don't
want to allow that anyway.

Change-Id: I2b5c2d11ded71c4f22ae9862cdc459e1f93b3374
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-27 19:34:49 +02:00
Alexandru Croitor
2ed267c820 CMake: Show error in user projects if wasm toolchain file not found
Rather than fail with obscure can't find Qt packages errors when the
Webassembly CMake toolchain file can not be found, error out with a
clear error on how to ensure it is found.

Pick-to: 6.2
Task-number: QTBUG-96843
Change-Id: I0f34cdcde05efb25c93017f3fd365186335ed52c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-09-27 18:29:44 +02:00
Alexandru Croitor
5d840f0f7a CMake: Get toolchain file path from EMSDK env for Wasm user projects
Try to to chainload the emscripten CMake toolchain file from the
EMSDK env var if it is set, instead of requiring the user to explicitly
specify a path to the file via QT_CHAINLOAD_TOOLCHAIN_FILE.

The order in which the toolchain file is chainloaded becomes is as
follows:

1) The initial toolchain file path that was specified when configuring
   qtbase is set written as the initial value of
   __qt_chainload_toolchain_file in qt.toolchain.cmake
2) If EMSDK env var is set, it overrides the value from 1)
3) If QT_CHAINLOAD_TOOLCHAIN_FILE cache var is supplied it overrides
   the value from 2)

Whichever value ends up in __qt_chainload_toolchain_file is
checked too see if the file exists.
If it exists it gets included, if it doesn't, a warning is issued.

This checking logic is a bit crude and should be improved and unified
with the Android chainload checking, but the current change already
improves the behavior for users of Qt.

Pick-to: 6.2
Task-number: QTBUG-96843
Change-Id: I5da58a329f659086aaaee765c9399d0369021b22
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-09-27 18:29:44 +02:00
Alexandru Croitor
c7d9e05a2b CMake: Split and clean up WebAssembly auto-detection code
Split qt_auto_detect_wasm into multiple helper functions and place
them in a new QtPublicWasmToolchainHelpers.cmake file.

We want to use them to try and detect the CMake toolchain
file location from within the generated qt.toolchain.cmake
file whem configuring a user project.

Pick-to: 6.2
Task-number: QTBUG-96843
Change-Id: Id8c2350e6dbe3c994b435681353bdaee114249a7
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-09-27 18:29:44 +02:00
Joerg Bornemann
a0e56294c1 Skip unnecessary commands when cross-building tools
Introduce a new macro qt_internal_return_unless_building_tools which
simply calls return() if tools are not built.  This macro is supposed to
be called after qt_internal_add_tool().

Using this macro avoids having to special-case code for when
qt_internal_add_tool() creates imported targets in cross-builds.

Adjust pro2cmake accordingly.

Task-number: QTBUG-85084
Change-Id: I9e1c455c29535dd8c318efa890ebd739c42effc1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-09-27 16:34:23 +02:00
Edward Welbourne
326d94e94b Document QTestLog's enums
Task-number: QTBUG-96844
Change-Id: I9af60ef0cf3def699e58b3477b647f2e071afa40
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-09-27 12:21:44 +02:00
Edward Welbourne
ee57d6b62e Fix various minor documentation errors in QAbstractTestLogger
Change-Id: I30ad67479b578b00557671cfa25631be0b6e4fb9
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-09-27 12:21:19 +02:00
Edward Welbourne
87fedbbf70 Coding style: correct spacing in XML test logger
Put stars after spaces, not before; indent cases level with switch.

Change-Id: I1dc29d0729d5be449b8123e15510177d814d42da
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-27 12:20:58 +02:00
Thiago Macieira
f000d5672a QPlugin: reorganize findPatternUnloaded and remove two bool variables
The compiler ought to figure them out, but we can just help it.

Change-Id: I42eb903a916645db9900fffd16a4981ac966f982
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-09-24 20:16:36 -07:00
Thiago Macieira
57960ab075 Q{Elf,Mach}Parser: simplify the return codes
The multi-state return code was a legacy of how Arvid wrote the ELF
parser code back in the day, the fact that it scanned for two different
types of plugins in Qt 4 and that the metadata could exist in different
places.  None of that matters nowadays: who cares if the file is a
corrupt binary, not a valid binary, does not have the right
architecture, or has no suitable section? It's not a plugin, period.

The Qt 4 plugin mechanism was removed for Qt 5.0 in commit
7443895857 ("Remove support for Qt 4 style
plugins").

Change-Id: I42eb903a916645db9900fffd16a442d800399b98
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-09-24 20:16:05 -07:00