Skip to content

Commit

Permalink
Fix tree/table/list accessibility state
Browse files Browse the repository at this point in the history
The accessibility class associated with trees, tables and lists was
reporting a default/empty state, causing issues with accessibility
tools.

Fixes: QTBUG-92964
Pick-to: 6.4 6.3 6.2
Change-Id: I9c8ee5e7e582fd6b6a59cd70437eeddad0f4eb8e
Reviewed-by: Volker Hilsheimer <[email protected]>
  • Loading branch information
André de la Rocha committed Aug 31, 2022
1 parent f082458 commit 0d3f09a
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/widgets/accessible/itemviews.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,27 @@ QAccessible::Role QAccessibleTable::role() const

QAccessible::State QAccessibleTable::state() const
{
return QAccessible::State();
QAccessible::State state;
const auto *w = view();

if (w->testAttribute(Qt::WA_WState_Visible) == false)
state.invisible = true;
if (w->focusPolicy() != Qt::NoFocus)
state.focusable = true;
if (w->hasFocus())
state.focused = true;
if (!w->isEnabled())
state.disabled = true;
if (w->isWindow()) {
if (w->windowFlags() & Qt::WindowSystemMenuHint)
state.movable = true;
if (w->minimumSize() != w->maximumSize())
state.sizeable = true;
if (w->isActiveWindow())
state.active = true;
}

return state;
}

QAccessibleInterface *QAccessibleTable::childAt(int x, int y) const
Expand Down

0 comments on commit 0d3f09a

Please sign in to comment.