Commit Graph

53223 Commits

Author SHA1 Message Date
Volker Hilsheimer
8fcfd7f591 Eat expected warning messages in QGuiApplication test
Verifies that we get the messages we want, and makes it easier to see
relevant debug output.

Pick-to: 6.2
Change-Id: Ide92959b120f325badbf200236cdc85f72226e1e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-20 19:00:05 +02:00
Alexey Edelev
2483931e25 Add missing framework paths to header check targets
CMake doesn't add framework include paths for the includes if
add_custom_command is used. When all Qt modules are installed to a
single directory, frameworks could be found under
QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX, but for Conan builds
each module is installed to the separate directory. These directories
need to be listed in the QT_ADDITIONAL_PACKAGES_PREFIX_PATH variables
family. This takes into account directories that are listed in the
QT_ADDITIONAL_PACKAGES_PREFIX_PATH variables and considers they
can contain frameworks.

Pick-to: 6.2
Fixes: QTBUG-96511
Change-Id: I664381df4859a2e85c399cd94dc2f3996e452c03
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-09-20 17:54:12 +02: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
Assam Boudjelthia
e6892f38a0 Android: Fix path of qmake_qmake_immediate.qrc in single_abi with qmake
With single_android_abi, the file qmake_qmake_immediate.qrc is laid
directly into the root of the build dir and not under different abis
dirs.

Pick-to: 6.2.0 6.2 5.15
Fixes: QTBUG-87669
Fixes: QTBUG-95202
Fixes: QTBUG-95235
Change-Id: Ie13cccdf2fc323e8fd725a94f3aacab465fa1287
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2021-09-20 13:05:36 +00: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
Dimitrios Apostolou
a5d501000e Blacklist flaky test
Task-number: QTBUG-96270
Pick-to: 6.2 5.15
Change-Id: I3feb604c0c2f394b2915b3d98d3b02f469331a18
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-09-20 15:05:36 +02:00
Allan Sandfeld Jensen
129dae5dbd Pass CMAKE compiler flags to arch detection
This fixes the detection of always available architecture based on
user set CMAKE flags.

Change-Id: I541ac9569766a0fe05f4395c06f2ee3bcd77b035
Fixes: QTBUG-91090
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-09-20 13:19:02 +02:00
Craig Scott
46438c91f7 Fix main() not being visible on Android
A recent change refactored the call to qt_internal_add_executable(),
but that had the unintended side-effect of changing the symbol
visibility from public to hidden. That meant that main() became hidden,
so while apps still built successfully, they could not be run. Restore
the original symbol visibility to fix this regression.

Amends d47278fd09

Pick-to: 6.2
Change-Id: I27d84ab2b0dd013d5c38dcfe55e88f307c4bc5dd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-09-20 21:19:02 +10: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
0d3b395c16 tests/xcb: add a test for screen off and on
Task-number: QTBUG-96247
Change-Id: I1fd6f21ad914480b7e8d07227ee80184e305276a
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-09-18 16:29:39 +02:00
Liang Qi
b6bcf01b81 tests/xcb: move xrandr process call to a function
Change-Id: I4dab0a878a93fa2c3d0af80883b8e2198c72633c
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-09-18 16:29:39 +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
Volker Hilsheimer
c763957503 Activate test of enter event delivery on macOS
The test passes consistently in local test runs on macOS 10.15.

Change-Id: I6f05b27d3cbf930475a435c41db267a00b1726b0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-17 18:23:02 +02: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
Craig Scott
b57f7f07cf Remove unused EXE_FLAGS option from qt_internal_add_executable()
The EXE_FLAGS option wasn't being used anywhere in any Qt repo
and it had no documentation as to its intended use. Remove it.

Pick-to: 6.2
Change-Id: I2f67ec57c1da7dc6eab81d5351361e770d19d7d5
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-09-18 01:54:08 +10:00
Craig Scott
c780708bd3 Remove TODOs related to checking CMake 3.21 features post-release
These TODOs were left as a marker to be checked once the official
CMake 3.21.0 release was made. The things they refer to were included
in the CMake 3.21.0 release, so the TODOs can be removed.

Fixes: QTBUG-94528
Pick-to: 6.2
Change-Id: I769605de85df657ad056123e787ec9849b77e42f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-09-18 01:54:08 +10: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
Dimitrios Apostolou
c7e0a1a966 Fix flaky test timing out sometimes while waiting for data
The test used to hang on waitForRead(), sometimes, which underneath
involve a poll()+read() syscall pair.
When this happened, the IMAP data came together with the proxy data on a
previous poll()+read() call and the proxy code had already consumed it.

We now wait for data only if data is not already available.

Fixes: QTBUG-96345
Pick-to: 6.2
Change-Id: I084f5d1268a5091ea614fcec91c8d356dcb90d9f
Reviewed-by: Mårten Nordheim <marten.nordheim@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
Venugopal Shivashankar
7d475a8656 Doc: Fix broken links
Task-number: QTBUG-96569
Pick-to: 6.2 6.2.0
Change-Id: If7e951c3df72a87a04e802a5eadbc01c4d934765
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2021-09-17 13:01:46 +00: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
Alexey Edelev
2f1d6e4c3f Do not generate cpp exports for pure STATIC modules
Static libraries don't need to export their symbols, and corner cases
when sources are also used in shared libraries, should be handled
manually.

Task-number: QTBUG-90492
Change-Id: I5cb0a3f7e280b042b678bdbe4475f2bbf9f6b9ba
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-09-17 13:57:17 +02:00
Alexey Edelev
f16c8fdf18 Add explicit install rules for the autogenerated cpp exports
If qt_internal_generate_cpp_global_exports is called outside the
qt_internall_add_module function scope, install rule that is
generated by qt_internall_add_module won't include generated
cpp export header files. This adds the explicit file-based install
rule for the generated cpp exports.
Since qt_internal_generate_cpp_global_exports now encapsulates all
install rules related to the generated cpp exports, no need to expose
the generated filenames outside the function.

It's expected that module public headers now could be added outside
the qt_internal_add_module function. Tune generating of the module
timestamp by replacing the DEPENDS value with generator expression.

Task-number: QTBUG-90492
Change-Id: I0f086abc8187c5d51117c3a75c47b58580f6913f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-09-17 13:57:17 +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
Edward Welbourne
cbd33cb557 Add missing dependencies of tests on their helper programs
This ensures that a command such as

  $ ninja tst_qlocale && ninja tst_qlocale_check

will automagically build the syslocaleapp program that the test runs
from a subtest. Similar for testlib's selftests and tst_QProcess.

As a drive-by, pruned some legacy comments from when CMakeLists.txt
files were generated from .pro files.

Change-Id: I67691a8175aaef124d4104cf1898193993408bdf
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-09-17 12:57:25 +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