Explicitly set cursor position as workaround for event order problem
If a line edit gets focus and there is no selection, then the line edit selects all text. If an empty line edit gets focus for the first time, then selecting all text triggers a cursor changed signal and an accessible text cursor event. By this time, the line edit is already set as focus widget, but the accessible focus event has not yet been sent. orca sets the line edit as locus of focus when it receives a text cursor event for an item with the focused flag. This makes orca ignore the focus event following the text cursor event, so that the newly focused line edit is not announced to the user. This might be considered bug in orca, but maybe other screen readers behave similarly. Explicitly setting the cursor position to 0 prevents the emission of the accessible text cursor event when the line edit gets the input focus (because Qt doesn't emit this event twice for the same cursor position), so that orca properly announces the line edit....
Please register or sign in to comment