summaryrefslogtreecommitdiffstats
path: root/src/plugins/accessible/widgets/complexwidgets.cpp
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@nokia.com>2011-09-15 21:41:54 +0200
committerQt by Nokia <qt-info@nokia.com>2011-09-19 12:06:13 +0200
commit76d0d1926466d42b1b25f0bac642c1e0f239074c (patch)
tree84397813957307cf1ac393ac29d045acc6e08846 /src/plugins/accessible/widgets/complexwidgets.cpp
parent3647a00d47fd774daccce9f143cc2046fb59099d (diff)
Add parent and child functions to QAccessibleInterface.
Stop the mis-use of navigate to find the parent. In order to make navigation straight forward parent and child functions are now part of QAccessibleInterface. This allows navigating the hierarchy of accessible objects without the 1-based indexes in the navigate function which lead to confusion. Eventually the support for Ancestor in navigate can be completely removed and forwarded in the windows bridge if needed. In addition default parameters for virtual children. This will make the transition smooth since it allows to remove the integer already. Change-Id: I278287ce17161f9fa46797ac244676778c859576 Reviewed-on: http://codereview.qt-project.org/5024 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com> Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
Diffstat (limited to 'src/plugins/accessible/widgets/complexwidgets.cpp')
-rw-r--r--src/plugins/accessible/widgets/complexwidgets.cpp34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/plugins/accessible/widgets/complexwidgets.cpp b/src/plugins/accessible/widgets/complexwidgets.cpp
index c1f70ac581..020ad06815 100644
--- a/src/plugins/accessible/widgets/complexwidgets.cpp
+++ b/src/plugins/accessible/widgets/complexwidgets.cpp
@@ -481,6 +481,17 @@ QAbstractItemView::CursorAction QAccessibleItemRow::toCursorAction(
return QAbstractItemView::MoveRight;
}
+QAccessibleInterface *QAccessibleItemRow::parent() const
+{
+ return new QAccessibleItemView(view->viewport());
+}
+
+QAccessibleInterface *QAccessibleItemRow::child(int index) const
+{
+ // FIXME? port to IA2 table2.
+ return 0;
+}
+
int QAccessibleItemRow::navigate(RelationFlag relation, int index,
QAccessibleInterface **iface) const
{
@@ -489,19 +500,9 @@ int QAccessibleItemRow::navigate(RelationFlag relation, int index,
return -1;
switch (relation) {
- case Ancestor: {
- if (!index)
- return -1;
- QAccessibleItemView *ancestor = new QAccessibleItemView(view->viewport());
- if (index == 1) {
- *iface = ancestor;
- return 0;
- } else if (index > 1) {
- int ret = ancestor->navigate(Ancestor, index - 1, iface);
- delete ancestor;
- return ret;
- }
- }
+ case Ancestor:
+ *iface = parent();
+ return *iface ? 0 : -1;
case Child: {
if (!index)
return -1;
@@ -1487,10 +1488,14 @@ public:
QString text(Text, int) const { return qt_accStripAmp(m_parent->tabText(m_index)); }
void setText(Text, int, const QString &) {}
+ QAccessibleInterface *parent() const {
+ return QAccessible::queryAccessibleInterface(m_parent);
+ }
+ QAccessibleInterface *child(int) const { return 0; }
int navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const
{
if (relation == QAccessible::Ancestor && index == 1) {
- *iface = QAccessible::queryAccessibleInterface(m_parent);
+ *iface = parent();
return 0;
}
return -1;
@@ -1842,6 +1847,7 @@ int QAccessibleComboBox::childAt(int x, int y) const
if (rect(i).contains(x, y))
return i;
}
+ Q_ASSERT(0);
return 0;
}