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 Change-Id: Ie06874681180a30fc6248dc98f80c4158d837278 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 6ec35ff8c56222a317b838b6aac390eb6974de85) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
be9797b6b6
commit
08c1f77c9a
@ -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