Add a function to get all relations of an accessible.

Add a default implementation for RelationTo.
Usually this should be empty and it is pointless to return
the parent-child releations in this function.
Instead we will have proper parent-child functions and also
remove this functionallity from navigate.

Having default implementations for these removes the
necessity to reimplement them to return Unrelated in
many places.

Change-Id: I13b7ad3256533681e5a0548ae15da98ca0d16b94
Reviewed-on: http://codereview.qt-project.org/4785
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
bb10
Frederik Gladhorn 2011-08-24 16:16:14 +02:00 committed by Qt by Nokia
parent 86765166b9
commit 92be18bfd0
2 changed files with 25 additions and 4 deletions

View File

@ -822,16 +822,35 @@ const QAccessibleInterface *other, int otherChild) const
is returned.
The returned value indicates the relation of the called object to
the \a other object, e.g. if this object is a child of \a other
the return value will be \c Child.
the \a other object, e.g. if this object is a label for \a other
the return value will be \c Label.
Usually parent-child relations are not returned.
The return value is a combination of the bit flags in the
QAccessible::Relation enumeration.
All objects provide this information.
\sa indexOfChild(), navigate()
\sa relations(), indexOfChild(), navigate()
*/
QAccessible::Relation QAccessibleInterface::relationTo(int,
const QAccessibleInterface *, int) const
{
return Unrelated;
}
/*!
Returns the meaningful relations to other widgets. Usually this will not return parent/child
relations, unless they are handled in a specific way such as in tree views.
It will typically return the labelled-by and label relations.
\sa relationTo(), navigate()
*/
QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > QAccessibleInterface::relations() const
{
return QVector<QPair<QAccessibleInterface*, Relation> >();
}
/*!
\fn int QAccessibleInterface::childAt(int x, int y) const

View File

@ -379,7 +379,9 @@ public:
// relations
virtual Relation relationTo(int child, const QAccessibleInterface *other,
int otherChild) const = 0;
int otherChild) const;
virtual QVector<QPair<QAccessibleInterface*, Relation> > relations() const;
virtual int childAt(int x, int y) const = 0;
// navigation