Commit Graph

39274 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
Volker Hilsheimer
a03a67fbfa macOS: Remove special cases in enter/leave event handling
The Cocoa QPA plugin no longer tracks popups, but dispatches enter/leave
events when popups show and hide. So the special handling in tests and
QWidgetWindow can go away now.

Change-Id: Ib6ef00689de231996e5e57ecdd8fd0d4c861d68b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-24 21:37:06 +02:00
Thiago Macieira
0be5bf3e64 QPlugin: don't use QFile::read() if map() fails on Unix
If we can't mmap(), then libdl won't be able to either.

Pick-to: 6.2
Change-Id: I42eb903a916645db9900fffd16a492a1ac25903f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-09-24 11:40:44 -07:00
Volker Hilsheimer
a5e5943d8a macOS: send enter/leave when a window opens/closes
Since macOS doesn't give us any event when a modal window opens,
we need to do so ourselves explicitly so that the current mouse
window gets a leave event when e.g. a popup opens, and an enter
event when the popup closes again. The case for modal dialogs is
partially handled by QGuiApplication already.

Note: We cannot rely on the transientParent of the opening/closing
window, as it's nullptr for QMenu windows even if the QMenu has
a widget parent.

Add a test for enter/leave events when a secondary window opens,
covering both the dialog and the popup case. For the dialog case,
we sometimes get two Enter events when the dailog closes, which
we have to tolerate for now.
To make the test pass on b2qt platforms, fix the offscreen plugin
to explicitly send enter/leave events in the same way as Cocoa
now does.

Fixes: QTBUG-78970
Pick-to: 6.2
Change-Id: If45e43e625e8362c3502c740154f6a6a8962b9e9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-24 19:19:42 +02:00
Tor Arne Vestbø
8da42e1af6 macOS: Don't pretend like our backing store is a QRasterBackingStore
We're not using the internal m_image of QRasterBackingStore, nor its
m_requestedSize, so inheriting it was just causing confusion when we
ended up in QRasterBackingStore::scroll(), operating on those members.

Pick-to: 6.2 5.15 5.12
Change-Id: I26561209c0a19777577724728f0ad62e07673577
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-09-24 18:42:23 +02:00
Lars Knoll
9481de80b7 Fix compile error on Android
Remove an unused and deprecated enum value that was giving
compile errors due to a missing case statement when compiling
locally with -developer-build.

Pick-to: 6.2
Change-Id: Ieca2124beda122f603acfd1b5f5746284a8a1a6c
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-09-24 14:37:02 +00:00
Assam Boudjelthia
bbf115dec0 Android: fix error when signing bundles
The jarsigner command that was being used was malformed before the
file path leading to wrong signing command. A sample of the malformed
command part "-storepass password⍣/path/to/package", note the char
after 'password'. So having auto produces a QStringBuilder that's
returning the malformed char.

Fixes: QTBUG-96838
Change-Id: I5477f6913a74d79ebaf029ef7f4e2745c9f7ced0
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit f492790611fe15a4745c8ad0c97259f438c91b6b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-09-24 13:45:07 +00:00
Craig Scott
03104825d2 Add docs for qt_extract_metatypes()
Also tidy up the inline TODO comments to reduce duplication and address
some minor inconsistencies.

Task-number: QTBUG-95712
Pick-to: 6.2 6.2.0
Change-Id: Ic0d27f3c0a356fd311bba95de967faaea05e0f0a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-09-24 22:41:31 +10:00
Craig Scott
3ce0672143 Add docs for qt_set_finalizer_mode()
Task-number: QTBUG-95712
Pick-to: 6.2 6.2.0
Change-Id: Ie7b9282cfc6a27415db5e623a66317c9681c3991
Reviewed-by: Luca Di Sera <luca.disera@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-09-24 22:07:24 +10:00
Alex Trotsenko
d3a622f817 Revert "QProcess: do not emit aboutToClose() twice"
This reverts commit efb90f6e7e.

Reason for revert: behavior change for signal listeners

Change-Id: Ibe3c5d496cd61a9fccab17a10cc9fda8334fc9d4
Reviewed-by: Björn Schäpers <qt-codereview@hazardy.de>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-09-24 05:57:47 +00:00
Shawn Rutledge
11fc0e7fb3 Register Wacom tablet devices on cocoa
After 6589f2ed0c it's possible and expected
that each platform plugin will register the input devices it discovers.

Task-number: QTBUG-46412
Pick-to: 6.2
Change-Id: I76c9252bc14c5c8e6af3ecc9b26211f6f301103d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-23 18:51:24 +02:00
Luca Di Sera
fc73b585f8 Doc: Update Microsoft's Documentation Links
The documentation links on `msdn.microsoft.com` now redirect to
`docs.microsoft.com`.

While the redirection works, our script to catch broken links on
dev-snapshots builds of the documentation doesn't handle redirection
correctly, reporting it as broken.

Both to appease the broken-links script and to avoid an unneccesary
redirection, the links were modified to point to the equivalent address
in the new domain.

Furthermore, the link to the `Winsock 2 Socket Handle` was moved to be
an `\externalpage` link, as it was used in two different places.

Additionally, the `\externalpage` link titled `Dirext X SDK` was removed
as it was not used in any part of the documentation.

Task-number: QTBUG-96127
Pick-to: 6.2 6.2.0
Change-Id: I07f0ae8d610a7f8322b892a2fa37a5cc1769289e
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-09-23 15:55:59 +00:00
Laszlo Agocs
4715128213 rhi: vk: Fix invalid index for unused attachments
Pick-to: 6.2
Change-Id: I8140de4eeb1a8a490fcffd10370c29a49d677fed
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-09-23 17:54:31 +02:00
Tor Arne Vestbø
4c78ef80ca macOS: Handle window titlebar buttons independently from style mask
Style masks such as NSWindowStyleMask{Resizable,Miniaturizable}
affect whether the window has a title bar button for the action,
but also whether the window can be resized or minimized through
other means, for example if the window border can be dragged
to resize.

By decoupling the visibility and enablement of the title bar buttons
from the style mask we can individually control the buttons, and
leave the style mask set to enable behaviors we always want. We
were already doing this for the NSWindowZoomButton.

Unfortunately AppKit not only checks NSWindowStyleMaskMiniaturizable
during a call to miniaturize, but also whether the title bar button
is enabled. To allow minimizing windows without the titlebar button
we detect the situation and give AppKit a NSWindowMiniaturizeButton
that we haven't disabled. The alternative would be to temporarily
enable the NSWindowMiniaturizeButton during the minimize, but this
results in the button flashing yellow for the duration of the
animation.

Task-number: QTBUG-65637
Task-number: QTBUG-46882
Task-number: QTBUG-64994
Task-number: QTBUG-71485
Change-Id: I2c1a9564d8b7516476aa018b2820670199124bc2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-09-23 17:01:16 +02:00
Tim Jenssen
fc6eb0bb7e QFileSystemWatcher: fix QWindowsFileSystemWatcherEngine crashes
Since QHash in Qt6 does not guarantee stable iterators after
an insert it crashed from time to time.
- possible crash at the erase call if pit is invalid
- possible crash at insert if pit is invalid

QHash<QString, int> myHash;
auto i = myHash.find("foo");
myHash.insert("foo", 789);
i.value(); // possible crash
myHash.erase(i); // possible crash

Task-number: QTBUG-96790
Change-Id: Ia9b53d46b8d1fef81ab5a130c229bc9e936f6521
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit e60951eef4f0ade944e2f93ffe2f44abfc76d97a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-09-23 14:57:04 +00:00
Edward Welbourne
2c2cdb959f Document QAbstractTestLogger's virtual method API
Provide the information an implementor needs in order to be able to
implement an logging backend.

Change-Id: I7bb522de57149dad843e01a8afa9f8891d011d29
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-23 16:57:03 +02:00
Edward Welbourne
78c8f0cd4d Deprecate QTest::qWarn() and replace its last use
The one place that actually called it with file and line number was
internal to QtTest, so could call QtTestLog::warn().

Change-Id: I8be10fc81996cc3de4d2eea3ecedc59671ffe759
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-23 16:57:03 +02:00
Edward Welbourne
5b525e8e54 Replace QTest::qWarn() with qWarning()
It's the recommended replacement when file and line aren't known, and
simplifies the code in any case, thanks to taking format and varargs.
It incidentally also enables tests to tell QtTest's custom message
logger to anticipate its warnings, when they arise.

Fixes: QTBUG-67702
Change-Id: I10c883f4dd0b69dca6e59e0dbd55ab318f1938f4
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-23 16:57:03 +02:00
Edward Welbourne
8511c8b02f Convert all QT_VERSION checks to compare against QT_VERSION_CHECK()
The result is generally more readable.

Change-Id: I507f67954ecd38516de1b7a6f8244c233ee45ddf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-09-23 16:57:03 +02:00
Edward Welbourne
298e41b830 Remove fatuously true or false QT_VERSION checks
QT_VERSION is now at least QT_VERSION_CHECK(6, 3, 0), so remove all
checks against Qt 6.0.0 or earlier. They are superfluous. Tidied up in
some places in the process, particularly #include order.

Change-Id: I2636b2fd13be5b976f5b043ef2f8cddc038a72a4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-09-23 16:57:03 +02:00
Laszlo Agocs
e5d65996a9 Add some debug warnings to the GL paint engine regarding stencil
There is absolutely nothing we can do if the render target has no
stencil buffer, but print at least a warning in debug builds to give a
hint to the developer.

Pick-to: 6.2
Task-number: QTBUG-96786
Change-Id: If7f84f28f9bc9b3dadd01d0816c8db4015a1db0b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-09-23 16:27:59 +02:00
Richard Moe Gustavsen
e9cef8e7fa QMessageBox: read geometry from the screen the message box belongs to
The current implementation found a QScreen by using the
position of the mouse in a call to QGuiApplication::screenAt().
From the documentation, this function is allowed to return
nullptr if the position is outside the screen.

From the stack track in the bug report, it seems very likely
that the mentioned call returns nullptr. This is strengthen
by the fact that the crash happens for messageboxes that are
maximized, so that you need to click on the upper corner of the
screen to close it. And then only when HiDPI scaling is in use
at the same time.

This patch will change the code to just use the screen that the
widget is on instead. If no screen can be resolved, the call will
default to primary screen.

Fixes: QTBUG-96639
Pick-to: 6.2
Change-Id: I31f0301318b358be9619caa31cc831b9598d5f90
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-09-23 16:19:13 +02:00
Doris Verria
7c26d7f482 Cocoa: Don't call makeKeyAndOrderFront for native app-modal dialogs
We show non-modal and Qt::WindowModal native  dialogs as modeless
panels by calling  makeKeyAndOrderFront on the panel. When we exec()
a dialog on the other hand, we start a modal event loop by calling
runModalForWindow. This method will display the dialog and make it a
key window before running the modal event loop. So we don't need to
and shouldn't call makeKeyAndOrderFront explicitly before that.
Doing so will make Cocoa lose the reference to the previous active
window (as it maintains only one level of previous active window) and
wrongly choose the main window as key after the dialog closes. Avoiding
the call to showModelessPanel for Qt::ApplicationModal dialogs fixes it.

Also, in order to display a modal when show() is called and app modality
is set via setModality, display it as a modeless dialog as well. This
keeps the same behavior we have currently, but it is still not the right
way to handle it as we don't respect the modality set by the user.
A clean-up of that logic to come in a follow-up commit.

Fixes: QTBUG-42661
Pick-to: 5.15 6.1 6.2
Change-Id: I8f33e3866b191d775a64a5d9ec3dd65736114e62
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-23 10:10:13 +02:00
Richard Moe Gustavsen
8a8be2d638 macOS: Change NSTrackingArea to use NSTrackingActiveAlways
The current implementation configured NSTrackingArea to be active
while the application was active (NSTrackingActiveInActiveApp).
But because of a bug in AppKit, the tracking area would sometimes
stop being updated, with the result that no mouse events was being
sent from AppKit. One way to trigger this bug would be to
deactivate the app using cmd+tab (fast enough so that the task
switcher is not showing), and reactivate it again using a
mouse click.

To work around this issue, this patch will instead configure
the tracking area to always listen for tracking events, even when
the application is inactive (NSTrackingActiveAlways). By doing so,
we bypass the apparently broken behavior in AppKit related to
activation. The downside is that we then also get tracking events
while the application is inactive, which is against how Qt should
work. So we therefore need to now check if the application is active
before we forward any tracking events to QWSI.

With NSTrackingActiveAlways we no longer get enter/leave events
from AppKit when the application is activated/deactivated and the
mouse stays on top of the application, so we now also need to handle
this explicitly from the application delegate. Since we already need
to keep track of which QWindow is under the mouse to be able to send
out enter/leave from mouse moves, we use the same variable
(s_windowUnderMouse) for this purpose as well.

Because of QTBUG-35109, there was already a code path in QCocoaWindow
that sent out an enter event when a window became key. This is no
longer needed now that we send out enter/leave when the application is
activated/deactivated. It's also questionable if sending an enter
event based on a window's key status is correct, since we in Qt should
also send out enter events for inactive windows. So we remove this code
path since it interferes with (both the old and) the new implementation.

Fixes: QTBUG-36926
Task-number: QTBUG-94447
Change-Id: I5c1105bc3102925c9c65964b4a7d1e02efd01735
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-23 03:20:08 +00:00
Tor Arne Vestbø
8f13af5d7b Add private qAbort helper function
Used from qt_message_fatal(), but is useful in other situations too.

Change-Id: I3c0e438536d40271061c76d954c7878abfe37b8e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-09-22 22:44:19 +00:00
Alexandru Croitor
0da123d67b CMake: Bump almost all cmake_minimum_required calls to 3.16
Needed for subsequent change that will check and error out if the
version is lower than 3.16. We do that to ensure all policies
introduced by CMake up to version 3.16 have their behavior set to
NEW.

Pick-to: 6.2
Task-number: QTBUG-95018
Change-Id: Ieaf82c10987dd797d86a3fd4a986a67e72de486a
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-09-22 19:36:49 +02:00
Tor Arne Vestbø
a36a795770 macOS: Fix logic for determining NSWindowStyleMaskTitled/Borderless
We were working under the assumption that the NSWindowStyleMaskBorderless
style mask excluded all others, on account of having the value 0. But in
practice this does not seem to be the case, and you can combine the mask
with many of the other masks. The only mask that is mutually exclusive with
the borderless mask is NSWindowStyleMaskTitled (with a value of 1).

Clarify this be restructuring QCocoaWindow::windowStyleMask().

Task-number: QTBUG-71485
Change-Id: I4bbd603fd2373c11f76e84b72a2a60aa2356b032
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-09-22 17:14:12 +02:00
Craig Scott
f82653c973 Document qt_add_library() and update related docs
Task-number: QTBUG-95712
Pick-to: 6.2 6.2.0
Change-Id: Ib107110457380a2bb30876cf2c565f0c8e8c5e9c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-09-23 00:49:06 +10:00
Craig Scott
7fd9981f4d Add docs for qt_add_plugin()
Task-number: QTBUG-95712
Pick-to: 6.2 6.2.0
Change-Id: Ifdc10c7714e91f6211a52bd5c46b3140485bbb43
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-09-23 00:49:06 +10:00
Edward Welbourne
faa99aac43 Remove spurious QTestResult::setCurrentTestData(nullptr);
Calls to QTestResult::setCurrentTestData() are handled via an RAII
class, QTestDataSetter, that ensures this final call passing nullptr
was redundant.

Change-Id: I7788e3ce898e5628d5590ef9d34182f05e85fe50
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-22 16:31:11 +02:00
Fabian Kosmale
b7f2019357 QThreadPrivate: Remove threadForId
The thread build variant is not implemented; the no-thread one simply
returns the current thread. As this has no utility at best and
misleading at worst, remove those functions.

Change-Id: I93ee45ae7d55e3a7ad1f03168b14149a5d4c9253
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-09-22 15:40:30 +02:00
Ievgenii Meshcheriakov
fe46cd59ce Add isValidUtf8() methods to QUtf8StringView and QByteArray{,View}
The new methods return true if the string contains valid UTF-8
encoded data, or false otherwise.

[ChangeLog][QtCore][QByteArray] Added isValidUtf8() method.

[ChangeLog][QtCore][QByteArrayView] Added isValidUtf8() method.

[ChangeLog][QtCore][QUtf8StringView] Added isValidUtf8() method.

Task-number: QTBUG-92021
Change-Id: I5d0cb613265d98b1f189c5f5cc09c1f7db302272
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-09-22 15:40:30 +02:00
Mårten Nordheim
9e770e3572 QNetworkInformation: Request all supported feature when loading by name
When we load by name we used to pass an empty QList to the backend as
the list of requested features. That's not ideal if a backend were to
selectively initialize components, so let's just pass the list of
supported features.
Not a problem in any current backend but it looks weird.

Pick-to: 6.2
Change-Id: Ib022778b08d32e4057103a86bfdda9e17e6ebdaf
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-09-22 13:55:58 +02:00
Allan Sandfeld Jensen
0728e88be6 Remove redundant semi-colons
Causes warnings with clang-cl

Change-Id: I57395819debe07aecd045c5a8c747632e6c04fc1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-09-22 09:36:34 +02:00
Alex Trotsenko
a320b54bb6 QLocalSocket: reorder device closing
To allow reading from a slot connected to the aboutToClose() signal,
we should call QIODevice::close() just before closing the inner device.

This patch amends 21f3ff65b8.

Pick-to: 6.2
Change-Id: Ic8cd00497e1bdf923b980c26e9ca874b77e82f89
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-09-21 21:40:27 +00:00
Mårten Nordheim
8910a01c72 Fix loading certificates on Android with OpenSSL
Fixes: QTBUG-96606
Change-Id: Ic2a55fa65c5dc3c057a4da25c218af5a9861410e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 504df6b135d4ac17aa2290e1aa943d216fb7ef55)
2021-09-21 20:49:33 +02:00
Tor Arne Vestbø
ab4fb3ffd4 macOS: Don't re-send key event through input method on focus object change
In 0c2ca26cd9 we started re-sending the
key event through the input method when we detected a focus object change,
to support the use-case of QAbstractItemView opening an editor and changing
focus in response to the first QEvent::InputMethod event.

Unfortunately this doesn't work as a general approach, because we don't
know what the reason was for the change in focus object. For example,
a client might respond to a Qt::Key_Return press by changing the focus
to the next input element, and re-sending the key event would in that
case insert a new-line in the new focus object -- counter to the
expectations of the client.

Since we can't know the reason for the changed focus object we can't
assume re-sending the key event is safe.

Task-number: QTBUG-54848
Fixes: QTBUG-96726
Pick-to: 6.2 6.2.0
Change-Id: Iea8b166385925cd1a05ef62d5cf763638d9f8a67
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-09-21 20:49:00 +02:00
Fabian Kosmale
388e7504be QVariant::Private: select storage in get at compile time
Change-Id: I82b0a7ec28400dac64ea785ba6766ca488e615aa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-09-21 19:22:33 +01:00
Fabian Kosmale
3f9d19b17b QVariant: write less haphazardly to data
While the data subobject is at the same position in memory as the
QVariant::Private, using d.data actually activates the union member.

Change-Id: Ie6879b588c8e830ae8b34cfcd8e9ddff8b60b3a6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-09-21 19:22:33 +01:00
Fabian Kosmale
01d94760d8 tst_qmetatype: Fix operator< detection for std::optional
Amends ca54b741d6.
operator< is not constrained in MSVC's standard library, either.

Pick-to: 6.2
Fixes: QTBUG-96690
Change-Id: Ibcbb9e53a1f9e8b13786f6d8c01489c61d8d2d7f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-09-21 19:27:50 +02:00
Laszlo Agocs
4cc5428548 Cater for upstream changes in eglplatform.h
EGL_NO_X11 has been replaced with USE_X11, thus breaking all existing
code out there, including Qt:
https://github.com/KhronosGroup/EGL-Registry/pull/130

Fix this by defining USE_X11 whenever we do not define EGL_NO_X11.

Fixes: QTBUG-96392
Pick-to: 6.2
Change-Id: If8b68caa8c9022477d87169ca2e2a0121a9313e0
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-09-21 16:21:01 +02:00
Edward Welbourne
080bbb9f8b Improve version-related docs in qglobal.cpp
Give a more pragmatic illustration for QT_DEPRECATED_BEFORE.
Make various minor tweaks to wording, use slightly less antique
versions in examples. Make usage of "runtime" standard in qglobal.cpp,
at least, since "run-time" seems to be less used generally.

Change-Id: I1db4950d0d0e97903b1586d98ecba75576493b1c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-09-21 14:52:43 +02:00
Thiago Macieira
8cc6c7cd6e QProperty: attempt to fix compilation with GCC 10
Somehow it's not expanding properly in constexpr time.

qproperty_p.h:554:30: error: \u2018(QItemSelectionModelPrivate::modelChanged != 0)\u2019 is not a constant expression
         if constexpr (Signal != nullptr) {
                       ~~~~~~~^~~~~~~~~~

Fixes: QTBUG-96659
Change-Id: I3eb1bd30e0124f89a052fffd16a69d2eb4b45784
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-09-21 04:10:25 -07:00
Morten Johan Sørvig
67b2c84992 Make QWindow respect minimumSize again on Windows
Commit 6336b535 accidentally removed a call to
applyToMinMaxInfo(). Add it back.

Task-number: QTBUG-96441
Pick-to: 6.2.0 6.2
Change-Id: I26a5d121ed3b4cd9e49e3dd8b371abe71d9a482c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-21 11:10:25 +00:00
Luca Di Sera
28157cf24e Doc: Repair broken link to the XDND protocol
The documentation for QTGUI's `Drag and Drop` links to the XDND
protocol, which is used to manage Drag and Drop on X11.

The previous link seems to have been broken for a few years and was thus
replaced with a link to XDND on Jhon Lindal's site, who is the author of
the protocol.

Task-number: QTBUG-96127
Pick-to: 6.2 6.2.0
Change-Id: Ia46b10c7461129491934eb74355f107f96e04383
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2021-09-21 12:51:06 +02:00
Alex Trotsenko
b362279e86 Refactor QWindowsPipeWriter::writeCompleted()
Change-Id: Id44215d6a96e7841330181c94cc54b6b677a153d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-09-21 11:07:12 +03:00
Craig Scott
30e2f51dab Add docs for qt_allow_non_utf8_sources()
Task-number: QTBUG-95712
Pick-to: 6.2 6.2.0
Change-Id: Ie09785ced5b2bf8098ccff3467f32244f32f9195
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-09-21 14:02:52 +10:00
Craig Scott
9a7c552831 Add docs for qt_disable_unicode_defines()
Task-number: QTBUG-95712
Pick-to: 6.2 6.2.0
Change-Id: I37a50d9e8a62c7d9c30014692d99ffe2eb9b90fb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-09-21 14:02:46 +10:00
Povilas Kanapickas
2d5541d6c3 3rdparty: Fix forwards-compatibility bug in bundled xinput xcb module
libxcb thinks that it knows about all device class types sent by the X
server XInput extension. With the addition of touchpad gestures in
XInput 2.4 and X server 21.1 this is no longer the case and libxcb fails
horribly by thinking that the protocol was malformed.

The X server currently has a workaround, but it would not address the
following situation:

- there are multiple modules within the same X client (e.g. part of the
application uses Qt, another part talks to X server via another library)
 - both of the modules talk to XI
 - at least one module requests for XI 2.4 protocol support.

The request for XI 2.4 disables the workaround on the X server and Qt
side would crash horribly.

This bug is being fixed upstream in these MRs:
https://gitlab.freedesktop.org/xorg/proto/xcbproto/-/merge_requests/23
https://gitlab.freedesktop.org/xorg/lib/libxcb/-/merge_requests/20

Change-Id: Idf345271340031152b512ef59f619313be5ec226
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-09-20 23:10:26 +03:00
Mårten Nordheim
1479f057f3 QNetworkInfo(Win): cleanups
One signal emission was not labelled emit.
Removed some unnecessary braces

Change-Id: I1c0adde869e559056e60671619bfca33b1966d1e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-09-20 19:00:01 +00:00
Mårten Nordheim
810e4e56bd QNetworkInformation: Actually compare names case insensitively
The docs (10 lines above) say it will find the backend case
insensitively. Thus the comparison should also be case-insensitive.

Pick-to: 6.2
Change-Id: I65901ed81b7d8bdfcf76f5b6c7b40efe63245503
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-09-20 21:00:01 +02:00
Giuseppe D'Angelo
bf5d5bfc0c QScoped(Array)Pointer: use the rule of 5
CodeChecker complains regarding the two classes not having all
the special 5 declared, so do it.

Change-Id: I76d562c52f89a24aec9f155c2be62f8844f1f4a7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-09-20 20:18:06 +02:00
Giuseppe D'Angelo
b32698b3a9 DBus: do not mix QList iterators and raw pointers
In Qt 5, QVector::iterator was actually a raw pointer. In Qt 6,
QVector = QList, and QList::iterator isn't a pointer, but converts
to one (for backwards compatibility).

Some code in QtDBus exploits this by mixing iterators and raw
pointers. In preparation for deprecating conversions between them,
adjust this code by "converting" explicitly when needed.

Change-Id: I1efab72b33d27742b339cf848cefd5cc258cd215
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-09-20 19:21:53 +02:00
Friedemann Kleint
710842f075 uic: Add QWebEngineView
This is required to generate the correct import for Python.

Pick-to: 6.2 6.2.0
Task-number: QTBUG-63235
Change-Id: I6aaff82058e3f0a5453da15d8d470f06ad9a5a16
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2021-09-20 17:00:05 +00:00
Tatiana Borisova
766904bf5b Compile autotests for Integrity
- process environment/DNS are OFF for INTEGRITY

Task-number: QTBUG-96176
Pick-to: 6.2
Change-Id: I189a97f88c96a428586c31a66b8d250e04482900
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-09-20 17:29:04 +03:00
Edward Welbourne
c608bdfb25 Fix assorted misindented end-comment markers in qglobal.cpp
Change-Id: I240e7d32c4aa004f2bd7dd8cafd39b7c7d64e014
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2021-09-20 15:05:36 +02:00
Edward Welbourne
44028a227e Encourage use of QT_VERSION_CHECK()
Document that QT_VERSION should normally be compared against it,
rather than raw hex, and mildly update the example versions used in
docs. (Left the snippets testing old version, since the code in which
the #if-ery is used might actually make sense for those versions.)

Improve related documentation in the process.

Change-Id: Id3e97f41bfb0f81a117cf7b3a3ccd5f244e2a99a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-09-20 15:05:36 +02:00
Edward Welbourne
7943480f0f Fix QDateTimeParser's handling of 't' format to match serialization
This amends commit 68f19fb630 to only
consume one 't' from the format string, to match qlocale.cpp's
serialization of time-zone specifiers, which only consumes one, so
will repeat the time-zone specifier as many times as unquoted t
appears in the format. It's hard to imagine why anyone would want this
behavior, but it's what our serialization has always done and parsing
should match serialization.

Add test-cases for double time-zone specifier.
Delete a lie in the process.

Task-number: QTBUG-95966
Change-Id: I574896040a74085dee89a4fefd8384be44ad827b
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-09-20 15:05:36 +02:00
Joerg Bornemann
63dcb31049 Don't bootstrap rcc
The rcc tool doesn't contribute to the build of QtCore anymore.
There's no need to link it against the bootstrap lib.

Change-Id: I5272d439a05f852eeea88b3a6b95c5ad6dd4e987
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-09-20 13:19:02 +02:00
Laszlo Agocs
481bc82d59 rhi: Remove Q_RELOCATABLE_TYPE for types with QVLA in them
QVLA itself is non-relocatable due to self references. (ptr pointing
to array[Prealloc] as long as capacity < Prealloc)

Seems we shot ourselves in the foot in multiple places with this.

Pick-to: 6.2 6.2.0
Fixes: QTBUG-96619
Change-Id: I57a2ce539b671326cd352dbe57a1f3d4c46a6456
Reviewed-by: Tobias Koenig <tobias.koenig@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-09-20 12:25:37 +02:00
Ivan Solovev
b4bb3a5415 Introduce QDoubleValidator::setRange overload with two parameters
The QDoubleValidator::setRange() used to have 3 parameters, with
the third one (the number of decimals) having a default value of 0.
Such default value does not make much sense for a *double* validator.
Also, since a default value was used, omitting the decimals was
silently overwriting the previous decimals value, discarding the
value that could be previously explicitly specified by user.

[ChangeLog][QtCore][QDoubleValidator][Important Behavior Changes] The
QDoubleValidator::setRange() method now has two overloads.
The first overload takes 3 parameters, but does not support a
default value for decimals.
The second overload takes only two parameters, not changing the
number of decimals at all.
Hence, the number of decimals will only be changed if the user
explicitly specifies it.
To maintain the old behavior of setRange(), pass 0 as the 3rd
argument explicitly.

Note that it is a source-incompatible change. But it should be fine,
because using QDoubleValidator with 0 digits after decimal point does
not make much sense and so, hopefully, is not that common.

At the same time, change the default-constructed QDoubleValidator
to use -1 for decimals, which allows arbitrarily many digits in
the fractional part. The value was previously 1000, which allowed
more than anyone would reasonably use, so this should make no
practical difference.

Some more unit tests to cover the behavior of the setRange()
overloads are also added.

As a dirve-by: remove unnecessary QValidator::State to int conversions
in the unit tests. QCOMPARE is capable of comparing these enums and
provides a better output in case of failure for enums.

Task-number: QTBUG-90719
Change-Id: I523d6086231912e4c07555a89cacd45854136978
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-09-20 09:39:13 +02:00
Craig Scott
fa9f13f130 Handle empty string args for versionless wrappers of dbus CMake commands
CMake silently drops empty list items when passing ${someVar} to a
function unquoted. The versionless wrapper functions typically use
${ARGV} or ${ARGN} to pass through arguments from the caller to the
versioned implementation, but this doesn't preserve empty arguments.
For qt_add_dbus_adaptor() in particular, this was problematic because
that meant arguments after the empty arg effectively "moved left" and
were interpreted as the wrong arguments.

Use named arguments and pass through each one explicitly for the
qt_add_dbus_adaptor(). This takes advantage of the implementation of
the versioned function, which also checks each optional positional
argument explicitly. We can only do this because we know the upper
bound on the number of arguments, so it is possible to represent each
argument with its own variable. A more general solution that didn't
need to know the number of arguments would require the
cmake_language(EVAL) command, but that requires CMake 3.18 or later.

Fixes: QTBUG-96594
Pick-to: 6.2
Change-Id: Ibb1de19217191768ca5ead969b20a1d28c466868
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-09-20 14:23:14 +10:00
Giuseppe D'Angelo
c578d9943a Plaster [[nodiscard]] on some RAII classes
The idea is to prevent silly mistakes such as

  QMutexLocker(mutex);
  doSomething();

where the locker is constructed and destroyed immediately. Compilers
don't normally warn in these cases (as the constructor/destructor
pairs involved do have side effects), but we can mark the type as
[[nodiscard]] to encourage warnings.

There is another couple of classes for which this would make sense
(notably, the R/W lockers), but unfortunately those are exported
classes, and GCC has a bug where one can't mix two different attribute
syntaxes on the same entity [1], so I'm skipping those.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102399

Change-Id: I75a2443dc71e6b80613b8edd52a04d3379355728
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-09-19 18:04:06 +02:00
Giuseppe D'Angelo
7eeda336b4 Switch a comma operator to a IILE
A comma operator results in a discarded-value expression, meaning the
compiler is going to complain the moment we mark QMutexLocker as
nodiscard. Turn the comma into a functionally equivalent IILE.

Change-Id: I33826902c8471016490aac25160b70c609dafd90
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-09-19 13:56:20 +02:00
Alex Trotsenko
efb90f6e7e QProcess: do not emit aboutToClose() twice
This signal is emitted by the QIODevice itself, so we don't have to
emit it from QProcess::close().

Pick-to: 6.1 6.2
Change-Id: I9165b3eebadc17a66cc834d5ef54441d13f23d7d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-09-19 10:42:50 +03:00
Allan Sandfeld Jensen
53d1e26ff5 High resolution wheel-event support from libinput
Is necessary because the support was added using a new event
and a new getter.

[ChangeLog][QtGui][libinput] Can now use the hires scrolling API
from libinput 1.19, adding this feature to QPAs using libinput directly

Task-number: QTBUG-96227
Change-Id: Ie30281de2f6391389e9e6049bc4117d3a8f63ad1
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-09-18 15:39:07 +00:00
Volker Hilsheimer
e7db28fa9d macOS: Remove remnant of popup closing logic from Cocoa plugin
This monitor call back is never called when a popup is open and there's
mouse action.

Change-Id: I6c45b600ebea16e5fd6c5b3af66fd1242973d747
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-18 17:30:37 +02:00
Liang Qi
d8f37d94e5 xcb: convert last screen to fake when no screen
available for xrandr 1.5 like we did before for xrandr 1.4
(since a094af0017).

Tested with following combination:

* qtbase -DECM_ENABLE_SANITIZERS=address cmake build
* examples/widgets/widgets/wiggly with
ASAN_OPTIONS=verify_asan_link_order=0 env
* xrandr --output LastScreen --off and --auto.

Fixes: QTBUG-96247
Task-number: QTBUG-42985
Change-Id: Idd95d1a3aa057d23e3adb6635dd1acbb2c853497
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-09-18 16:29:39 +02:00
Alex Trotsenko
b2c3b3e8fe Q{LocalSocket|Process}/Win: handle write errors
To match the Unix behavior, we should emit errorOccurred() signal and
close the channel if the write operation fails.

Change-Id: Iac3acb18dbbfe6e7e8afb2555d9adaff1fe98d0f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-09-18 13:50:28 +03:00
Alexandru Croitor
f4aaba593c CMake: Add option in qt6_wrap_cpp to output a metatypes json file
At the moment only the Qt internal qt_manual_moc function allows
manually running moc and generating a metatypes json file.

There is no such functionality available in the public qt6_wrap_cpp
and qt6_generate_moc functions.

Change qt6_wrap_cpp to accept a new internal option called
__QT_INTERNAL_OUTPUT_MOC_JSON_FILES to allow creating and retrieving
the associated json file with metatypes information.

This is needed to fix qtremoteobjects CMake API which needs to run moc
manually and process the metatypes json file.

The option is internal because we don't want to introduce new API in
6.2.0.

Task-number: QTBUG-95832
Change-Id: Ic8dd27fc960c3f8dea8c101dfc028db45494953d
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
(cherry picked from commit 90e7d6db1bb44de3629ec2b70df26fbafe4294fa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-09-18 07:56:19 +00:00
Alex Trotsenko
4e695eece7 QWindowsPipeWriter: do not clear the buffer in thread pool callback
In a blocking application, receiving the results of write operations
must be synchronized with the waitFor...() functions. But, clearing
the buffer in another thread can cause the code

  localsocket.write(...);
  QVERIFY(localsocket.bytesToWrite() > 0);

to fail unexpectedly, if the socket has been disconnected between
the calls.

So, defer resetting the buffer until checkForWrite() is called.

Change-Id: I8c21036aab6a4c56d02c0d9a18d4bbce52d724f4
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-09-18 10:46:35 +03:00
Giuseppe D'Angelo
51e28dc54f QIconLoader: code tidies
Turn QThemeIconEntries into an owning container (std::vector of
unique_ptr), so that code using QThemeIconInfo doesn't have to
manage ownership (and forget to do so, and cause bugs like
QTBUG-93050).

The fallout is mostly on isEmpty() vs empty(); as drive-by fixes:
* use auto;
* use make_unique (no raw news);
* turn a few indexed loops into range-based ones;
* streamline an if-else-if chain;
* turn a !(a == b) condition into a != b.

Change-Id: Ie3ac9de57c80ed3184ec0d15c847f81306ef48ca
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-09-18 09:41:49 +02:00
Zhang Hao
33238ea2c6 Fix QTextEdit cursor rectangle vertical positioning
When there are characters with different pointsize in QScriptLine,
the value of si.descent is less than sl.descent, which will cause
the y value of the cursor rectangle to be too large.
If si.descent is less than sl.descent, the height of the cursor
rectangle is equal to base plus si.descent.
Amends e99a883bd3

Fixes: QTBUG-96288
Done-with: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Pick-to: 6.1 6.2
Change-Id: I4a8566b32cfa75d8ca1a584f5e8e577c5c9caf0d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-09-18 00:55:36 +00:00
Edward Welbourne
1c6d6b7c0d Fix name used for qmath.h in an include
Pick-to: 6.2
Change-Id: I9be8d4cc33d75a806a1ecf9950d7bac330abe9ea
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-09-17 17:54:10 +00:00
Giuseppe D'Angelo
d48db627f3 QVersionNumber: fix iterator/pointer mistake
The dataFitsInline and setInlineData functions take a pointer/size
pair, not an iterator/size pair. The code was working because QList
iterators implicitly convert to pointers -- but that's sloppy,
just use the list's data() function instead. Do a similar change
for the constructor taking an initializer_list, for symmetry.

Change-Id: I2cec191620185b3b08169c4051296eb610f14ecf
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-09-17 17:29:24 +00:00
Kai Köhne
6faa6cb1d7 Doc: Add version and description to Qt-DBus documentation
This makes sure that the Qt version is part of the HTML title.

Pick-to: 6.2
Change-Id: I2ad8535a9289616d21c18bd9e92d4a91f6faced0
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-09-17 17:54:09 +02:00
Edward Welbourne
7a4b586f4b Remove conditioning on Android embedded
It is no longer handled separately from Android.
This effectively reverts commit 6d50f746fe

Change-Id: Ic2d75b8c5a09895810913311ab2fe3355d4d2983
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-09-17 17:30:14 +02:00
Giuseppe D'Angelo
d8fd2425fb QCoreApplication: enforce non-null arguments when sending/posting events
Passing nullptr as receiver and/or as an event parameter to sendEvent,
postEvent, etc. is meaningless. It's also something that users can check
for. Therefore, it should not be allowed. Note that the current code
already relies on the arguments not to be null, albeit "indirectly"
(e.g. they get dereferenced without any null checks).

Hence: add asserts that check for non-null in all the relevant
codepaths, except for the ones in which there's currently just a
warning; for those, add a Qt 7 note.

Change-Id: Ia4c58551de88a5d1003f09efa448c1330b6cb122
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-09-17 16:48:45 +02:00
Laszlo Agocs
0cea6384ae android: Implement nativeResourceForContext
To bring the plugin on par with xcb and eglfs in this regard.

New code has a better way to query these via
QOpenGLContext::nativeInterface() (or, more correctly, will have a
better way once the ability to query the config and display is added
in a follow up patch), but having some symmetry between the EGL-based
plugins won't hurt.

This is relevant in particular with OpenXR: not knowing the EGLConfig
makes it impossible to use the API on Android:
https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrGraphicsBindingOpenGLESAndroidKHR

Pick-to: 6.2
Change-Id: I163aed070096a4b58d3f650906c2f70ea31b3231
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-09-17 14:48:45 +00:00
Laszlo Agocs
0dbed05bbc rhi: vulkan: Reset state more aggressively
...when starting a render/compute pass.

This matches most other backends in fact, the Vulkan backend has
just certain historical differences, and is complicated due to the
fact that it has the option of using secondary command buffers for
passes that specify ExternalContents (to support the case of wanting
to issue direct Vulkan commands in a code block surrounded by calls
to beginExternal and endExternal).

Not resetting state such as the currently bound index buffer when
starting a pass quickly blows up when two consecutive render passes
use different settings, one targeting the primary while the other
the secondary command buffer. Instead of further complicating the
logic, just reset the relevant state in every begin(Compute)Pass.

Comes with an autotest that is crafted so that it manages to
downright crash when run with Vulkan without the fix to the backend.

Fixes: QTBUG-89765
Pick-to: 6.2
Change-Id: I8dc47bd179c17d45a0556ec31200dc90c4b67ca5
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-09-17 16:48:44 +02:00
Tor Arne Vestbø
c70bb357cc Fix loading of OpenSSL on macOS versions that ship its own OpenSSL
The unversioned libcrypto.dylib that's shipped with macOS 10.15 will
result in a crash if loaded, with a message saying that the unversioned
library should not be loaded, as it doesn't provide a stable ABI.

Task-number: QTBUG-95249
Pick-to: 6.2 5.15
Change-Id: I49325e5d675155e90840cc93623549f725bc77b4
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-09-17 16:09:51 +02:00
Tor Arne Vestbø
28b14b966f Deduplicate maybeQuitOnLastWindowClosed handling
The functionality now lives in QGuiApplication, and is triggered
by QGuiApplication and QApplication after dispatching the close
event to the window.

The slight difference between how a Qt GUI and Qt Widget app
determines if a window should contribute to the close-on-quit
behavior has been abstracted into a QWindowPrivate helper.

The additional checks that were in place for skipping out of
the whole maybeQuitOnLastWindowClosed machinery have been kept.

Task-number: QTBUG-53286
Change-Id: I81bd474755f9adb3a2b082621e5ecaa1c4726808
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-09-17 14:56:19 +02:00
Tor Arne Vestbø
1b0cb84212 Fix QGuiApplication command line options documentation for X11
Fixes: QTBUG-96600
Pick-to: 6.2 5.15
Change-Id: Ic3670b952d97270cce4f0a8df8bba79e934e4a6d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-09-17 14:56:19 +02:00
Liang Qi
bb4b40b7e1 Revert "Qt xcb: remove false detects of Qt::GroupSwitchModifier"
This reverts commit 25a7034d78.

The change makes the 5th modifier key broken, which is more
serious than Backspace key doesn't work in CapsLock on.

And we don't have a better solution for both of them now,
perhaps it's better to keep the old behavior in 6.2 LTS.

Task-number: QTBUG-49771
Fixes: QTBUG-95108
Fixes: QTBUG-95289
Pick-to: 6.2 6.2.0 5.15
Change-Id: Ie5d0aafa562b5097e089cafc83ae227c75c6d752
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-17 13:32:00 +02:00
Mitch Curtis
fae419a8e6 macOS: Use new QPlatformTheme::appearance() function
Instead of qt_mac_applicationIsInDarkMode().

Task-number: QTBUG-94859
Change-Id: Ib64c081adfafb2843a7593d0e35668cce70cffd0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-17 13:32:00 +02:00
Mitch Curtis
2248487c6c Add QPlatformTheme::Appearance for detecting light/dark modes
And implement it on Windows and macOS.

Fixes: QTBUG-83908
Fixes: QTBUG-94859
Change-Id: I7b0c062adf5d4dbaefa64c862ab8ab1348809d71
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-17 13:31:59 +02:00
Tor Arne Vestbø
b6200de5d0 Don't unload libraries on Darwin-based operating systems
We can't guarantee that the library didn't define Objective-C classes
that still have lingering references, resulting in warnings such as:

 Attempt to use unknown class 0x10e52e110.

And possibly crashes such as:

 thread #1, queue = 'com.apple.main-thread'
    frame #0: 0x00007fff203829ee libsystem_kernel.dylib`__ulock_wait + 10
    frame #1: 0x00007fff203fa0c5 libsystem_platform.dylib`_os_unfair_lock_lock_slow + 162
    frame #2: 0x00007fff2026226b libobjc.A.dylib`unmap_image + 85
    frame #3: 0x000000010001e11f dyld`dyld::removeImage(ImageLoader*) + 557
    frame #4: 0x000000010002291d dyld`dyld::garbageCollectImages() + 956
    frame #5: 0x000000010002e35d dyld`dlclose + 191
    frame #6: 0x00007fff203cf1c9 libdyld.dylib`dlclose + 183
    frame #7: 0x0000000103f9f2f1 libQt6Core_debug.6.dylib`QLibraryPrivate::unload_sys(this=0x000000011ba2c7d0) at qlibrary_unix.cpp:294:9
    frame #8: 0x0000000103f93f3f libQt6Core_debug.6.dylib`QLibraryPrivate::unload(this=0x000000011ba2c7d0, flag=UnloadSys) at qlibrary.cpp:614:36
    frame #9: 0x0000000103f971fb libQt6Core_debug.6.dylib`QLibraryStore::cleanup() at qlibrary.cpp:425:22
    frame #10: 0x0000000103f970f9 libQt6Core_debug.6.dylib`qlibraryCleanup() at qlibrary.cpp:447:5
    frame #11: 0x0000000103f970d1 libQt6Core_debug.6.dylib`(anonymous namespace)::qlibraryCleanup_dtor_class_::~qlibraryCleanup_dtor_class_(this=0x00000001041edd38) at qlibrary.cpp:449:1
    frame #12: 0x0000000103f930f5 libQt6Core_debug.6.dylib`(anonymous namespace)::qlibraryCleanup_dtor_class_::~qlibraryCleanup_dtor_class_(this=0x00000001041edd38) at qlibrary.cpp:449:1
    frame #13: 0x00007fff202e5d25 libsystem_c.dylib`__cxa_finalize_ranges + 316
    frame #14: 0x00007fff202e6010 libsystem_c.dylib`exit + 53
    frame #15: 0x00007fff203d1f44 libdyld.dylib`start + 8
    frame #16: 0x00007fff203d1f3d libdyld.dylib`start + 1

  thread #5, queue = 'com.apple.root.user-interactive-qos', stop reason = signal SIGABRT
    frame #0: 0x00007fff203a356e libsystem_kernel.dylib`__abort_with_payload + 10
    frame #1: 0x00007fff203a4fbd libsystem_kernel.dylib`abort_with_payload_wrapper_internal + 80
    frame #2: 0x00007fff203a4f6d libsystem_kernel.dylib`abort_with_reason + 19
    frame #3: 0x00007fff202749e3 libobjc.A.dylib`_objc_fatalv(unsigned long long, unsigned long long, char const*, __va_list_tag*) + 114
    frame #4: 0x00007fff20274971 libobjc.A.dylib`_objc_fatal(char const*, ...) + 135
    frame #5: 0x00007fff20255ccb libobjc.A.dylib`lookUpImpOrForward + 881
    frame #6: 0x00007fff2025539b libobjc.A.dylib`_objc_msgSend_uncached + 75
    frame #7: 0x00007fff22f368d6 AppKit`-[_NSWindowTransformAnimation setCurrentProgress:] + 42
    frame #8: 0x00007fff22f37a8a AppKit`__55-[NSAnimation(NSInternal) _advanceTimeWithDisplayLink:]_block_invoke + 31
    frame #9: 0x00007fff22d0774f AppKit`NSPerformVisuallyAtomicChange + 132
    frame #10: 0x00007fff22f379dc AppKit`-[NSAnimation(NSInternal) _advanceTimeWithDisplayLink:] + 172
    frame #11: 0x00007fff22e9a184 AppKit`-[NSScreenDisplayLink _fire] + 180
    frame #12: 0x00007fff2362f0b4 AppKit`___NSRunLoopTimerCreateWithHandler_block_invoke + 34
    frame #13: 0x00007fff204c6be9 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
    frame #14: 0x00007fff204c66dd CoreFoundation`__CFRunLoopDoTimer + 927
    frame #15: 0x00007fff204c623a CoreFoundation`__CFRunLoopDoTimers + 307
    frame #16: 0x00007fff204ace13 CoreFoundation`__CFRunLoopRun + 1988
    frame #17: 0x00007fff204abf8c CoreFoundation`CFRunLoopRunSpecific + 563
    frame #18: 0x00007fff2123d607 Foundation`-[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212
    frame #19: 0x00007fff22f378f0 AppKit`-[NSAnimation(NSInternal) _runBlocking] + 453
    frame #20: 0x00007fff22f376ae AppKit`__42-[NSAnimation(NSInternal) _runInNewThread]_block_invoke + 97
    frame #21: 0x0000000104edb032 libdispatch.dylib`_dispatch_call_block_and_release + 12
    frame #22: 0x0000000104edc264 libdispatch.dylib`_dispatch_client_callout + 8
    frame #23: 0x0000000104ef04ac libdispatch.dylib`_dispatch_root_queue_drain + 828
    frame #24: 0x0000000104ef0d3f libdispatch.dylib`_dispatch_worker_thread2 + 127
    frame #25: 0x0000000104f7eac7 libsystem_pthread.dylib`_pthread_wqthread + 244
    frame #26: 0x0000000104f7dae3 libsystem_pthread.dylib`start_wqthread + 15

This has been e.g. observed when a QNSWindow isn't closed and released
at application quit as expected. Although that is a corner case that
shouldn't happen, the general case is still valid.

Fixes: QTBUG-96208
Pick-to: 6.2 5.15
Change-Id: I6c9d220e6f5389707baf7ae983f3156e8e51c316
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-09-17 13:31:59 +02:00
Ivan Solovev
fb3549fc47 Introduce QDoubleValidator::fixup()
The provided implementation tries to fix positions for the group
separator.
In case of scientific notation it can also converts the value to
normalized form.
It uses QLocale::FloatingPointShortest internally to convert the
double value back to string, so the number of decimals may change
after calling this method.

Change-Id: I963bc5f97b653e2bb912f4b95b09a4d1ee201e7f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-09-17 09:55:11 +02:00
Craig Scott
d47278fd09 Ensure _qt_is_android_executable is set for internal executables too
The _qt_is_android_executable property is normally set by the
_qt_internal_create_executable() command. But various other internal
commands don't route through that and go through
qt_internal_add_executable() instead. The former is used only by the
public API, the latter only by the internal API. Refactor both so that
the internal one calls the public one. This ensures all targets receive
the same base settings, including the _qt_is_android_executable
property.

Fixes: QTBUG-96085
Pick-to: 6.2
Change-Id: I157356872c9d942d7be5f1abbbcbac97961b1f40
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-09-17 13:57:27 +10:00
Laszlo Agocs
eda1276f80 rhi: document serializedLayoutDescription
The docs are internal still but won't hurt to keep them up-to-date.
At the same time, enhance the QRhiRenderPassDescriptor
serializedFormat() docs as well, with appropriate notes about the
intended usage of the "serialized" data.

Pick-to: 6.2
Change-Id: I8425fff625903468621e3b09d089b345fada85f4
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2021-09-16 22:58:22 +02:00
Laszlo Agocs
43a42fa196 rhi: Allow testing renderpass compatibility without the objects
Follow what has been done for QRhiShaderResourceBindings. Have a way
to retrieve an opaque blob (that just happens to be a list of integers)
so that a simple == comparison can be used to determine compatibility
even when the objects from which the blob was retrieved are no longer
alive.

The contract is the following:

bool a = rp1->isCompatible(rp2);
bool b = rp1->serializedFormat() == rp2->serializedFormat();
assert(a == b);

Pick-to: 6.2
Change-Id: I45e7d05eeb6dfa2b2de474da0a0644912aaf174a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2021-09-16 22:58:17 +02:00
Laszlo Agocs
c5a3cabce0 rhi: Note in the docs that texture copies expect a matching format
Pick-to: 6.2
Change-Id: I0a1fb042ec2a3983ffbd146ff9bdc9af20134fa5
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2021-09-16 22:58:11 +02:00
Waqar Ahmed
b21403992e QTextDocumentLayout: remove multiple calls to lineHeightType
Get LineHeightType once and reuse the value. There still are 2 calls
to lineHeightType from inside the QTextBlockFormat::lineHeight but
leaving them cause they need a bigger change.

Change-Id: I4016a5e483a0358d43f73d174a74545d4f3be338
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2021-09-16 20:30:04 +05:00
Kai Köhne
643b58a429 Rewrite Qt Resource System overview
Restructure the Qt Resource System page to make the content more
accessible, and coherent:
- Focus less on the .qrc file format, but the overall use cases
- Treat CMake as first-class citizen
- Make it more obvious when to use :/, and when qrc:/

Some details that were deemed unnecessary were removed:
- details about the internal naming of the .cpp file when
  qmake is used.
- References to QDir::addSearchPath() and the search path list were
  removed. They relate IMO only indirectly to the Qt resource system.
- A lot of the explanation around Q_INIT_RESOURCE/Q_CLEANUP_RESOURCE
  were dubious at best.

Pick-to: 6.2 6.2.0
Fixes: QTBUG-95126
Fixes: QTBUG-94977
Fixes: QTBUG-59394
Task-number: QTBUG-88044
Change-Id: I04b64f2366631b2106f047de121daf5fdb01073d
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2021-09-16 15:30:04 +00:00
Laszlo Agocs
d55a6891d1 rhi: gl: Have a way to state GL_TEXTURE_RECTANGLE is wanted
Added specifically to support the deprecated CVOpenGLTextureCache on
macOS, because Qt Multimedia still needs a way to use that when the
applications requests using OpenGL instead of Metal.

Follow what we did for GL_TEXTURE_EXTERNAL_OES, and add a flag that
simply makes all our glBindTexture calls use the
GL_TEXTURE_RECTANGLE[_ARB] target.

Pick-to: 6.2
Change-Id: If818b13a9f520cdb8bdc16de84a3ca0e18ad6c33
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-09-16 17:04:35 +02:00
Luca Di Sera
10eedd175e Doc: Centralize RFC documentation-links in rfc.qdoc
In the effort of repairing broken links as per QTBUG-96127,
a series of RFC links referring to `tools.ietf.org/html/*` were modified
to point to the new address that the site redirected to.

To simplify executing a similar task and to diminish the duplication of
manually inserted urls, the already existing `rfc.qdoc` file, containing
`\externalpage` commands directing to RFC locations, was enhanced with
links to all RFCs that were mentioned in the current documentation, so
as to aggregate this common category of links.

All links pointing to a `ietf` domain inside QDoc documentation blocks
were then changed to use the newly provided external-references.

Task-number: QTBUG-96127
Pick-to: 6.2
Change-Id: I2a52eb6aa8c9e346f64ef1a627b039220d9f6c2a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-09-16 15:52:27 +02:00
Tor Arne Vestbø
0246bfd40a Close QDialog via QWidget::close()
By going via QWidget::close() we ensure that if there's a QWidgetWindow
backing the dialog (which is almost always the case), we will plumb down
to QWindow::close(), resulting in QEvent::Close events to the QWindow.

Since we don't want QDialog subclasses to receive a call to a closeEvent
override that they didn't receive before (and which they might interpret
as rejection or cancellation), install a temporary event filter that
eats the QCloseEvent resulting from the call to close().

Task-number: QTBUG-53286
Change-Id: Ie8f6f0cb3160acfd5865dc74f0a7b6d87f838724
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-16 14:24:00 +02:00
Tor Arne Vestbø
8aa1fc6f12 testlib: Gracefully handle messages outside of test function in JUnit reporter
Fixes: QTBUG-96543
Task-number: COIN-755
Pick-to: 6.2
Change-Id: I2334597319f3595f37f48c9811f667e57b99df28
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-09-16 11:22:50 +02:00
Tor Arne Vestbø
bedc588698 Always reset close-status of QWidget when trying to close
Move the status setting and resetting back into handleClose so that we
don't end up with it being set if handleClose is never called in response
to a close attempt. This can happen when QWindow's platform window has
already been destroyed.

Since QWindow::close handles that case gracefully and returns true,
we can safely call it multiple times.

Add test coverage to verify that we get exactly those close event
calls that we want.

Change-Id: Ica77bf17c26d923c3b79b1e5a688addbc88a6277
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-09-15 18:53:57 +02:00
Morten Johan Sørvig
83419fb8a3 macOS: convert mask region to native geometry
QWindow::mask() returns a region in device independent
geometry which can’t be used directly by the platform
plugin.

Pick-to: 6.2 5.15
Task-number: QTBUG-94770
Change-Id: I76279bc74cfabe315178327938f485f4447568be
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-15 16:19:39 +00:00
Volker Hilsheimer
b020ec6ada macOS: don't block CMD+H while a popup is open
The shortcut hides the application, which works in native apps such as
Xcode or Safari also while a popup menu (or combobox drop down) is open.

This essentially reverts 29104c85db, which
introduced the blocking of CMD+H to prevent the popup stack in the Cocoa
plugin from going out of sync. With that stack gone after the previous
commits, this is no longer a problem.

Task-number: QTBUG-82626
Task-number: QTBUG-96450
Task-number: QTBUG-58727
Pick-to: 6.2
Change-Id: I35603d971741f03b793b7839b183b7ab37200647
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-15 17:49:35 +02:00
Volker Hilsheimer
65c9acc5f5 macOS: remove the popup stack from QCocoaIntegration
Since popup handling is now done exclusively by Q(Gui)Application, we
don't need to keep track of the popup stack in the Cocoa plugin anymore.

Fixes: QTBUG-96450
Change-Id: I869f36f52bc2210b6c92efd9425502de4122c553
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-15 17:49:35 +02:00
Volker Hilsheimer
1e5249bfa4 macOS: remove mouse and key grabbing logic from Cocoa plugin
For QGuiApplication with QWindow, no other QPA plugins do
so, and for QApplication with QWidgets, QApplication implements popup
functionality consistently.

Task-number: QTBUG-96450
Change-Id: I47489296e0e470d8948ca7858d0a2608c58b2975
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-15 17:49:35 +02:00
Volker Hilsheimer
a6279b74e2 macOS: Remove duplicate code closing popups on window interaction
After 70b94eea10, all popups are closed
on mouseDown within the window frame. As with native applications, the
popup is closed on press, and before the press is delivered to the frame
(ie before the jewel is shown as depressed).

The previous notification handlers for window moving, minimizing, and
closing can now be removed, together with the alternative implementation
of closePopups that relies on the Cocoa plugin maintaining its own
popup stack.

This reverts 048e66a11d.

Task-number: QTBUG-96450
Task-number: QTBUG-77833
Change-Id: I165f3caa64bf9a7b4c4d5455ca33e87029d75f73
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-15 17:49:34 +02:00
Volker Hilsheimer
6880b6319c macOS: Use QGuiApplication popup APIs in Cocoa plugin
This removes more dependencies to the Cocoa plugin managing its own
popup stack.

Task-number: QTBUG-96450
Change-Id: Id01577739af525a34728f27b790b9aaac29705f2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-15 17:49:34 +02:00
Volker Hilsheimer
276943c8b7 Make the closeAllPopup helper virtual in QGuiApplication
QPA plugins might have to close popups for events that are not delivered
to QWindow or QWidget instances. For instance, the Cocoa plugin has to
explicilty close popups when the user clicks into the window frame.

Expose this functionality through a virtual in QGuiApplicationPrivate,
and move the QApplication implementation from a static helper into the
override.

Task-number: QTBUG-96450
Change-Id: I52be5710c8d7515b9ae2e4bbadb069df4b3ed546
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-15 17:49:34 +02:00
Tor Arne Vestbø
62b658ee8e doc: use \note in QKeyEvent documentation
Pick-to: 6.2
Change-Id: I0924f5a540ab5e58f7830c1af099ce6e44287811
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-09-15 17:49:34 +02:00
Craig Scott
4f96af37b2 Allow finalizers to be delayed to later in the same directory scope
Deferred CMake calls are executed in the order they are created.
Sometimes, a deferred call created after a call to qt_add_executable()
or qt_add_library() needs to be executed before target finalization.
For example, a file may be written using a deferred write, but the
finalizers might need that file to exist.

Provide an internal _qt_internal_delay_finalization_until_after()
command that can be called to let finalization know it has to defer
to later. Target finalizers will check an internal property for IDs
recorded by that command and will re-defer itself if it detects that
any of those haven't run yet.

Task-number: QTBUG-96290
Pick-to: 6.2
Change-Id: Ia791e99339bab351eff0d675a552393e524490e8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-09-16 01:31:35 +10:00
Tor Arne Vestbø
2f6d572dad macOS: Compute NSWindow background color without checking styleMask
The check for styleMask == NSWindowStyleMaskBorderless to decide whether
to clear the NSWindow background was broken, as NSWindowStyleMaskBorderless
has the value 0, but is only supposed to be compared to its companion
NSWindowStyleMaskTitled (with value 1). A window can perfectly well be
NSWindowStyleMaskBorderless and NSWindowStyleMaskMiniaturizable e.g.,
so by comparing directly to NSWindowStyleMaskBorderless instead of
masking to the first bit first we ended up making miniaturizable
windows non-translucent.

We now check the Qt::FramelessWindowHint directly, and also whether
the window is opaque. Ideally we'd have QWindow flags that could
plumb WA_NoSystemBackground from Qt Widgets, as well as a background
color property on QWindow to control the system background, but
in the meantime we'll have to use the FramelessWindowHint heuristic.

The QWidget docs have been updated to reflect this.

Task-number: QTBUG-95042
Pick-to: 6.2
Change-Id: I0d40eecace60883c205ebb8c76cef1092cdf1144
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-09-15 17:06:10 +02:00
Morten Johan Sørvig
088b364e4b QEventDispatcherWasm: handle EventLoopExec
Call emscripten_set_main_loop like the old GUI event
dispatcher did, with one difference that requestAnimationFrame
updates are now no longer handled by the event dispatcher.

Change-Id: If02d90ae9c45d7b38999567d733a237af842cded
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-15 17:06:10 +02:00
Morten Sørvig
46039092bd Use QHighDpi::toNativeWindowGeometry()
This function implements the isTopLevel() logic, which
we now don’t have to duplicate at each call site.

Change-Id: Ic8b857aa7cd3c3c23d5e950d9f50b66c81ba3ccf
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-15 14:23:03 +00:00
Ievgenii Meshcheriakov
1afd562b0b QThreadPool: Fix restarting of expired threads
Ensure that expired threads have actually finished before attempting
to restart them. Calling start() on a thread that is not yet finished
does nothing.

Add a regression test into tst_qthreadpool that attempts to trigger
reuse of expired threads and verifies that all submitted tasks
execute.

Fixes: QTBUG-72872
Pick-to: 6.2
Change-Id: I2109b628b8a4e91491115dc56aebf3eb249646b5
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-09-15 15:46:53 +02:00
Ivan Solovev
797039eb20 qlocale_mac: make sure that helper functions return QVariant
QLocale treats a null QVariant returned from the QSystemLocale::query()
as a signal to fall back to CLDR implementation.
In Qt 5 QVariant(QString()).isNull() was returning true, so we could
easily return an empty QString() to fall back to CLDR.
In Qt 6 the QVariant() behavior has changed.
This patch makes sure that all the helper methods in macOS system locale
implementation return a null QVariant() when they fail to provide any
reasonable value.

Task-number: QTBUG-84877
Pick-to: 6.2
Change-Id: I85be3b1463b1366f737e912c99bc11e37af98c62
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-15 10:30:08 +02:00
Ivan Solovev
cc22857d1e QAndroidSystemLocale: add missing day and month format handling
This patch adds support for previously missing Narrow format, as well
as standalone day name handling for QAndroidSystemLocale

Task-number: QTBUG-84877
Pick-to: 6.2
Change-Id: Ib74fb8f0e12f03ab96022abaf26ac9039ffaa60b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-09-15 10:30:01 +02:00
Ivan Solovev
61343b5a3f Teach QLocale::system() to use narrow format
QLocale::system() was not making use of QLocaleFormat::Narrow, always
treating it in the same way as QLocaleFormat::Short.
This patch fixes the issue for day and month names.

The implementation falls back to CLDR if system locale fails to
provide some data.

Pick-to: 6.2
Task-number: QTBUG-84877
Change-Id: Ia37e59dbf02d7a5e230f2767d294b9ab7de37f33
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-09-15 10:29:55 +02:00
Ivan Solovev
05d336620c Fix system locale instantiation
Construction of the static QLocalePrivate called defaultIndex()
and systemData() in an implementation-dependent order, but
defaultIndex() needs to be called after systemData().
So move the systemData() call that's used to ensure it all stays
up to date to before the static initializer.

Pick-to: 6.2
Change-Id: I801b678c01b4e4ddd4de16e9aead7167ec4477f3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-09-15 10:29:50 +02:00
Thiago Macieira
21dd9b96a5 QElfParser: stop trying to look into the .rodata section
The return code NoQtSection was not being handled at all, so hasMetaData
remained equal to false. This was probably not intended, but has been
like that since Qt 5.0. See previous commit for details.

Change-Id: I42eb903a916645db9900fffd16a4445eff9a082c
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-09-14 12:25:54 -07:00
Thiago Macieira
42ec48d819 QPlugin: make the macros match the scanning code for ELF systems
For ELF platforms with a GCC-compatible compiler, the QElfParser has
been ignoring the .rodata section ever since Qt 5.0 commit
7443895857 ("Remove support for Qt 4 style
plugins"). That change removed handling of return value
QElfParser::NoQtSection from the ELF parser, which meant that the
plugins without a .qtmetadata section were never considered plugins. In
other words, for those systems, the __attribute__ macro is mandatory.

For systems with a GCC-incompatible compiler, there were only two in Qt
5.x's lifetime: Oracle/Sun Solaris with SunCC and IBM AIX with IBM xlC
compiler. Neither compiler supports C++17 according to [1], so they
can't be in use in Qt 6. IBM xlC now comes with a Clang-based front-end
for users who need Qt 6 and the OpenIndiana distribution of Open Source
Solaris has been using GCC since 2012.

So make the macros mandatory from now on.

[1] https://en.cppreference.com/w/cpp/compiler_support#C.2B.2B17_features

Change-Id: I42eb903a916645db9900fffd16a443745446cc64
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-09-14 12:25:54 -07:00
Thiago Macieira
de9d7b0b25 QElfParser: remove one more unnecesary variable from the ELF parser
There's no need to keep this variable in the class.

Pick-to: 6.2
Change-Id: I2de1b4dfacd443148279fffd16a35775d56d3e45
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-09-14 12:25:54 -07:00
Thiago Macieira
33a870afae QElfParser: don't attempt to parse ELF files of the wrong endianness
There's no sense in continuing to parse. We'll never be able to load
such a plugin anyway. This simplifies the code generation a lot because
now all the read<T> calls become unconditional qFromUnaligned<T>, which
is just a memcpy(), which for primitive types the compiler will simply
emit a memory load into a register.

Task-number: QTBUG-96327
Pick-to: 6.2
Change-Id: I2de1b4dfacd443148279fffd16a3574daf010635
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-09-14 12:25:54 -07:00