Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.6.1
-
None
-
x86_64 linux, Sway (tiling Wayland compositor)
Description
TextEdit focused from code behaves differently to when it is clicked by mouse.
Minimal example:
import QtQuick.Window Window { visible: true TextEdit { focus: true anchors.fill: parent text: "Some Content" persistentSelection: true } }
Running with qml, selecting text with keyboard (Shift+Right) and switching to another app (Alt+Tab) will reset selection, meaning persistentSelection plain out doesn't work.
Click on TextEdit with mouse, then select with keyboard and switch to another app - selection stays.
(Same behaviour can be observed with standard text editor example)
I've tracked it down to QQuickTextControlPrivate::cursorIsFocusIndicator (set by mouse click and checked on focus loss), but with all the interconnected logic required fix isn't obvious.
And affected behavior isn't limited to persistentSelection as I initially stumbled on problem when trying to focus Popup from TextArea, only for it to close immediately (my guess is that selection reset steals focus back to TextArea)