Commit efc64b65 authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Announce current item when certificate list gets focus

QTreeView sends the accessible focus event for the current item (resp.
table cell) before the accessible focus event for the view itself when
the view gets focus. Screen readers (e.g. orca) ignore the first focus
event in favor of the later focus event and do not announce the focussed
table cell. Therefore, we force QTreeView to send another focus event
for the table cell by unsetting and re-setting the current index when the
view gets focus.

GnuPG-bug-id: 6095
parent a81947bf
......@@ -116,9 +116,27 @@ protected:
return false;
}
void focusInEvent(QFocusEvent *event) override
{
QTreeView::focusInEvent(event);
// queue the invokation, so that it happens after the widget itself got focus
QMetaObject::invokeMethod(this, &TreeView::forceAccessibleFocusEventForCurrentItem, Qt::QueuedConnection);
}
void keyPressEvent(QKeyEvent *event) override;
QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override;
private:
void forceAccessibleFocusEventForCurrentItem()
{
// force Qt to send a focus event for the current item to accessibility
// tools; otherwise, the user has no idea which item is selected when the
// list gets keyboard input focus
const auto current = currentIndex();
setCurrentIndex({});
setCurrentIndex(current);
}
private:
bool mMoveCursorUpdatedView = false;
QMenu *mHeaderPopup = nullptr;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment