summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
Commit message (Collapse)AuthorAgeFilesLines
* ColorScheme: clean up code to prepare adding a setterVolker Hilsheimer39 hours3-5/+9
| | | | | | | | | | | | | | | | | | | The current QStyleHintsPrivate::setColorScheme is called when the system theme changes, handling the change and informing the application. It is not a setter. When we add a public setter, that setter will have to go through the QPlatformTheme to request an override for the application. That will then result in a call back to the QStyleHints to update the theme with the effective color scheme (or ignore the request for the override, on some platforms). Rename it (and similar misleading APIs in platform plugins) to updateColorScheme, and adjust outdated comments in some of the platform plugins. Task-number: QTBUG-124490 Change-Id: I6a852211254993df86acf2e2d42cf345e7401f4f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io>
* Gui: fix memory leak in QGuiGLThreadContextTim Blechmann2 days1-0/+3
| | | | | | | | | | | | | | `QCoreApplicationPrivate::cleanupThreadData` calls `~QGuiGLThreadContext`, which calls `QOpenGLContextPrivate::setCurrentContext`, which creates a new `QGuiGLThreadContext`, which is not destroyed anymore. since `~QGuiGLThreadContext` sets a nullptr we exit early. Fixes: QTBUG-124538 Pick-to: 6.7 Change-Id: I51e40fcf8fd1169a4dfd336fac9c82f44d42f68e Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Update the cached DPR on QWindow update requestMorten Sørvig3 days1-0/+9
| | | | | | | | | | Follow-up from commit 299dfe which added a similar update for expose events. This fixes missing DPR updates for exposed windows. Pick-to: 6.6 6.7 Change-Id: Ic1a9a41bd979270b97303abb71f1230bff001d19 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* QWindow: Persist foreign winId to support destroy/create cyclesTor Arne Vestbø6 days2-3/+21
| | | | | | | | | | | | | | | | | | | | | | | | We used to set a private _q_foreignWinId property on QWindow when creating foreign windows, and this was the mechanism which we then passed the foreign winId to the platform plugin. With c585802e946d97e7d177ea334a162dc7bc286b84 this was removed, since we now were passing the winId through via explicit QPA APIs, and since 0c6911e5cde24c45d6f2c08b6e71064bdd1eccfa removed the ability to explicitly destroy() a foreign window. But when closing a QWindow, we destroy both the window itself, and all its children, including foreign windows. In this case we still want to support recreating the foreign window, for example when the parent window is shown again. To enable this we restore the _q_foreignWinId private property, but keep the limitation of not being able to explicitly destroy a foreign window. Pick-to: 6.7 6.5 Fixes: QTBUG-124160 Change-Id: Ia885ba9f043e64fb21eedd2b4c344679726f1b5c Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Gui: Add Q_GADGET to QPointerEventUlf Hermann7 days1-0/+1
| | | | | | | | | | It's exposed in the QPointingDevice::grabChanged signal. In order to build a complete graph of metaobjects via properties and methods we need to know about all argument and return types as metaobjecs. Such a graph is desirable for reasoning about the consistency of the type system. Task-number: QTBUG-101143 Change-Id: Ib8eca9490504846ae96814f7d746084adf6a29f9 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Warn on setHighDpiScaleFactorRoundingPolicy misuseMorten Sørvig8 days1-0/+2
| | | | | | | | | | | | | | The rounding policy is used to calculate QScreen geometry during startup. Changing it afterwards is not supported since we don't have an update mechanism. This restriction is already documented but printing a warning makes sense since this is easy to miss. Fixes: QTBUG-123102 Change-Id: Ib88511e61abbf97436a13dc5d38d3d1fbd5aab2c Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Gui: Add Q_GADGET to QPlatformScreenUlf Hermann8 days2-2/+2
| | | | | | | | | | It's exposed in the QPlatformSystemTrayIcon::contextMenuRequested() signal. In order to make sense of it on meta object level, it needs a Q_GADGET. Task-number: QTBUG-101143 Change-Id: I327d31f36e2cf3460398e328b26e9e5e5edec45e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QWaylandWindow: Add surfaceRoleCreated/Destroyed signalsKai Uwe Broulik2024-04-101-0/+2
| | | | | | | | | There are many APIs in Wayland that require a surface role to be assigned (e.g. XDG Toplevel) before they can be used, where the surfaceCreated() signal is too early. Change-Id: I400a6279f21554267259f812a2efb33451b4709b Reviewed-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
* doc: Remove deprecation of the supported QTouchEvent ctorShawn Rutledge2024-04-041-2/+0
| | | | | | | | Amends 111115bf8862b7cd1197c2ef8a4b475c882776d4 Change-Id: Ibc557fdde9c894a3a58bb58835e11be9180e6e6d Pick-to: 6.2 6.5 6.7 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* wasm: Document and test OpenGLContext limitationsEven Oscar Andersen2024-03-221-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a limit in WebGL that OpenGL context sharing is not supported. There is a proposal from 2013 (https://www.khronos.org/webgl/wiki/SharedResouces), but it seems that it never was implemented. There is an additional limit in that there is exactly one WebGL context for each canvas (i.e. window). A part of the problem here is that the identifier for an OpenGL context is essentially a surface-thread-context triplet. And the thread part might be more difficult to handle in a javascript setting. Regardless of why, we need to have an opinion about what the consequences are, and what we support to what extent. As such this commit: 1) Adds a comment on the QOpenGLContext describing the limitations 2) Adds a qWarning() on the first activation of a shared context. The second item is not complete. We will have problems with multiple individual contexts also, It is just not possible to warn for these cases. The second item covers, maybe, the most common case. Change-Id: I51550a6acb0a7f6f6fa5e9e2c3da080a1d2b498f Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Revert default FlickDeceleration to 1500Shawn Rutledge2024-03-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At the time of bb1f616ff19586225cd712195ca78bfc64944103 the Flickable.flickDeceleration property still applied to both touch flicking and mouse wheel scrolling. In qtdeclarative b1766d9d629f61d824146e69f1f3b319cbee3d11 we decoupled them. Switching from the traditional 1500 logical pixels/sec² to 5000 was not enough to satisfy those who complained about the mouse wheel "not being linear" and at the same time made touch-flicking feel too sluggish. So let's restore the traditional default deceleration value. The flickDeceleration property is still adjustable, and the default can still be overridden in any QPlatformTheme subclass. [ChangeLog][QPA] The default value for the platform FlickDeceleration hint is reverted to 1500 (rather than 5000 as in Qt 6.6). This sets the default value for Flickable.flickDeceleration, which can be overridden directly; and the default can also be overridden in any QPlatformTheme subclass. Pick-to: 6.7 Task-number: QTBUG-35608 Task-number: QTBUG-35609 Task-number: QTBUG-52643 Task-number: QTBUG-97055 Fixes: QTBUG-121500 Change-Id: If52b61dfcd0c08a7c6e753f39dbe01f417e94bf4 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QGuiApplication: copy a Prealloc value instead of hard-coding 16Marc Mutz2024-03-131-1/+2
| | | | | | | | | | | The EventPointMap QPointingDevicePrivate::activePoints is actually a QVarLengthFlatMap<., ., 20>, not 16, so copy the value instead of just hard-coding something. Amends 296ede3aab2c0cc1acd28a2adb3017ac74d7ed6b. Change-Id: Ic8e83f4095f57be74f7708d5cec6a19971772b76 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add QT_IM_MODULES env to allows specify multi IM keyJiDe Zhang2024-03-052-4/+28
| | | | | | | | | | | | | | | | | Like as QT_QPA_PLATFORM, supports specifying multiple keys, and can perform fallback operations to prioritize the use of a certain plug-in. This is useful when using Wayland and XWayland applications at the same time. For an example, we can set "QT_IM_MODULES=wayland;fcitx", and the wayland application will use the wayland input context plugin, the xwayland application will use fcitx, which can't be done without adding a new environment variable, if we specify "QT_IM_MODULE=wayland", the XWayland applications may not be able to use the input method. Fixes: QTBUG-120202 Change-Id: Iac408af241963147747a2fe685f1e27bf9d9ee64 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: David Edmundson <davidedmundson@kde.org>
* Mention QChronoTimer in API docsAhmad Samir2024-03-032-5/+6
| | | | | Change-Id: Iaf9fb31994f1580b2051dbd0b1b8eef2a218aa39 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove QWindowPrivate::compositingTor Arne Vestbø2024-03-011-1/+0
| | | | | | | | | | | It was added for Android in a4f50269f82695fbd0dd344f87b4b355feff4333, for the case of QSurface::RasterGLSurface, but since 6.4 we no longer use QSurface::RasterGLSurface for composition. And the Android usage was removed in 2020ce5fd2478389c56f34742fdeee9cd24ca8a5. Pick-to: 6.7 6.6 6.5 Change-Id: I8dafe959c54e09b3a974253e15d184365141d559 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Fix -Wimplicit-fallthrough for clangTim Blechmann2024-03-011-0/+1
| | | | | | | | | | | | | | | | | | | 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>
* QGuiApplication: replace a QSet with QMinimalVarLengthFlatSetMarc Mutz2024-02-281-5/+5
| | | | | | | | | | | | | The number of windows in a windowing system is clearly small, even smaller the number of windows that should be affected by a single touch event, so QSet is overkill. Use the recently-added QMinimalVarLengthFlatSet instead, backed by a QVLA<16>. Even though insertion and lookup are now logarithmic instead of constant-time, the saved memory allocations will make up for it. Change-Id: Ie33ecf4a155e58db597c67ed9c78549255c48b99 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Doc: Fix typo in QSurfaceFormat::setDefaultFormat documentationAndy Nichols2024-02-271-1/+1
| | | | | | | Fixes: QTBUG-107486 Pick-to: 6.7 6.5 Change-Id: Id22cedfa65e831574f683a33a4c2fde20570890e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Add QPlatformIntegration::BackingStoreStaticContents capabilityTor Arne Vestbø2024-02-132-1/+7
| | | | | | | | | | | | | | This was a feature in Qt 4, but the only platform that carried it over to Qt 5 was Windows, in ab76593f18396e693f24066592244ca95e135ea2, and that's still the situation. As a first step in possibly implementing this on more platforms, lets replace the hard-coded check in QWidgetRepaintManager::hasStaticContents with a proper QPlatformIntegration capability check in the only call site. Pick-to: 6.7 Change-Id: I2067109f45116cd8c62facf7224cd748f19e845b Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Apple: Make Qt::Key_Backspace primary sequence for StandardKey::BackspaceTor Arne Vestbø2024-02-092-2/+3
| | | | | | | | | | | This will show up in menus as ⌫, instead of ^H, which is a better fit with the native behavior. Task-number: QTBUG-122042 Task-number: QDS-11733 Pick-to: 6.7 6.6 6.5 Change-Id: I224971421a13baec2a0f65be8ae4a5791dabafdd Reviewed-by: Doris Verria <doris.verria@qt.io>
* Windows: Default to DirectWrite font backendEskil Abrahamsen Blomfeldt2024-02-061-7/+5
| | | | | | | | | | | | | The GDI font backend is missing support for certain modern features, and has a lot of work arounds for missing APIs. DirectWrite is the modern way to handle fonts on Windows, so we make this the default now, but keep the old backend as a fail safe. Fixes: QTBUG-119420 Change-Id: I0ea5cdfdcd759ccc894efb01b2410826c44aa1ea Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Don't rely on QRasterWindow::resizeEvent for marking window dirtyTor Arne Vestbø2024-02-013-3/+11
| | | | | | | | | | | | | | | | | The de-virtualization gotcha might result in client code not calling QRasterWindow::resizeEvent, which we use for dirty state management after e0eb2818face4ffb7dafd87464f355d4654b7be0. In practice this wasn't an issue, because QPaintDeviceWindow handles paint events by calling markWindowAsDirty first, but we should not rely on this. Instead plumb the resize event to QPaintDeviceWindowPrivate, which QRasterWindow implements and can override the behavior of. Pick-to: 6.5 6.6 6.7 Change-Id: I5c0747da10f0275b77f56be32690d796fa48cdb4 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QChildWindowEvent: make constructor explicitVolker Hilsheimer2024-01-251-1/+1
| | | | | | | | | | Found in header review. Pick-to: 6.7 Task-number: QTBUG-119952 Change-Id: If98415f7c5115e8d1875f5f03e399b2919bb250b Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* qWaitForWindowFocused: Pass timeout as QDeadlineTimerTor Arne Vestbø2024-01-252-3/+3
| | | | | | | | | | | We should avoid int-based timeouts nowadays, and prefer std::chrono, or for timeouts where Forever is a valid state, QDeadlineTimer. Discovered during API header review. Pick-to: 6.7 Change-Id: Ia56a67084c7a2f989951755fed5ffc161ed8f79e Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QMetaTypeModuleHelper: mark instances constexprMarc Mutz2024-01-191-1/+1
| | | | | | | | | | Static and thread-local objects should be constexpr or constinit if possible. Task-number: QTBUG-100485 Pick-to: 6.7 6.6 6.5 Change-Id: I29088798a50d6278252c9088e7c191c4214b2e5b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QMetaTypeModuleHelper: suppress cppcoreguidelines-virtual-class-destructorMarc Mutz2024-01-181-0/+1
| | | | | | | | | | | | | | | | | | | | Says clang-tidy: destructor of '(unnamed struct at qmetatype.cpp:966:14)' is public and non-virtual in file:src/corelib/kernel/qmetatype.cpp line:966 col:14 static const struct : QMetaTypeModuleHelper Yes, these classes are polymorphic (because the base class is). Yes, the destructor is non-virtual (because the base class' one isn't, but it's also protected, so fine). But these classes are not used as base classes, so suppress the warning. Pick-to: 6.7 6.6 6.5 6.2 Change-Id: I75be86bca36a4a0e93d72acb1a0d2fe0dca1c505 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Remove foreach snippets from the documentationKai Köhne2024-01-161-8/+0
| | | | | | | | | | | | | | | We don't recommend foreach anymore, and have in fact adapted two snippets already to use for(), but missed the documentation text. In any case, it feels a bit weird to give an example how to iterate over QStringList in each of these methods, so we might as well just remove this part. Pick-to: 6.6 6.7 Change-Id: If8744e48961661ad518f5f24781c38f371d981bc Reviewed-by: Jaishree Vyas <jaishree.vyas@qt.io> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* highdpi: Update high-DPI in QWSI::handleScreenLogicalDotsPerInchChangeMorten Sørvig2024-01-081-0/+5
| | | | | | | | | | | | | | | Update m_active early during DPI change to make scaling calls made during the DPI change use the new value. The existing call to updateHighDpiScaling() in QGuiApplicationPrivate:: processScreenLogicalDotsPerInchChange() is supposed to take care of this, however that call is made after the geometry change event is crated (with incorrect geometry) Pick-to: 6.7 Change-Id: Ia0f6006c90355ec69ef92b88a020089ab21e072d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Doc: QEventPoint: Remove documentation-specific property macroTopi Reinio2024-01-081-1/+0
| | | | | | | QDoc is now capable of handling const-qualified property types. Change-Id: Id36b44c7dfc6531d14f7fe31fdd0d69061743bb9 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* testlib: Add test function for simulating wheel eventsDoris Verria2023-12-201-0/+7
| | | | | Change-Id: I28fe4dff7db92fb58922948a3eec460df315318c Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Use Qt::WindowNoState for child windows/widgets shown via show()Tor Arne Vestbø2023-12-131-7/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Qt::WindowState enum is documented to specify the current state of top-level windows, and does not make sense for child windows. It's up to the client code to ensure any sizing of child windows/widgets, e.g. via layouts. Many of our QPA backends bail out on QPlatformWindow::setWindowState() for a child window. Ideally we would do this at a higher level, in QWindow, but that's a bigger task, and the semantics of what happens when a window is moved from being top level to child or back are not fully clear. As a first step, we ensure that the default window state when showing the window via show() is Qt::WindowNoState. Unfortunately, the QPlatformIntegration::defaultWindowState() API only takes into account the window flags, which sadly do not have a way to reflect whether the window is a child window or not (Qt::SubWindow is not a child window, see QTBUG-115729). We don't want to pass a QWindow to this API, as it would mean QWidget would need to create a window when requesting the default window state. Instead we hard-code the opt-out for child windows/widgets. [ChangeLog][Gui/Widgets] Child windows and widgets are now always shown in their normal state by show(). Pick-to: 6.7 Change-Id: Ie8caf2df2d854194b9985c9427a9eac1312aba65 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Use Ctrl+Shift+S for Save As... shortcut on every platformShawn Rutledge2023-12-092-2/+2
| | | | | | | | | [ChangeLog][QtGui][QKeySequence] Ctrl+Shift+S is now the standard shortcut for Save As... on every platform. Fixes: QTBUG-72916 Change-Id: Ic1815646651573c07994c4cd9df8f658e4a806b6 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Add QTest::qWaitForWindowFocused for checking focus windowTor Arne Vestbø2023-12-092-1/+23
| | | | | | | | | As opposed to QTest::qWaitForWindowActive, which checks if the window is active, which is not a guarantee that the window has focus. Task-number: QTBUG-119287 Change-Id: I9fe65b0474095389f6518ebaaf07c71143b6f459 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Make some QScreen native interfaces publicDavid Redondo2023-12-084-33/+78
| | | | | | | | | | [ChangeLog][QtGui][QScreen] The QAndroidScreen, QWaylandScreen and QWaylandWindow native interfaces are now available on QScreen to provide a handle to the underlying platform screen. Task-number: QTBUG-113795 Change-Id: I83d70046678dfb79ee08544ddfc1820f3ff2d118 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Introduce a configure feature for WaylandDavid Redondo2023-12-076-9/+9
| | | | | | | | Using the presence of the wayland-client lib as a condition. Fixes: QTBUG-117386 Change-Id: If4336965ea06e3f4b06e9af661efdec38ba46136 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Avoid QWindow crashing in mapToGlobal when no platformWindowLaszlo Agocs2023-12-061-1/+6
| | | | | | | | | | | | Add f60fb8f41741c2ca4dbd02b70d56e561be64d673 also to mapToGlobal. Amends 67fa2585ac48e64972d1c0a20b3add5c3ef72e51 Avoids crashing in certain applications that use QQuickRenderControl and QQuickWindows that are not backed by a QPlatformWindow. Change-Id: Ie4a8bd7837973e7997f9b668f776ca2999147d75 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Avoid segfault in QWindow::mapFromGlobal when platformWindow is nullMitch Curtis2023-12-011-1/+6
| | | | | | | | | | | If the window hasn't been shown yet (as is the case when running ./tst_qquickmaterialstyle Material::test_background:drawer in qtdeclarative), platformWindow can be null. Check for that and use the pre-67fa2585ac48e64972d1c0a20b3add5c3ef72e51 code path instead. Fixes: QTBUG-119517 Change-Id: I8333578b94f91b5a2994875da6dc568a360d2edf Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* highdpi: fix map to/from global for "off-primary-screen" windowsMorten Sørvig2023-11-231-2/+2
| | | | | | | | | | | | | | | | | | | | | By "off-primary-screen" here I mean windows which are visible on more than one screen, e.g. a secondary screen in addition to the primary screen. In this case the call to QHighDpi::toNativeGlobalPosition(pos, this) problematic, since it uses the scale factor for the primary screen, while pos might be on the secondary screen. One way to fix this is to look up the correct scale factor based on pos. Another way is to realize we don't have to use scaling to get the native window position, and get it from platformWindow geometry. This patch implements this fix. Fixes: QTBUG-106695 Change-Id: I03ffc261e199f65e54b06b964d067b6a9e0dd021 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Rename QWSI::handleWindowActivated to QWSI::handleFocusWindowChangedTor Arne Vestbø2023-11-236-17/+19
| | | | | | | | | | | | | | | | | | | A single QWindow is QGuiApplication::focusWindow() at a time, and this window is typically also QWindow::isActive(), but other windows may also be QWindow::isActive(). For example, we treat any sibling or ancestor of the focusWindow as being QWindow::isActive() as well. In addition, in the case of non-QWindow child windows, we may have to query the platform for the activation state, which means we also need a way for the platform to reflect changes in this state through QWSI. The current API for this, QWSI::handleWindowActivated, is in practice a focus window change API, so as a first step let's rename it to better reflect what it's doing. Task-number: QTBUG-119287 Change-Id: I381baf8505dd13a4a829c961095a8d2ed120092b Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Don't update DPR on de-expose eventsMorten Sørvig2023-11-171-4/+6
| | | | | | | | | | | There is no need to run the catch-all DPR update if the window is not visible. Pick-to: 6.6 Fixes: QTBUG-117762 Change-Id: Ib4e235fed4b21e5aa2ecafa960ab0900e2b68295 Reviewed-by: David Edmundson <davidedmundson@kde.org> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Add dedicated child and parent events for QWindow reparentingTor Arne Vestbø2023-11-174-5/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | When a QWindow is parented into another window, either via its constructor, or via setParent(), we also update the QObject parent of the window. This in turn sends ChildAdded and ChildRemoved events to the new and old parent of the window, as well as ParentAboutToChange and ParentChange to the window itself. But at the point when these events are sent, the QWindow parent relationship has not been fully established. We have not updated d->parentWindow, nor have we propagated the parent relationship to the platform window. This is problematic because clients can not use these events to react to window parent changes synchronously. For example. trying to raise a child window when added to a parent is not going to work, because at that point the child window isn't a native child of the parent. Instead of re-using the QObject events for QWindow, like QWidget does, by delaying the events or sending them manually at a point when the window parent relationship has been fully formed, we opt to add new dedicated events. Change-Id: I019c14eba444861f537e4f68ab3a82297f843cf7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QGuiApplication: Fix condition for when doubleclick events are triggeredJan Arve Sæther2023-11-171-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QGuiApplicationPrivate::processMouseEvent() requires the following conditions to be met in order to trigger a double click event: 1. The same button should be pressed (kept in mousePressButton member) 2. The time between two press events should not exceed doubleClickInterval 3. Movement between presses shouldn't be bigger than doubleClickDistance Unfortunately, when we are processing *synthesized* mouse events (from touch), in order to check criterion 2) we cannot rely on QPointingDevicePrivate::pointById(0)->eventPoint.pressTimestamp(); because this was already updated in QGuiApplication::processTouchEvent(), so it does not any longer reflect the *previous* press timestamp, but the current one. Therefore we could not reliably calculate the time between the previous press and the current press (in fact, it never exceeded the doubleClickInterval condition) I suspect this occurs with all touchscreens, but at least it was reproduced with e.g. a NVIDIA Terra / Thinkvision touch screen on Windows 11 and Dell Express SVC touch screen on Windows 11. => Since QGuiApplication is a singleton, add a static local variable to remember the time stamp of the last processed press event. Autotesting has been modelled in PS7. However, QTest::touchEvent is unable to synthesize hardware specific detection latency and stray touch events, which actually reproduce the issue. => Not adding an autotest. Fixes: QTBUG-112479 Fixes: QTBUG-119032 Fixes: QTBUG-100688 Pick-to: 6.6 6.5 Change-Id: Idc97fb9d49ed334f56d702d420451fc062e9b5a9 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QGuiApplication: check return value of platformTheme::palette()Christian Ehrlicher2023-11-141-1/+2
| | | | | | | | | | | Under some circumstances (e.g. setDesktopSettingsAware(false) on windows) it may happen that the call to platformTheme::palette() returns a nullptr which is not checked before dereferencing the pointer. Therefore add a check for this to avoid a crash. Fixes: QTBUG-111527 Change-Id: I6443d5d1a9b813f499d8f65b4fee55b0b8299b16 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Beautify QGuiApplication::event()Axel Spoerl2023-11-101-5/+9
| | | | | | | | | | Replace if/elseif with a switch. Task-number: QTBUG-112479 Task-number: QTBUG-119032 Pick-to: 6.6 6.5 Change-Id: Iff29fde6a9b9a16357b26cf90009fec7c9826349 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fix build with -no-feature-shortcutTasuku Suzuki2023-11-071-0/+2
| | | | | Change-Id: I43b95991fcf37ac8b125b176a59518e6a81e11dc Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QMessageBox: Detect modifications to standard button textTor Arne Vestbø2023-10-312-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The addButton(StandardButton) and button(StandardButton) APIs return a QAbstractButton, that the user can in theory modify to their heart's content. This causes problems when the native dialog backend is not aware of these modifications. We documented this limitation in e9a1c5321, but it turns out to be more common than we first though. In particular, a typical case is modifying the text of the button. We now try to detect if the button has a non-standard text, and if so turn it into a custom button when passing it on to the native backend. From the point of view of QMessageBox it's still a standard button, and will be reported as such in the result of exec(). To make this work the QMessageDialogOptions::CustomButton needs to learn about custom button identifiers, so we can pass the original standard button though. This moves us closer to a world where the QMessageDialogOptions represent both standard buttons and custom buttons using the same structure, which is what we want anyways, so that we e.g. respect the added order of standard buttons with the same role. Pick-to: 6.5 6.6 Change-Id: Ifb7f7bd537fe71293f14ef6a006999e350bd0b52 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Teach QMessageDialogOptions about default and escape buttonsTor Arne Vestbø2023-10-262-0/+34
| | | | | | | | | | | | | | | | | | There's logic in QMessageBox to resolve the default and escape button if not set by the user. And the user may of course override these. We now propagate the resulting buttons via the dialog helper, and pick them up in the macOS native dialog backend. The only common information we have between the standard buttons and custom buttons is the button identifier, which for standard buttons is the enum value, and for custom buttons is an auto generated identifier. The same identifier is used when reporting the clicked button from the native dialog helper. Fixes: QTBUG-118308 Pick-to: 6.6 6.5 Change-Id: I5ca45604b51f0bbf74e56134d7b55bb8911f3563 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Avoid creating child windows twice when already visibleTor Arne Vestbø2023-10-211-0/+7
| | | | | | | | | | | | | | | | | | | | | | | When a child window is made visible without its parent having been created yet, we defer creating and making the child visible until the parent is created. But if a child window is explicitly created, we create the parent first. And creating the parent will in turn apply visibility to all children that had their visibility deferred. Which includes creating the child. This results in child -> parent -> child creation recursion, which means that when we return from creating the parent window we already have a platform window for our child, and should bail out. Pick-to: 6.6 6.5 Change-Id: I11dc4864b57f031de2cca70b79cdfc057d4fbd0d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* qevent.h: don't include <QPointer>, fwd-declare itMarc Mutz2023-10-181-1/+1
| | | | | | | | | | | | | The header uses QPointer in-name-only, so it doesn't need to include the class' header file. A forward-declaration suffices. [ChangeLog][Potentially Source-Incompatible Changes] The headers qevent.h and qfuture.h no longer include the header qpointer.h. Change-Id: I8d3c3b56f5928a0745a523abf5df3b8106dc15ee Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Remove unnecessary code in QCursorJiDe Zhang2023-10-181-20/+10
| | | | | | | | | Dont't checks before call QCursorData::initialize(). The inside of QCursorData::initialize() already checks initialized. Change-Id: I4b34218132df9decf7d04dcc31e873daf300ffe6 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Liang Qi <liang.qi@qt.io>