summaryrefslogtreecommitdiffstats
path: root/src/plugins/accessible
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@nokia.com>2011-03-18 16:41:01 (GMT)
committerFrederik Gladhorn <frederik.gladhorn@nokia.com>2011-03-23 12:57:37 (GMT)
commitfdeeaa9d61efea9cca783a1d4098ae505df24390 (patch)
tree8a58730f1fe2c4f9ece691c181e610b9da4388e1 /src/plugins/accessible
parent6040eeebfb1ab3be3906295c373033cd5b5d9dc3 (diff)
downloadQt-fdeeaa9d61efea9cca783a1d4098ae505df24390.zip
Qt-fdeeaa9d61efea9cca783a1d4098ae505df24390.tar.gz
Qt-fdeeaa9d61efea9cca783a1d4098ae505df24390.tar.bz2
Make navigation in TabWidgets consistent.
navigate would not return the right index in the parent if the current widget was not the visible one. Reviewed-by: Jan-Arve
Diffstat (limited to 'src/plugins/accessible')
-rw-r--r--src/plugins/accessible/widgets/qaccessiblewidgets.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp
index c9db1dc..4402932 100644
--- a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp
+++ b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp
@@ -401,9 +401,14 @@ int QAccessibleStackedWidget::childCount() const
int QAccessibleStackedWidget::indexOfChild(const QAccessibleInterface *child) const
{
- if (!child || (stackedWidget()->currentWidget() != child->object()))
+ if (!child)
return -1;
- return 1;
+
+ QWidget* widget = qobject_cast<QWidget*>(child->object());
+ int index = stackedWidget()->indexOf(widget);
+ if (index >= 0) // one based counting of children
+ return index + 1;
+ return -1;
}
int QAccessibleStackedWidget::navigate(RelationFlag relation, int entry, QAccessibleInterface **target) const
@@ -413,9 +418,9 @@ int QAccessibleStackedWidget::navigate(RelationFlag relation, int entry, QAccess
QObject *targetObject = 0;
switch (relation) {
case Child:
- if (entry != 1)
+ if (entry < 1 || entry > stackedWidget()->count())
return -1;
- targetObject = stackedWidget()->currentWidget();
+ targetObject = stackedWidget()->widget(entry-1);
break;
default:
return QAccessibleWidgetEx::navigate(relation, entry, target);