summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Switch a comma operator to a IILEGiuseppe D'Angelo2021-09-191-1/+1
| | | | | | | | | 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>
* QProcess: do not emit aboutToClose() twiceAlex Trotsenko2021-09-191-1/+0
| | | | | | | | | 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>
* High resolution wheel-event support from libinputAllan Sandfeld Jensen2021-09-183-2/+40
| | | | | | | | | | | | 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>
* macOS: Remove remnant of popup closing logic from Cocoa pluginVolker Hilsheimer2021-09-182-30/+0
| | | | | | | | 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>
* xcb: convert last screen to fake when no screenLiang Qi2021-09-183-17/+57
| | | | | | | | | | | | | | | | | available for xrandr 1.5 like we did before for xrandr 1.4 (since a094af001795c9651b299d700a992150d1aba33a). 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>
* Q{LocalSocket|Process}/Win: handle write errorsAlex Trotsenko2021-09-186-0/+24
| | | | | | | | | 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>
* CMake: Add option in qt6_wrap_cpp to output a metatypes json fileAlexandru Croitor2021-09-181-5/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* QWindowsPipeWriter: do not clear the buffer in thread pool callbackAlex Trotsenko2021-09-184-50/+90
| | | | | | | | | | | | | | | | | 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>
* QIconLoader: code tidiesGiuseppe D'Angelo2021-09-182-43/+32
| | | | | | | | | | | | | | | | | | 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>
* Fix QTextEdit cursor rectangle vertical positioningZhang Hao2021-09-181-2/+5
| | | | | | | | | | | | | | | 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 e99a883bd382ca950192bd66cafb2a1de6394ce7 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>
* Fix name used for qmath.h in an includeEdward Welbourne2021-09-171-2/+2
| | | | | | Pick-to: 6.2 Change-Id: I9be8d4cc33d75a806a1ecf9950d7bac330abe9ea Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QVersionNumber: fix iterator/pointer mistakeGiuseppe D'Angelo2021-09-171-6/+6
| | | | | | | | | | | | 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>
* Doc: Add version and description to Qt-DBus documentationKai Köhne2021-09-171-1/+3
| | | | | | | | 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>
* Remove conditioning on Android embeddedEdward Welbourne2021-09-1718-51/+50
| | | | | | | | It is no longer handled separately from Android. This effectively reverts commit 6d50f746fe05a7008b63818e77784dd0c99270a1 Change-Id: Ic2d75b8c5a09895810913311ab2fe3355d4d2983 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* QCoreApplication: enforce non-null arguments when sending/posting eventsGiuseppe D'Angelo2021-09-171-5/+18
| | | | | | | | | | | | | | | | | | 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>
* android: Implement nativeResourceForContextLaszlo Agocs2021-09-172-0/+14
| | | | | | | | | | | | | | | | | | 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>
* rhi: vulkan: Reset state more aggressivelyLaszlo Agocs2021-09-171-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | ...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>
* Fix loading of OpenSSL on macOS versions that ship its own OpenSSLTor Arne Vestbø2021-09-171-0/+5
| | | | | | | | | | | 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>
* Deduplicate maybeQuitOnLastWindowClosed handlingTor Arne Vestbø2021-09-177-68/+82
| | | | | | | | | | | | | | | | | | 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>
* Fix QGuiApplication command line options documentation for X11Tor Arne Vestbø2021-09-171-3/+3
| | | | | | | Fixes: QTBUG-96600 Pick-to: 6.2 5.15 Change-Id: Ic3670b952d97270cce4f0a8df8bba79e934e4a6d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Revert "Qt xcb: remove false detects of Qt::GroupSwitchModifier"Liang Qi2021-09-171-3/+3
| | | | | | | | | | | | | | | | | This reverts commit 25a7034d78aeb12726a1052d64c0aa3314a1f69d. 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>
* macOS: Use new QPlatformTheme::appearance() functionMitch Curtis2021-09-171-20/+21
| | | | | | | | Instead of qt_mac_applicationIsInDarkMode(). Task-number: QTBUG-94859 Change-Id: Ib64c081adfafb2843a7593d0e35668cce70cffd0 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Add QPlatformTheme::Appearance for detecting light/dark modesMitch Curtis2021-09-176-0/+27
| | | | | | | | | 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>
* Don't unload libraries on Darwin-based operating systemsTor Arne Vestbø2021-09-171-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Introduce QDoubleValidator::fixup()Ivan Solovev2021-09-173-2/+108
| | | | | | | | | | | | | 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>
* Ensure _qt_is_android_executable is set for internal executables tooCraig Scott2021-09-171-1/+1
| | | | | | | | | | | | | | | | | 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>
* rhi: document serializedLayoutDescriptionLaszlo Agocs2021-09-161-4/+31
| | | | | | | | | | | 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>
* rhi: Allow testing renderpass compatibility without the objectsLaszlo Agocs2021-09-1612-1/+121
| | | | | | | | | | | | | | | | | | | 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>
* rhi: Note in the docs that texture copies expect a matching formatLaszlo Agocs2021-09-161-0/+5
| | | | | | Pick-to: 6.2 Change-Id: I0a1fb042ec2a3983ffbd146ff9bdc9af20134fa5 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* QTextDocumentLayout: remove multiple calls to lineHeightTypeWaqar Ahmed2021-09-161-5/+7
| | | | | | | | | | 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>
* Rewrite Qt Resource System overviewKai Köhne2021-09-1612-178/+332
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* rhi: gl: Have a way to state GL_TEXTURE_RECTANGLE is wantedLaszlo Agocs2021-09-163-1/+15
| | | | | | | | | | | | | | 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>
* Doc: Centralize RFC documentation-links in rfc.qdocLuca Di Sera2021-09-1620-43/+36
| | | | | | | | | | | | | | | | | | | | 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>
* Close QDialog via QWidget::close()Tor Arne Vestbø2021-09-163-8/+27
| | | | | | | | | | | | | | | 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>
* testlib: Gracefully handle messages outside of test function in JUnit reporterTor Arne Vestbø2021-09-161-0/+3
| | | | | | | | Fixes: QTBUG-96543 Task-number: COIN-755 Pick-to: 6.2 Change-Id: I2334597319f3595f37f48c9811f667e57b99df28 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Always reset close-status of QWidget when trying to closeTor Arne Vestbø2021-09-151-5/+7
| | | | | | | | | | | | | | | | | 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>
* macOS: convert mask region to native geometryMorten Johan Sørvig2021-09-152-2/+3
| | | | | | | | | | | 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>
* macOS: don't block CMD+H while a popup is openVolker Hilsheimer2021-09-151-7/+2
| | | | | | | | | | | | | | | | | 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 29104c85db53e7c0c0aaf3fe78f84b737fce4886, 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>
* macOS: remove the popup stack from QCocoaIntegrationVolker Hilsheimer2021-09-155-77/+2
| | | | | | | | | 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>
* macOS: remove mouse and key grabbing logic from Cocoa pluginVolker Hilsheimer2021-09-152-15/+0
| | | | | | | | | | 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>
* macOS: Remove duplicate code closing popups on window interactionVolker Hilsheimer2021-09-154-36/+0
| | | | | | | | | | | | | | | | | | | After 70b94eea10d7af83cced09296755a8af28e167b5, 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 048e66a11d87845eaba9e8cf23de3fb4acac924d. Task-number: QTBUG-96450 Task-number: QTBUG-77833 Change-Id: I165f3caa64bf9a7b4c4d5455ca33e87029d75f73 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* macOS: Use QGuiApplication popup APIs in Cocoa pluginVolker Hilsheimer2021-09-151-4/+3
| | | | | | | | | 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>
* Make the closeAllPopup helper virtual in QGuiApplicationVolker Hilsheimer2021-09-153-11/+14
| | | | | | | | | | | | | | 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>
* doc: use \note in QKeyEvent documentationTor Arne Vestbø2021-09-151-8/+8
| | | | | | Pick-to: 6.2 Change-Id: I0924f5a540ab5e58f7830c1af099ce6e44287811 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Allow finalizers to be delayed to later in the same directory scopeCraig Scott2021-09-161-0/+27
| | | | | | | | | | | | | | | | | | | | 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>
* macOS: Compute NSWindow background color without checking styleMaskTor Arne Vestbø2021-09-153-6/+16
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* QEventDispatcherWasm: handle EventLoopExecMorten Johan Sørvig2021-09-152-0/+19
| | | | | | | | | 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>
* Use QHighDpi::toNativeWindowGeometry()Morten Sørvig2021-09-151-7/+1
| | | | | | | | | 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>
* QThreadPool: Fix restarting of expired threadsIevgenii Meshcheriakov2021-09-151-0/+5
| | | | | | | | | | | | | | | | 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>
* qlocale_mac: make sure that helper functions return QVariantIvan Solovev2021-09-151-25/+25
| | | | | | | | | | | | | | | | | | 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>