Commit Graph

53178 Commits

Author SHA1 Message Date
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
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
Alexandru Croitor
d470497d9a CMake: Make standalone tests TestsConfig file repo-target-set specific
Conan CI builds can built a qt repository in a repo-target-set
configuration. An example of that is qtscxml.

When building standalone tests, qt_build_tests includes a repo
specific TestsConfig.cmake file to call find_package on the modules
that were built as part of that repo.

That doesn't quite work with a repo-target-set build which is enabled
when the repo is built with a QT_BUILD_SINGLE_REPO_TARGET_SET value.

The TestsConfig.cmake file would be overridden with different contents
on each configuration.

Fix that by including the QT_BUILD_SINGLE_REPO_TARGET_SET value as
part of the TestsConfig.cmake file to be generated and included.

This means that when configuring the standalone tests, the same
QT_BUILD_SINGLE_REPO_TARGET_SET value should be passed, so that the
correct packages are found.

Add some debug statements to allow checking which TestsConfig.cmake
file is loaded when the standalone tests are configured with
--log-level=DEBUG.

Adjusts to 4b09522c23
Amends de3a806def
Amends e7f188b2d2

Pick-to: 6.2
Task-number: QTBUG-96253
Change-Id: I7c22aaad88fe8e6fce23046543363316203f6e8d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-09-16 20:59:35 +02:00
Pasi Petäjäjärvi
5f3e8dde95 Support QNX QCC compiler
tests/auto/tools/moc/CMakeFiles/tst_moc.dir/tst_moc.cpp.o: in function `tst_Moc::os9Newline()':
qtbase/tests/auto/tools/moc/tst_moc.cpp:1225: undefined reference to `Os9Newlines::staticMetaObject'
tests/auto/tools/moc/CMakeFiles/tst_moc.dir/tst_moc.cpp.o: in function `tst_Moc::winNewline()':
qtbase/tests/auto/tools/moc/tst_moc.cpp:1239: undefined reference to `WinNewlines::staticMetaObject'

Pick-to: 6.2
Change-Id: I629d67c1190e09b26dc09e41cb7170cb0eadf1cb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-09-16 20:54:17 +03:00
Tor Arne Vestbø
8dd14a956c Revert "coin: Generate JUnit result files"
This reverts commit c7ddaa9f58.

Reason for revert: Broke integrations

Change-Id: I21ffb3b16e361a48a5d9b7a528d150e51519623c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-16 17:02:44 +00: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
Alexey Edelev
040258b260 Add missing private cpp exports template to install set
Add missing modulecppexports_p.h.in template to install set.

Amends e1fe816d46

Task-number: QTBUG-90492
Change-Id: I25db6f98637bd33a1c56f6b098ac76c4292de581
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-09-16 11:17:41 +02:00
Alexey Edelev
a7458b2503 Expose cpp export related arguments for qt_internal_add_module users
Functions that use qt_internal_add_module under the hood might need to
generate cpp exports, e.g. qt_internal_add_qml_module. Append cpp
exports related arguments to the qt_internal_add_module arguments set.

Task-number: QTBUG-90492
Change-Id: I4fd539bd1d8be4d3e57ed5b1b88dd2dbc2f5ca24
Reviewed-by: Craig Scott <craig.scott@qt.io>
2021-09-16 11:15:53 +02:00
Ievgenii Meshcheriakov
8be862687d unicode: Fix typo s/supersting/superstring/
Thanks to Konstantin Ritt for spotting it.

Change-Id: Ia3b5c4103b315cdb690fcd8b42239f000acdbef0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-09-15 21:58:12 +02:00
Luca Di Sera
e3d16b984a Doc: Repair broken link to the Netscape Cookie Specification
The link was replaced with an equivalent one from the Internet Archive's
Wayback Machine, as it is the one used in
RFC-6265 (https://datatracker.ietf.org/doc/html/rfc6265#ref-Netscape) to
deliver the same information.

Task-number: QTBUG-96127
Pick-to: 6.2
Change-Id: I3d8b7ac511e040c1b4651b59ddedfa580c45ce90
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-09-15 20:13:38 +02:00
Luca Di Sera
d32f7dde25 Doc: Update \externalpage links for RFC
The `rfc.qdoc` file was modified to order the external RFC link by RFC
number.

Furthermore, the links were modified to use the `datatracker.ietf.org`
domain to be consistent with the recent changes to the old
`tools.ietf.org` links.

Task-number: QTBUG-96127
Pick-to: 6.2
Change-Id: I865e7ea131264d0b123f34d796b7ec8007931adc
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-09-15 17:42:39 +00: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
Tor Arne Vestbø
5c880e30c7 Don't let windowstates manual test eat log messages
Having logging in the test's log widget is nice, but we don't want
to silence the normal logging, as that might confuse someone who
expects to see normal log messages, not knowing there's a dedicated
log widget in the test.

Pick-to: 6.2
Change-Id: I7828f740cfb8cc2eae8da98b9b8facd4a57fa37b
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@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
Thiago Macieira
a8083ff47a Q_DECLARE_INTERFACE: rework to use more inline functions
That way, we can add the NOLINTNEXTLINE comment to suppress clang-tidy,
which otherwise flags all usage of const_cast in C++ code.

Change-Id: Ie72b0dd0fbe84d2caae0fffd16a247b96d223772
Reviewed-by: Rui Oliveira
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-09-14 19:25:54 +00:00
Tatiana Borisova
4f2a515f12 Fix Catch2 compiling for INTEGRITY
- Exclude Green Hills compiler from Catch2's POSIX signal handling.
  GHS, at least on INTEGRITY, doesn't support full POSIX signals.

Task-number: QTBUG-96176
Pick-to: 6.2 6.2.0
Change-Id: Ifec06dca43ed766cb7335e40fc357d0d7bc463a6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-09-14 21:18:07 +03:00
Ievgenii Meshcheriakov
884e5c2c75 QDataStream: Add reminders to remove operators for qfloat16
Having I/O operators defined for incomplete types causes hard
to diagnose problems when types with template conversion
operators are used as arguments to signals or slots.

Removing qfloat16 operators is not possible before Qt 7
because of backward compatibility.

Task-number: QTBUG-93499
Change-Id: Ifa296bb58c45a06abf79dbe5666a666adaa8eab9
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-09-14 15:08:58 +00:00
Shawn Rutledge
9ecce4dff4 Adjust src/corelib/serialization/qdatastream.[h/cpp] for 6.3.0
Change-Id: I9809d6122c6d3c5ad5753d52679f4ac67a17e3d4
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2021-09-14 11:08:30 +00:00