summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/kernel
Commit message (Collapse)AuthorAgeFilesLines
* ColorScheme: make QStyleHints::colorScheme writable for applicationsVolker Hilsheimer3 days1-0/+118
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Applications can request the color scheme to be either explicitly light or dark, or to follow the system default by setting the scheme to Qt::ColorScheme::Unknown. Setting the color scheme will make the request to the QPlatformTheme implementation, which can then use the appropriate implementation to set the application's appearance so that both palette and window decoration follow the requested color scheme. This should trigger theme change and palette change events. A change to the effective scheme should then call back into QStyleHintsPrivate::updateColorScheme, which will emit the changed signal for the property. Implement this for macOS (Cocoa), iOS, Android, and Windows. On macOS, we have to use deprecated AppKit APIs; the replacements for those APIs are not suitable for this use case. On iOS, the setting is for each UIWindow, which we can update or initialize based on an explicitly requested scheme. On Android we can piggy-back on the logic added when dark theme support was introduced in b4a9bb1f6a40e6d504c1f48f0d9ea2b70ab1a9f0. On Windows, we have to fake a dark palette if the dark scheme is requested on a light system, as there is no API to read a dark palette. However, we also have to ignore any application preference if a high- contrast accessibility theme is selected by the user (we report the color scheme as unknown; there are both light and dark high-contrast themes), and read the system palette using the GetSysColor API, which is used for light mode. And we need to initialize windows with the correct frame if the application explicitly overrides the system color scheme. Add an auto-test to the QApplication test, as that gives us the most coverage to confirm that QStyleHints emits the changed signal, and that Theme- and PaletteChange events are received by the toplevel widget when the color scheme actually changes. This test has to be skipped on platforms where we cannot set the color scheme programmatically. Add the option to explicitly select the color scheme to the widget gallery example, and default it to dark mode. Fixes: QTBUG-124490 Change-Id: I7302993c0121284bf9d3b72e3149c6abbe6bd261 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QWidget: fix render() in RTL modeChristian Ehrlicher4 days1-0/+42
| | | | | | | | | | | | | | | Rendering a widget to a paintdevice via QWidget::render() did not pass the LayoutDirection mode of the widget to the paintdevice which lead to wrong rendering of text. This is especially visible with the windows 11 style which does not draw some widgets directly on the screen but through a QGraphicsEffect on a QImage. Pick-to: 6.7 6.5 6.2 Fixes: QTBUG-124931 Change-Id: If2cfa326d2ca45c42e203a4ae91fd857afa5c69c Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
* tst_QApplication::focusWidget() remove setActiveWindow() child sectionFrédéric Lefebvre5 days1-1/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 as made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: Ib3b39f4bd51c87eeeebe329ada163f24390f6bc3 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_QApplication::focusWidget() remove setActiveWindow()Frédéric Lefebvre5 days1-1/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 as made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: I160e71302b40777d13e2481447bc47ebfc1a784c Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_QStackedLayout::keepFocusAfterSetCurrent() remove setActiveWindow()Frédéric Lefebvre7 days1-1/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 as made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: Iaf1e79193f0f7013d02d91930cc408af5b0f8e1d Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_QApplication::alert() remove QApplicationPrivate::setActiveWindow()Frédéric Lefebvre10 days1-2/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 as made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: I208ad97d7b56ded15908b96ad03779db849ef6a9 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_QAction::disableShortcutsWithBlockedWidgets remove setActiveWindowFrédéric Lefebvre13 days1-1/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 as made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: Iea02f308c3357ddcb8f52527031b9417d8a175d7 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_QAction::repeat() remove QApplicationPrivate::setActiveWindow()Frédéric Lefebvre13 days1-1/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 as made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: I845a0a9220bca176f9c270cb7aee225325c2e7af Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_QAction::actionEvent() remove QApplicationPrivat::setActiveWindow()Frédéric Lefebvre13 days1-1/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 as made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: I8e58e26382dfc32e0a3475dd601c0377e7378d87 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* test: Don't crash when focusWidget() is nullEskil Abrahamsen Blomfeldt13 days1-14/+21
| | | | | | | | | | | | | If QApplication::focusWidget() returns null, which was the case on Wayland under some circumstances, then the code collecting the error output would crash when dereferencing the null pointer. This fixes that crash and gets proper test failure output instead. Pick-to: 6.5 6.7 Fixes: QTBUG-124475 Change-Id: Ic34228be953cf42dfe2ebf75957cd48791e6de7d Reviewed-by: Liang Qi <liang.qi@qt.io>
* Widgets focus abstraction: Skip isFocusChainConsistent w/o logging catAxel Spoerl2024-04-261-0/+1
| | | | | | | | | | | | | | | | | | QWidgetPrivate::isFocusChainConsistent() iterates over QApplication::allWidgets() to identify and log inconsistencies. In applications with many widgets, this has a major performance impact. Disable the check and return true, unless the logging category qt.widgets.focus is enabled. Adapt tst_QWidget::focusAbstraction() to enable the logging category. This amends 58d5d4b7c2faaeaa2c2ccdabb3da6d37f9db880a. Fixes: QTBUG-124666 Change-Id: Ia487b381ab45b052638b189bf56acaf4353b1a37 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* tst_QWidget_window::tst_dnd() remove setActiveWindow()Frédéric Lefebvre2024-04-261-1/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 has made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: I2acc02ebd0434de54344fa1e5fa488e7cd81c106 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_QTooltip::qtbug64550_stylesheet() remove setActiveWindow()Frédéric Lefebvre2024-04-261-1/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 has made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: I84928725fb9b6d834439aa8a64171dcf3f7a042e Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_QTooltip::keyEvent() remove QApplicationPrivate::setActiveWindow()Frédéric Lefebvre2024-04-261-1/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 has made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: I7f87b71237f679575a093ac5d28ddd2c9a911492 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_QShortcut::duplicatedShortcutOverride() remove setActiveWindow()Frédéric Lefebvre2024-04-261-1/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 has made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: I6ad2841a15dd9286232ad43069e3839faa3fe901 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_QShortcut::context() remove QApplicationPrivate::setActiveWindow()Frédéric Lefebvre2024-04-261-1/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 has made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: I650e67f626865796480c422e9d7ff7dcfd11c9ca Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_QWidget::grabKeyboard remove QApplicationPrivate::setActiveWindow()Frédéric Lefebvre2024-04-231-1/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 has made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: Iea870711410dee1347f1020a6f7afc037e520825 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_QWidget::grabMouse() remove QApplicationPrivate::setActiveWindow()Frédéric Lefebvre2024-04-221-1/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 has made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: I7fd9005ef66c11f640a50f0db468cdcb07eb621f Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_QWidget::imEnabledNotImplemented() remove setActiveWindow()Frédéric Lefebvre2024-04-221-1/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 has made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: I432e7ced3e49b570cf9e4057fe98411271693750 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_QWidget::enterLeaveOnWindowShowHide() remove setActiveWindow()Frédéric Lefebvre2024-04-221-1/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 has made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: Ic189b1c55b6bdf0397636b3ae9555cc38b60fc48 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_QWidget::dumpObjectTree remove QApplicationPrivate::setActiveWindowFrédéric Lefebvre2024-04-221-1/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 has made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: I1cd2d45c54fbeb2b89accc257f2ec5b57f20c013 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_QWidget::clean_qt_x11_enforce_cursor() remove setActiveWindow()Frédéric Lefebvre2024-04-221-1/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 has made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: I2a3f400e58f86cbc339c355977da784ef5c24800 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Set focus to the window container when contained window gains focusDoris Verria2024-04-221-0/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As it is, when a QWindowContainer's embedded window gains focus, the container doesn't report having focus and QApplication::focusWidget() will be nullptr. This is because when the embedded window gets focus, the container will clearFocus() on the old focus widget. To be able to set focus to the next focus widget (eg: as a result of a key tab event sent to the container's parent window), the container checks if its embedded window is already focused, and if so, forwards focus to its nextInFocusChain(). That is why it keeps track of the (old) focusWindow. The problem with the current behavior is that if we want to make focus navigation via key tabbing work and return focus *from within the window* back to the normal widget focus chain, the encapsulating widget needs to remember its focusWidget(), in this case the window container, in order to be able to set focus to the next/PrevInFocusChain(). That is why we now set the focus to the window container whenever its contained window gains focus. This means that QApplication::focusWidget() will be the window container if the contained window has focus. In this way, we don't have to call clearFocus() on the old focus widget, or keep track of focus windows, because calling setFocus() on the container will handle that. It is worth noting and probably documenting the following caveats: - even though the window container will be the qApp's focusWidget(), it won't directly handle keyboard events, but the contained window will - we won't be able to respect the window container's focusPolicy in this case, since the contained window will be activated from interactions inside it, no matter the container's focusPolicy [ChangeLog][QtWidgets][QWindowContainer] The window container will become focused if the contained window becomes focused. This implies that the QApplication::focusWidget() will be the window container if the contained window is the focus window. Task-number: QTBUG-121789 Change-Id: I1050afc59780f7189a0d8e8c95bff27f96f38dbc Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_QWidget::showAndMoveChild() remove setActiveWindow()Frédéric Lefebvre2024-04-191-1/+0
| | | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 has made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: I7bd841574c07d73416f9f63d564fe31a8475fa9e Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* tst_QWidget::showMinimizedKeepsFocus() remove setActiveWindow()Frédéric Lefebvre2024-04-191-5/+0
| | | | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 has made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls from testing deletion of the focusWidget, testing reparenting of the focus widget, testing setEnabled(false) and testing clearFocus sections. Task-number: QTBUG-121488 Change-Id: I7e46ddb31bd7dbc0492d057d8d84846db8c873aa Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_QWidget::explicitTabOrderWithSpinBox_QTBUG81097 remove setActiveWinFrédéric Lefebvre2024-04-191-1/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 has made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: I5d6871b192b5c4dda00ef912a806e62a529b629e Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_QWidget::appFocusWidgetWhenLosingFocusProxy remove setActiveWindowFrédéric Lefebvre2024-04-191-1/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 has made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: I2841522f533c7679cc9c254c5fe7c37f5632fd30 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_QWidget::appFocusWidgetWithFocusProxyLater remove setActiveWindow()Frédéric Lefebvre2024-04-191-1/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 has made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: I4a0d026fbe5da014723254bb9eb8d614cf50232f Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_QWidget::focusChainOnHide remove QApplicationPrivate::setActiveWindFrédéric Lefebvre2024-04-181-2/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 has made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: I5b429dcaa47cd179785345f9f7a80648574670dd Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Android: blacklist tst_QWidget::setParentChangesFocusAssam Boudjelthia2024-04-121-1/+3
| | | | | | | | | This fails on Android 8, and we want to get Android 8 bump into the CI. Pick-to: 6.7 Task-number: QTBUG-124291 Change-Id: I179880c38d155df82bcb772f546104d956326647 Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
* Implement QWindowContainer::minimumSizeHint()Jan Arve Sæther2024-04-121-0/+24
| | | | | | | | | | | | It will return the minimumSize of the underlying QWindow. The container can then be put inside QLayouts without risking to be shrunk to a smaller size than the QWindow::minimumSize. Whenever the QWindow::minimumWidth or QWindow::minimumHeight changes, we call QWindowContainer::updateGeometry(), which will make the layout re-query QWindowContainer::minimumSizeHint() again. Task-number: QTBUG-121798 Change-Id: Ib7ece7d9d75f2e4964ca9042d8d8b95ce3b17739 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QLayout: Consume ChildRemoved event, when layout is disabledAxel Spoerl2024-04-101-3/+9
| | | | | | | | | | | | | | | QLayout::widgetEvent() returned early, when the layout was disabled. That suppressed ChildRemoved events and lead to a crash, when the layout was enabled again. Don't return early on ChildRemoved events. Add an autotest in tst_layout::removeWidget(). Fixes: QTBUG-124151 Pick-to: 6.7 6.5 6.2 Change-Id: Ib0a0bb73978d9fc2c9777d300cf38a8c4496b702 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Chris René Lerner <chris.lerner@qt.io>
* Abstract QWidget focus chain managementAxel Spoerl2024-04-041-0/+87
| | | | | | | | | | | | | | | | | | | The focus chain in widgets is implemented as a double-linked list, using QWidgetPrivate::focus_next and focus_prev as pointers to the next/previous widget in the focus chain. These pointers are manipulated directly at many places, which is error prone and difficult to read. Build an abstraction layer and remove direct usage of focus_next and focus_prev. Provide functions to insert and remove widgets to/from the focus chain. Add a test function to tst_QWidget. Task-number: QTBUG-121478 Change-Id: Ide6379c0197137e420352a2976912f2de8a8b338 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Decouple rate-limiting of paint-on-screen widgets from top level widgetTor Arne Vestbø2024-04-041-0/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As part of eacd58d4e78e7238ba5fcca90ba960aaf3ebd263, a mechanism was added to prevent posting redundant UpdateRequest events to the top level widget, managed by QWidgetRepaintManager. The mechanism relied on a boolean that was set when posting an update request event, and reset when processing the event for the top level widget, as part of QWidgetRepaintManager::sync(). However, for paint-on-screen widgets, we don't post an update request to the top level, we post it to the paint-on-screen widget directly. And when processing that event, we don't paint the widget though the normal QWidgetRepaintManager machinery, but instead call the paint event via QWidgetPrivate::paintOnScreen(). As a result, an update() on a paint-on-screen widget would result in never receiving updates for non-paint-on-screen widgets, as we assumed there was no reason to send further update requests. We could fix this by clearing the updateRequestSent flag as part of the paintOnScreen() code path, but that's incorrect as the flag represents whether the top level QWidgetRepaintManager needs an update request event or not, and would lead to missed updates to normal widgets until the paint-on-screen widget finishes its update. Instead, we only set updateRequestSent if we're posting update requests for non-paint-on-screen widgets, which in practice means the top level widget. The paint on screen logic in QWidgetRepaintManager::markDirty still takes care of rate-limiting the update requests to the paint-on-screen widget, by comparing the dirty area of the widget. There is definite room for improvement here, especially in the direction of handling update requests via QWindow::requestUpdate instead of manually posted events, but for now this will have to do. Fixes: QTBUG-80167 Pick-to: 6.7 6.6 6.5 6.2 5.15 Change-Id: Ib5685de7ca2fd7cd7883a25bb7bc0255ea242d30 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Tests: check the output of QFile::openGiuseppe D'Angelo2024-03-271-2/+1
| | | | | | | | | | Wrap the call in QVERIFY. tst_QTextStream::read0d0d0a was also faulty as it *never* opened the file because of a broken path. Fix it with QFINDTESTDATA. Change-Id: I61a8f83beddf098d37fda13cb3bfb4aaa4913fc5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tst_QWidget::reverseTabOrder remove QApplicationPrivate::setActiveWindoFrédéric Lefebvre2024-03-251-1/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 has made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: Ifd2c5dcd1cc3d13f689ffd6400ffec0fcc3a6b93 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_QWidget: use focus abstraction instead of focus_next/prevAxel Spoerl2024-03-221-14/+20
| | | | | | | | | | | | Focus abstraction in QWidgetPrivate makes direct access to QWidget::focus_next and focus_prev an antipattern. Remove usage. Add object names for better diagnostics when debugging focus issues. Task-number: QTBUG-121478 Change-Id: Iecd3bdc824bf77c519951f8f7801eb50b29a6e00 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* tst_QWidget::tabOrderWithProxy remove QApplicationPrivate::setActiveWindFrédéric Lefebvre2024-03-221-1/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 has made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: Id3b9967ddaa7dbb87eef9faaf4681d7cb014ba8c Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_QWidget::tabOrderWithProxyDisabled() remove setActiveWindow()Frédéric Lefebvre2024-03-221-1/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 has made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: I88d39def0e85e147b3621d98d150ee65463be94f Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_QWidget::tabOrderWithCompoundWidgets() remove setActiveWindow()Frédéric Lefebvre2024-03-221-1/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 has made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: If805bc0e021625b94edc83d7abccc435c1880bea Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_QWidget::tabOrderWithProxyOutOfOrder() remove setActiveWindow()Frédéric Lefebvre2024-03-221-1/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 has made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: I7a4b21018216c2b7cced8d4aa5084c527b694f4a Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_QWidget::tabOrderWithCompoundWidgetsNoFocusPolicy remove setActiveWFrédéric Lefebvre2024-03-221-1/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 has made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: Ieb516cc4fd02230c0ec6bb189da049c3741358dd Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_QWidget::defaultTabOrder() remove setActiveWindow()Frédéric Lefebvre2024-03-221-1/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 has made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: I2faaf575a04652a395956c7d790ac18d9f3ec9e6 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* tst_QWidget::explicitTabOrderWithComplexWidget remove setActiveWindow()Frédéric Lefebvre2024-03-221-1/+0
| | | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 has made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: I0271f3baf718ca5ae03464bbd415cd0feaa9087d Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* tests: skip tst_QApplication::abortQuitOnShow() on WaylandLiang Qi2024-03-221-0/+3
| | | | | | | | The test started to "crash" since 576c9160b12ac5efc76d06ca7ccc856aad2b051a. Task-number: QTBUG-123172 Change-Id: I16c78f517f718510aa22a2e24ed3d502edae52e5 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Reparent QWindow children when reparenting QWidgetTor Arne Vestbø2024-03-141-0/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a QWidget was reparented, we would take care to reparent its backing QWidgetWindow as well, into the nearest QWindow of the new QWidget parent. However we would only do this for the reparented widget itself, and not any of its child widgets. In the case where the widget has native children with their own QWindows, the widget itself may not (yet) be native, e.g. if it hasn't been shown yet, or if the user has set Qt::WA_DontCreateNativeAncestors. In these scenarios, we would be left with dangling QWindows, still hanging off their original QWindow parents, which would eventually lead to crashes. We now reparent both the QWindow of the reparented widget (as long as it's not about to be destroyed), and any QQWindow children we can reach. For each child hierarchy we can stop once we reach a QWindow, as the QWindow children of that window will follow along once we reparent the QWindow. QWindowContainer widgets don't usually have their own windowHandle(), but still manage a QWindow inside their parent widget hierarchy. These will not be reparented during QWidgetPrivate::setParent_sys(), but instead do their own reparenting later in QWidget::setParent via QWindowContainer::parentWasChanged(). The only exception to this is when the top level is about to be destroyed, in which case we let the window container know during QWidgetPrivate::setParent_sys(). Finally, although there should not be any leftover QWindows in the reparented widget once we have done the QWidgetWindow and QWindowContainer reparenting, we still do a pass over any remaining QWindows and reparent those too, since the original code included this as a possibility. We could make further improvements in this areas, such as moving the QWindowContainer::parentWasChanged() call, but the goal was to keep this change as minimal as possible so we can back-port it. Fixes: QTBUG-122747 Pick-to: 6.7.0 6.7 6.6 6.5 Change-Id: I4d1217fce4c3c48cf5f7bfbe9d561ab408ceebb2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Revert "tests: blacklist tst_QWidget::render() on Wayland"Liang Qi2024-03-041-2/+0
| | | | | | | | | | | | This reverts commit c41733b06bd61d4710a9f6ec849f0d913c4497bb. Based on the Grafana data, last flaky was August 14, 2023, and the test works fine on local vm with stressed cpu. Fixes: QTBUG-115598 Pick-to: 6.7 6.6 6.5 Change-Id: I634598d20a581d4d1443a3fd81e1e9481bfa2545 Reviewed-by: Inho Lee <inho.lee@qt.io>
* Implement Qt::ImEnabled by isEnabled() and isReadOnly()Yansheng Zhu2024-03-011-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, querying Qt::ImEnabled only returned the value of isEnabling(), which is incorrect for edit widgets with read-only properties set, as Qt::ImEnabled indicates whether text can be *input* through the input method, which results in the IM being able to insert text into read-only edit widgets. The fixed version uses both isEnabling() and isReadOnly() values to determine whether input methods need to be enabled. For some platforms (like iOS and Android) that rely on IM to select text, a check for ImReadOnly has been added to their QPA plugins to enable handles on read-only input boxes. At the same time, the imEnabledNotImplemented function in the test file tst_qwidget was modified, since ImEnabling should give a _false_ value when a lineedit is read-only. Task-number: QTBUG-105009 Task-number: QTBUG-110838 Task-number: QTBUG-119182 Pick-to: 6.7 6.6 6.5 Change-Id: Ia2abcdb3200826d567f90447d4f8b71d0ef1fbf0 Reviewed-by: Yansheng Zhu <670429759@qq.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Android: Make timeout in tst_QApplication::abortQuitOnShow() longerTinja Paavoseppä2024-02-272-5/+7
| | | | | | | | | | | | | | Since the Android emulator on CI is running without hardware accelerated graphics, showing the widget can take almost the same time as the timeout for exiting the app with the "wrong" exit code 1. If running on Android, increase the timeout to 1000 ms to avoid flaky failures. Un-blacklist tst_QApplication::abortQuitOnShow() since the random failures are taken care of by this patch. Task-number: QTBUG-122693 Pick-to: 6.7 Change-Id: Id52ae15b3ab2dbdaf4924b675276dfe3a4168585 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* tst_QWidget::realFocusChain: don't remove from iterated QListChris Lerner2024-02-241-5/+6
| | | | | | | | | | | | | | The method removed from QWidgetList widgets in a ranged for loop. That caused items being skipped. Create a new list by adding positives, instead of removing negatives from the original. This amends b1802a164b8682ed9e8956a5a19a90ade65c25d0. Pick-to: 6.7 6.6 Change-Id: I3f329290187ddc76169ababe8ffa6059d953212d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>