a11y: Report app as parent for top-level item views
As happens for other widgets (s. QAccessibleWidget::parentObject), report the app as accessible parent for item views that don't have another parent set. Otherwise, the accessible tree is broken when there's a top-level item view: The application has the item view as a child, but the child does not have any parent set. Extend a QListView autotest accordingly. Fixes: QTBUG-115135 Pick-to: 6.6 6.5 Change-Id: Ie06874681180a30fc6248dc98f80c4158d837278 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
60f706063a
commit
6ec35ff8c5
@ -557,7 +557,7 @@ QAccessibleInterface *QAccessibleTable::parent() const
|
|||||||
}
|
}
|
||||||
return QAccessible::queryAccessibleInterface(view()->parent());
|
return QAccessible::queryAccessibleInterface(view()->parent());
|
||||||
}
|
}
|
||||||
return nullptr;
|
return QAccessible::queryAccessibleInterface(qApp);
|
||||||
}
|
}
|
||||||
|
|
||||||
QAccessibleInterface *QAccessibleTable::child(int logicalIndex) const
|
QAccessibleInterface *QAccessibleTable::child(int logicalIndex) const
|
||||||
|
@ -2878,6 +2878,12 @@ void tst_QAccessibility::listTest()
|
|||||||
QCOMPARE(iface->indexOfChild(child3), 2);
|
QCOMPARE(iface->indexOfChild(child3), 2);
|
||||||
QCOMPARE(child3->text(QAccessible::Name), QString("Brisbane"));
|
QCOMPARE(child3->text(QAccessible::Name), QString("Brisbane"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check that application is accessible parent, since it's a top-level widget
|
||||||
|
QAccessibleInterface *parentIface = iface->parent();
|
||||||
|
QVERIFY(parentIface);
|
||||||
|
QVERIFY(parentIface->role() == QAccessible::Application);
|
||||||
|
|
||||||
QTestAccessibility::clearEvents();
|
QTestAccessibility::clearEvents();
|
||||||
|
|
||||||
// Check for events
|
// Check for events
|
||||||
|
Loading…
x
Reference in New Issue
Block a user