summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qapplication.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Windows 11 style: simplify code to polish paletteVolker Hilsheimer26 hours1-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | There are two cases in which we let the style polish a palette: - after merging the system palette and the style's standard palette - or when a widget-class specific palette gets set A style needs to know which colors of the palette it can safely overwrite with style-specific preferences. For that to work, we need to reset the resolve mask of the synthesized palette (first case) to 0 before polishing. Palettes set explicitly by application code will then have resolve bits set, and the polishing can respect those colors and not overwrite them. Simplify the polish() implementation then to check whether the respective color's resolve bit is set, and only overwrite it with the style's preferred color if the bit is clear. Move that logic into a macro for simplification. This amends b733d31f275d09ca81b5e347ca1e9b6c9b216cd4 and makes sure that colors that are set by the application explicitly don't get overridden by the style. Task-number: QTBUG-124490 Task-number: QTBUG-124286 Change-Id: I69e1e3da93f661ebdafee0b62adbb3d411322443 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QApplication: use focus abstraction instead of QWidget::focus_next/prevAxel Spoerl2024-03-181-2/+2
| | | | | | | | | | | Focus abstraction in QWidgetPrivate makes direct access to QWidget::focus_next and focus_prev an antipattern. Remove usage. Task-number: QTBUG-121478 Change-Id: Iaab97024c20b97a0d9850dce43816a432d4bc7a1 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Mention QChronoTimer in API docsAhmad Samir2024-03-031-2/+3
| | | | | Change-Id: Iaf9fb31994f1580b2051dbd0b1b8eef2a218aa39 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix -Wimplicit-fallthrough for clangTim Blechmann2024-03-011-0/+2
| | | | | | | | | | | | | | | | | | | Clang's `-Wimplicit-fallthrough` warnings are a little stricter than gcc's interpretation: switch (i) { case 0: foo(); case 4: break; } While gcc accepts the implicit fallthrough, if the following statement is a trivial `break`, clang will warn about it. Pick-to: 6.7 Change-Id: I38e0817f1bc034fbb552aeac21de1516edcbcbb0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QApplicationPrivate::dispatchEnterLeave: remove dead codeAxel Spoerl2024-02-291-13/+0
| | | | | | | | | Remove #ifdef 0 section added in 2011. Task-number: QTBUG-121478 Pick-to: 6.7 Change-Id: I2154cd5616e2695af89cf4fc5ec9d1b3ae5572d5 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QWidget: deliver DragLeave events symmetricallyVolker Hilsheimer2023-12-201-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | If a widget received a DragEnter event that it didn't accept, then the UnderMouse widget attribute gets set. But the drag manager never got a drag target, so the DragLeave event was never delivered, leaving the UnderMouse attribute set incorrectly. We always need to send DragLeave events to the receiver, even if the DragEnter or DragMove was not accepted. Otherwise we are not in balance, and the UnderMouse attribute will remain set. This is a change of behavior and a very old bug, so only fixing this in unreleased branches. Test case added to verify that explicitly generated drag events result in the correct enter/leave events. [ChangeLog][QtWidgets][QWidget] DragLeave events are now always sent to the widget the mouse is leaving, even if it didn't accept the DragEnter event. Fixes: QTBUG-50403 Pick-to: 6.7 Change-Id: I5eae49da000fb4fea81f1767f0e73a06a6b78975 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Make QApplicationPrivate::active_window privateTor Arne Vestbø2023-11-201-10/+4
| | | | | | | | | | The active window of QApplication overlaps largely with the focus window of QGuiApplication. As a first step towards potentially removing the active_window member, make it private so we control access to it. Task-number: QTBUG-119287 Change-Id: I95785fea3ba4444db64063f4e4d3d3004465ef64 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add missing timestamp to tablet eventsViktor Arvidsson2023-10-301-0/+1
| | | | | | | | | When copying the event for notify, timestamp was not set as it is for other input events. Pick-to: 6.5 6.6 Change-Id: I81bb89993027c902db2d1113605d6e6a0faf98f1 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Compress UpdateLater eventsAllan Sandfeld Jensen2023-09-181-0/+5
| | | | | | | | Handle UpdateLater events in QApplication::compressEvents Pick-to: 6.6 Change-Id: I0c63f88d8ed90fc56c093c534394461797d1336b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Reset palette resolve mask in windows vista styleSanthosh Kumar2023-09-051-2/+5
| | | | | | | | | | | | | | The palette set by windows vista style during polish doesn't allow style- sheet style to override it. This patch reset resolve mask for the palette set by windows vista style and thus it can be overridden. Fixes: QTBUG-115511 Pick-to: 6.6 6.5 Change-Id: Ifcaf441f806cfa0273599b3dce83fdfaec3f5a66 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Doc: Mention version of QApplication::setActiveWindow() deprecationKai Köhne2023-08-231-1/+1
| | | | | | Pick-to: 6.5 6.6 Change-Id: I7cd9be3b34a4cb7f396d175ff8137b590c2435c9 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Don't set focus when moving the cursor with a touch padVolker Hilsheimer2023-04-281-1/+2
| | | | | | | | | | | | | | | | | | | On macOS, swiping with a single finger on the track pad (which Qt identifies as a QInputDevice::DeviceType::TouchPad) results in a TouchBegin event. For widgets that accept touch events (perhaps implicitly because they want pan gestures, like QGraphicsView), this results in a TouchBegin event to be delivered. QApplication::notify will then check the widget's focus policy, and with ClickFocus set, will set focus on the widget. This is not what we want for a TouchBegin on a touch pad, so skip the setting of the focus for that device type. Pick-to: 6.5 Fixes: QTBUG-112922 Change-Id: Ie828793a784cc0e2fa47954bf5b396d6a44bd5e8 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Clear invalid QApplication styleOverrideKaj Grönholm2023-04-061-0/+2
| | | | | | | | | | | | When QStyleFactory::create() is unable to find/create an override style set with QT_STYLE_OVERRIDE or "-style", clear the styleOverride. Reason for this is that Qt Quick Controls otherwise tries to use this invalid style. Task-number: QTBUG-100563 Pick-to: 6.5 Change-Id: I48fa6c211ce27d902e2eaf90c34cb5694ad7ecfd Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Trace: Use includes instead of forward declarationsAntti Määttä2023-02-101-0/+3
| | | | | | | | | | Some platforms do not work with forward declarations, mainly android. Pick-to: 6.5 Change-Id: Ie34a30ecb8554d77c1bea4b65a752d63ba819af9 Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io> Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
* Trace: Convert qtwidgets module to use tracepointgen toolAntti Määttä2023-02-101-0/+4
| | | | | | | | Pick-to: 6.5 Change-Id: Iaa993387ecbaeab66c1bd226a85c9ab6d876b157 Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io> Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
* Fix build with -no-feature-draganddropTasuku Suzuki2023-01-171-1/+1
| | | | | | Pick-to: 6.5 Change-Id: I88ecd9a84d7fb9f6cb78027cc51e34089e211ff2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Doc: Fix linking to 'Drag and Drop' topicTopi Reinio2023-01-091-2/+2
| | | | | | | | | | | | | | Linking to 'Drag and Drop' target will link to a page local to Qt Widgets with that section title. The intention is to link to the topic page located in Qt GUI module. Add a descriptive keyword to the correct target page and use that for linking. Pick-to: 6.5 6.4 6.2 Fixes: QTBUG-109289 Change-Id: Ib6a39b43f9080cf5bb72fb07ab163e75eefb4da9 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* Fix deprecation of QApplication:setActiveWindow()Kai Köhne2023-01-061-3/+2
| | | | | | | | | | | | | The method is now deprecated in Qt 6.5, not Qt 6.4. Also, keep the documentation for now, but mark it as deprecated there, too. This amends 2436e259ced3. Pick-to: 6.5 Change-Id: Iff3e2c170a8fdb8834c0283de9554b503ed3aca4 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Beautify QApplication::compressEventAxel Spoerl2022-12-091-27/+41
| | | | | | | | | | | Replace if-statement to check compressable event types with a switch. Replace if / else if sequence dispatching to type specific compression code paths with a switch. Replace iterated for loop with a ranged one. Task-number: QTBUG-107808 Change-Id: I9054b625f1898fa793f78de1b477a2113a4e33f0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Port from container::count() and length() to size() - V5Marc Mutz2022-11-031-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to handle typedefs and accesses through pointers, too: const std::string o = "object"; auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); }; auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) { auto exprOfDeclaredType = [&](auto decl) { return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o); }; return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes)))); }; auto renameMethod = [&] (ArrayRef<StringRef> classes, StringRef from, StringRef to) { return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)), callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))), changeTo(cat(access(o, cat(to)), "()")), cat("use '", to, "' instead of '", from, "'")); }; renameMethod(<classes>, "count", "size"); renameMethod(<classes>, "length", "size"); except that the on() matcher has been replaced by one that doesn't ignoreParens(). a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'. Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache, to avoid porting calls that explicitly test count(). Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QApplication: send QHoverEvents with correct scenePosition()Shawn Rutledge2022-10-231-2/+4
| | | | | | | | | | | | | | | | The QHoverEvent ctor takes two points: pos and globalPos; pos is then passed as both the scene and global pos to the QSinglePointEvent ctor, which calls QMutableEventPoint::setScenePosition() on the persistent QEventPoint instance and then detaches befeore setting ephemeral state. Therefore, we must construct QHoverEvent with scene position first, not local position, so that the right value is persisted; it's better to set local position after the detach(), whereas it's too late to fix the persistent point then. Pick-to: 6.4 Fixes: QTBUG-106918 Change-Id: I45726a9ec05bba2fe0cde6f5fb87c269105caca6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-111-3/+3
| | | | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace, with manual unstaging of the actual definition and documentation in dist/, src/corelib/doc/ and src/corelib/global/. Task-number: QTBUG-99313 Change-Id: I4c7114444a325ad4e62d0fcbfd347d2bbfb21541 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Fix build with disabled accessibilityAlexey Edelev2022-09-291-1/+1
| | | | | | | | Amends 8539e641f6f48a605547f66c47266d19e537f74e Task-number: QTBUG-106941 Change-Id: Ieffe1ac0050c9f1377e4260376acb2f8cdc0f985 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Get rid of copypasted code between isWindowBlocked's overridesMikolaj Boc2022-09-201-64/+6
| | | | | | | | | | | | | | | | | The code in QGuiApplication::isWindowBlocked and QApplication::isWindowBlocked is very similar, a result of copying and pasting. Due to the copying it is difficult to modify the code and the implementation is hard to comprehend, too. There are ultimately only two parts that are different. First is that QApplication's override may also specify a certain window as non-blockable if it is a popup window. Second, default modality is computed in QApplication if a modal window does not have one assigned. The differing parts have been extracted following the template method design pattern. Pick-to: 6.4 Change-Id: I3b9aa206a3c7211fe022730943bf6f76aa5ae6d2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Simplify obtaining of parent in isWindowBlockedMikolaj Boc2022-09-121-8/+2
| | | | | | | The new way is more readable as it uses an existing API Change-Id: Id253c9e6405d11f16bdb5f55288dcfcf4b1641c6 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Move QMacAutoReleasePool from qglobal.h to qcore_mac_p.hSona Kurazyan2022-09-011-0/+4
| | | | | | | | And include qcore_mac_p.h where needed. Task-number: QTBUG-99313 Change-Id: Idb1b005f1b5938e8cf329ae06ffaf0d249874db2 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Deprecate QApplication::setActiveWindow() and mark as internalTor Arne Vestbø2022-08-271-9/+18
| | | | | | | | | | | | | | The function is used the internal window activation machinery and should not be called by user code. Many tests still use this function, and should be ported over to QWidget::activateWindow(). For now they are using the private helper in QApplicationPrivate, so that we can progress with the public API deprecation. Change-Id: I29f1575acf9efdcbae4c005ee9b2eb1bb0c8e5b5 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Refactor QApplication::event from if/else to switch statementVolker Hilsheimer2022-08-261-8/+16
| | | | | | | | And it wasn't even 'else if' in all the places where it should have been. Pick-to: 6.4 Change-Id: I5a48bfe27cc01fa1fbea1995e8c9cb1be427511a Reviewed-by: Doris Verria <doris.verria@qt.io>
* Replace QT_NO_ACCESSIBILITY with QT_CONFIG(accessibility)Allan Sandfeld Jensen2022-06-151-2/+2
| | | | | | | Pick-to: 6.4 Change-Id: Iee4bd8970810be1b23bdba65a74de912401dca65 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QApplication: Remove QApplicationPrivateBase porting macroThiago Macieira2022-06-131-1/+1
| | | | | | | | | This was last used in 2011, before Qt 5.0 release, when QPA was yet another windowing system, not the only option. Change-Id: Ia4a094014ddb48cc9f6dfffd16f83aad1b7109e7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Q*ApplicationPrivate: remove unused "flags" argumentsThiago Macieira2022-06-141-4/+4
| | | | | | | | | | | | | | | | They weren't flags. They were the version of Qt that was used in compiling the application itself. The protection against rollback isn't necessary any more, since qversiontagging.h, which applies to everything and not just the main application binary. And using them to make decisions on functionality or behavior is misguided (see previous commit). This commit does not deprecate the front-end classes' argument. In the future, we may find some need for them. Pick-to: 6.4 Change-Id: Ia4a094014ddb48cc9f6dfffd16f83a7b58ff95d3 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Remove ALIEN_DEBUG statementsDavid Skoland2022-05-031-15/+1
| | | | | | | | These debug statements come from the Nokia import and it seems unlikely that they are being used at all. Change-Id: I3143f83b0acdc5130fb743808003a55b789f2398 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QtWidgets: use _L1 for for creating Latin-1 string literalsSona Kurazyan2022-05-021-3/+5
| | | | | | Task-number: QTBUG-98434 Change-Id: I310ea8f19d73a79d985ebfb8bfbff7a02c424360 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Rename QGuiApplicationPrivate::notifyThemeChanged to handleThemeChangedTor Arne Vestbø2022-04-211-2/+2
| | | | | | | | The work done by QGuiApplicationPrivate in response to a theme change goes beyond notifying. Change-Id: I27c74adf6549c553e659c7b8e271945ce753031c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QApplication: deliver activation events for non-widget windowsRichard Moe Gustavsen2022-04-211-1/+14
| | | | | | | | | | | | | | | | | | Problem: if you create a hybrid Widgets and Quick Controls application, you would need to use QApplication rather than QGuiApplication. But in that case, the QQuickWindows would never receive window activation events from QApplication. And this causes problems for controls, since, for example, the palettes in use there will never update upon activation changes, and instead sometimes get stuck as e.g QPalette::Inactive after application startup. This patch will make sure that we send out activation events also for QWindows that are not QWidgetWindows. Pick-to: 6.3 6.2 Change-Id: I649f5c653081c0c5249f4faf28a7de2c92f17421 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Reduce qaccessible includesFabian Kosmale2022-02-091-0/+3
| | | | | | | | | | Forward declare some types in qaccessiblewidgetfactory_p.h instead of including qaccessible.h. In turn, qapplication.cpp which relied on transitive includes now needs to include qaccessible_base.h. Change-Id: I8ac00d45a7ffccd84769fb210f29364a45bcd59e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Add a QHoverEvent ctor taking global mouse position; deprecate the otherShawn Rutledge2022-02-031-9/+9
| | | | | | | | | | | | | | | | | The QSinglePointEvent ctor assumes that the given globalPos is correct, so it was wrong that the QHoverEvent ctor passed along a local position as global. It's better to require globalPos as an argument; and in fact it seems that everywhere we construct a QHoverEvent, global position is available, or possible to get by transformation (which is better than resorting to QCursor::pos()). Also, don't convert to QPoint: pointer events have qreal resolution and there's no reason to truncate them. Fixes: QTBUG-100324 Change-Id: I919455da36265988d3d149eb97563c9ed0d2c660 Pick-to: 6.3 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QGuiApplication: invert meaning of qt_is_gui_usedMarc Mutz2022-02-021-4/+4
| | | | | | | | | | | | | | | | | | The default value was true, which is non-zero, forcing the variable out of the BSS and into the DATA segment. Fix by inverting the meaning so the default value can be false. Since qt_is_gui_unused sounds a bit complicated, however, take a cue from the variable's only writer and rename it qt_is_tty_app. Pick-to: 6.3 Change-Id: I198e9786f7e71178d69fecb5179287bf39b3a1d6 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Don't include qeventpoint_p.h from qevent_p.hMarc Mutz2022-01-141-0/+1
| | | | | | | | | | | The header no longer uses QMutableEventPoint. Fix TUs that relied on the transitive include. Task-number: QTBUG-99615 Pick-to: 6.3 Change-Id: Iae4ff34ea708304fcd365fd763875dd4a97a1cf8 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Port the last user of QMutableSinglePointEvent::mutableEvent()Marc Mutz2022-01-141-1/+1
| | | | | | | | | | | ... to the static setters of QMutableEventPoint. Remove the mutableEvent() function. Task-number: QTBUG-99615 Pick-to: 6.3 Change-Id: If4d3decae67baff41e23e7e9eaed3f3035fab595 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QApplication: port manual users of QMutableEventPointMarc Mutz2022-01-131-2/+2
| | | | | | | | | | | | | | ... to new static setter API, which doesn't depend on undefined behavior. These users didn't use QMutableEventPoint::from(), but static_cast<>, so they were only found when the non-static setters were removed, locally. Task-number: QTBUG-99615 Pick-to: 6.3 Change-Id: I37faf17b2b180e0f6e8bb4e5f46951a2cc29678d Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QMutableEventPoint: add static overloads of settersMarc Mutz2022-01-081-9/+9
| | | | | | | | | | | | | | These overloads don't require a cast from QEventPoint to QMutableEventPoint, thus avoiding undefined behavior. Port easy users of QMutableEventPosition::(const)from() to the new API. Pick-to: 6.3 Task-number: QTBUG-99615 Change-Id: I4e9228322134ef7c712ca478ee8286466efc3585 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix widget gesture grabbingVolker Hilsheimer2021-12-111-5/+8
| | | | | | | | | | | | | | | | | | After 7369c31ca1f446e81eda1c93ba13767ffcd83efe, unaccepted touch points were not grabbed anymore in calls to activateImplicitTouchGrab. However, gesture recognition relies that widgets for which a gesture has been partially recognized grab also unaccepted touch points. Add a parameter to allow the implicit grabbing to take place also for unaccepted event points. Add test case that replays touch events similar to what Squish is doing, and fails without this fix. Pick-to: 6.2 Change-Id: Idb0b20301b1827be57a03013a59043d97c2ee7b6 Reviewed-by: Stefan Gehn <stefan.gehn@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Skip disabled proxy widgets when (back)tabbingAlexander Volkov2021-11-191-1/+4
| | | | | | | Fixes: QTBUG-98137 Pick-to: 6.2 5.15 Change-Id: If52053dce361b130ef7dcfaf747710d8ceb9bbcd Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Centralize maybeLastWindowClosed checking in QWindowTor Arne Vestbø2021-10-201-5/+0
| | | | | | | | | | | | | | | | | Instead of plumbing QWidgetWindow close events via handleCloseEvent, we just implement closeEvent directly. This allows QWindow do save the state of the window/widget before the close event, so that we know whether we should trigger lastWindowClosed handling, even if the window was deleted as a result of the close event. This also relieves QGuiApplication and QApplication from dealing with the close logic in their notify functions, so that these functions can focus on the propagation of events -- not how the event is handled. Change-Id: I8b586b53a53b1df1d8630c1acb635c60f191bb4b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Deduplicate lastWindowClosed handlingTor Arne Vestbø2021-10-161-19/+1
| | | | | | | | | | | | | | | | | | | | | | | Whenever a window was closed, we had logic to check if it was the last window, and if so emitted lastWindowClosed and then tried to quit the application. But the automatic quit process also checked if there were any remaining windows, as this process could be triggered as a result of a QEventLoopLocker going out of scope. The two paths now share the same logic for determining if there are any remaining windows. The docs have been updated to reflect the original intent of the logic, dealing only with primary windows (top levels without a transient parent). This was how both the original code paths implemented their logic. For historical reasons the Qt::WA_QuitOnClose attribute is closely tied to the lastWindowClosed signal, and isn't merely limited to controlling whether we try an automatic quit when the last window closes. For now this behavior has been kept, but the docs have been updated to clarify how the attribute is handled in practice. Change-Id: If3d06b065236aad2e59e9091cac3146bc4cf79f6 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* widgets: Fix typos in source code commentsJonas Kvinge2021-10-151-1/+1
| | | | | | Pick-to: 6.2 Change-Id: I22f71a53b0f7f0698450123343e25548c889c3e2 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* macOS: fix window activation when popup is openVolker Hilsheimer2021-10-121-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On macOS, it is possible to right-click-open a context menu for a window that is not active. This does not activate the window. When then clicking into the window to activate it, the popup is closed, but only after the WindowActivate events has been sent. This blocks the event delivery, as QApplication (since commit 78264f333eb7c2623807) interpreted activation changes while popups are open to be just delayed focus events. The UI ends up in a broken state where focus cannot be set on the widgets in the window. To fix this, don't ignore such activation events on macOS. As a drive-by, give the variables more meaningful names. Note: We cannot call closeAllPopups before delivering WindowActivate, as that would close the popup before the mouse event is delivered, making it impossible to select any of the actions from the menu. Ideally, clicking into a popup of an otherwise inactive application would not activate that application (that is the default behavior for native macOS applications), but that's out of scope for this patch. Fixes: QTBUG-78750 Task-number: QTBUG-69710 Task-number: QTBUG-66513 Pick-to: 6.2 Change-Id: I6344370ae7be31630e37514e04918b2d6cb8b69a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* widgets: Fix typos in documentationJonas Kvinge2021-10-121-2/+2
| | | | | | Pick-to: 5.15 6.2 Change-Id: I6b77f0ec043d08da3b7958d780dce9595daf97a6 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>