Implement child instead of navigate in QAccessibleMainWindow.

Change-Id: I321ce4f8bb6e724db87a0419f890174b32cc1fe2
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
This commit is contained in:
Frederik Gladhorn 2011-10-22 17:52:13 +02:00 committed by Qt by Nokia
parent c3313fdd1c
commit b8d702dc8e
2 changed files with 11 additions and 14 deletions

View File

@ -1634,6 +1634,15 @@ QVariant QAccessibleMainWindow::invokeMethod(QAccessible::Method /*method*/, int
return QVariant();
}
QAccessibleInterface *QAccessibleMainWindow::child(int index) const
{
QList<QWidget*> kids = childWidgets(mainWindow(), true);
if (index < kids.count()) {
return QAccessible::queryAccessibleInterface(kids.at(index));
}
return 0;
}
int QAccessibleMainWindow::childCount() const
{
QList<QWidget*> kids = childWidgets(mainWindow(), true);
@ -1647,18 +1656,6 @@ int QAccessibleMainWindow::indexOfChild(const QAccessibleInterface *iface) const
return childIndex == -1 ? -1 : ++childIndex;
}
int QAccessibleMainWindow::navigate(RelationFlag relation, int entry, QAccessibleInterface **iface) const
{
if (relation == Child && entry >= 1) {
QList<QWidget*> kids = childWidgets(mainWindow(), true);
if (entry <= kids.count()) {
*iface = QAccessible::queryAccessibleInterface(kids.at(entry - 1));
return *iface ? 0 : -1;
}
}
return QAccessibleWidget::navigate(relation, entry, iface);
}
int QAccessibleMainWindow::childAt(int x, int y) const
{
QWidget *w = widget();

View File

@ -299,13 +299,13 @@ class QAccessibleMainWindow : public QAccessibleWidget
public:
explicit QAccessibleMainWindow(QWidget *widget);
QVariant invokeMethod(QAccessible::Method method, int child, const QVariantList &params);
QAccessibleInterface *child(int index) const;
int childCount() const;
int navigate(RelationFlag relation, int entry, QAccessibleInterface **iface) const;
int indexOfChild(const QAccessibleInterface *iface) const;
int childAt(int x, int y) const;
QMainWindow *mainWindow() const;
QVariant invokeMethod(QAccessible::Method method, int child, const QVariantList &params);
};
#endif //QT_NO_MAINWINDOW