diff options
| author | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2022-12-20 15:57:23 +0100 |
|---|---|---|
| committer | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2023-01-20 20:39:11 +0100 |
| commit | ea5200b82f21e0f4d080d3fc256b218e0ee56f3d (patch) | |
| tree | be8473c4b27dec02305d71e0e36600646004a5cb /src/quickcontrols/qtquickcontrols2plugin.cpp | |
| parent | e34142e6cda177b601d8e5daba00a2ab84828db1 (diff) | |
QQuickTableView: set active focus directly on the edit item
When starting to edit a cell, the current implementation
calls editItem->nextItemInFocusChain(true) to resolve the
child to get active focus. But a better way is to instead
rely on the edit item being a FocusScope. That way, we can
simply set active focus on the edit item directly, and rely
on the FocusScope forwarding active focus to the right child.
After all, that is what FocusScopes are for.
This patch will therefore change the implementation to set active
focus directly on the edit item.
But doing so turns out to cause tabbing from one cell
to the next to stop working. The reason is that QQuickItem refuses
to change setActiveFocusOnTab() on an item that has active focus.
Instead, the focus item will eat the tab event, and
use it to transfer focus to the next control in the chain.
We therefore change the implementation to use an event filter on the
focus object. That way, we're are guaranteed to always get a first
shot at handling all critical key events that are needed for editing
to work correctly. This includes tabbing, but even more
imporantant, also Qt::Key_Enter, which is needed to allow
the user to commit and close the editor.
Pick-to: 6.5
Change-Id: I215b7efc52093eb0bd7f6a4fb60a57f83101e288
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/quickcontrols/qtquickcontrols2plugin.cpp')
0 files changed, 0 insertions, 0 deletions
