From 30ad53a0a6b1f6d5d50fe12777dc1045dec22803 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Mon, 9 Jan 2012 13:13:33 +0100 Subject: Make QAccessibleInterface::indexOfChild() 0-based. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Makes the code nicer and more consistent with the rest of the world. Change-Id: I5ba0ee39f5b0afd1a079a3cea9990d123955ed3f Reviewed-by: Jan-Arve Sæther --- src/gui/accessible/qaccessible.cpp | 5 ++--- src/gui/accessible/qaccessibleobject.cpp | 5 +---- 2 files changed, 3 insertions(+), 7 deletions(-) (limited to 'src/gui') diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index 2831f24ac8..41382c48b3 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -799,9 +799,8 @@ void QAccessible::updateAccessibility(QObject *object, int child, Event reason) /*! \fn int QAccessibleInterface::indexOfChild(const QAccessibleInterface *child) const - Returns the 1-based index of the object \a child in this object's - children list, or -1 if \a child is not a child of this object. 0 - is not a possible return value. + Returns the 0-based index of the object \a child in this object's + children list, or -1 if \a child is not a child of this object. All objects provide this information about their children. diff --git a/src/gui/accessible/qaccessibleobject.cpp b/src/gui/accessible/qaccessibleobject.cpp index cde375aaa5..e271df2a13 100644 --- a/src/gui/accessible/qaccessibleobject.cpp +++ b/src/gui/accessible/qaccessibleobject.cpp @@ -221,10 +221,7 @@ int QAccessibleApplication::childCount() const int QAccessibleApplication::indexOfChild(const QAccessibleInterface *child) const { const QObjectList tlw(topLevelObjects()); - int index = tlw.indexOf(child->object()); - if (index != -1) - ++index; - return index; + return tlw.indexOf(child->object()); } /*! \reimp */ -- cgit v1.2.3