summaryrefslogtreecommitdiffstats
path: root/src/plugins/accessible
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/accessible')
-rw-r--r--src/plugins/accessible/widgets/complexwidgets.cpp114
-rw-r--r--src/plugins/accessible/widgets/complexwidgets.h1
-rw-r--r--src/plugins/accessible/widgets/qaccessiblemenu.cpp27
-rw-r--r--src/plugins/accessible/widgets/qaccessiblewidgets.cpp211
-rw-r--r--src/plugins/accessible/widgets/qaccessiblewidgets.h4
5 files changed, 3 insertions, 354 deletions
diff --git a/src/plugins/accessible/widgets/complexwidgets.cpp b/src/plugins/accessible/widgets/complexwidgets.cpp
index 94eb535791..a8f477e261 100644
--- a/src/plugins/accessible/widgets/complexwidgets.cpp
+++ b/src/plugins/accessible/widgets/complexwidgets.cpp
@@ -414,120 +414,6 @@ bool QAccessibleAbstractScrollArea::isValid() const
return (QAccessibleWidget::isValid() && abstractScrollArea() && abstractScrollArea()->viewport());
}
-int QAccessibleAbstractScrollArea::navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const
-{
- if (!target)
- return -1;
-
- *target = 0;
-
- QWidget *targetWidget = 0;
- QWidget *entryWidget = 0;
-
- if (relation == QAccessible::Left || relation == QAccessible::Up || relation == QAccessible::Right || relation == QAccessible::Down) {
- QWidgetList children = accessibleChildren();
- if (entry < 0 || entry > children.count())
- return -1;
-
- if (entry == Self)
- entryWidget = abstractScrollArea();
- else
- entryWidget = children.at(entry - 1);
- AbstractScrollAreaElement entryElement = elementType(entryWidget);
-
- // Not one of the most beautiful switches I've ever seen, but I believe it has
- // to be like this since each case need special handling.
- // It might be possible to make it more general, but I'll leave that as an exercise
- // to the reader. :-)
- switch (relation) {
- case QAccessible::Left:
- if (entry < 1)
- break;
- switch (entryElement) {
- case Viewport:
- if (!isLeftToRight())
- targetWidget = abstractScrollArea()->verticalScrollBar();
- break;
- case HorizontalContainer:
- if (!isLeftToRight())
- targetWidget = abstractScrollArea()->cornerWidget();
- break;
- case VerticalContainer:
- if (isLeftToRight())
- targetWidget = abstractScrollArea()->viewport();
- break;
- case CornerWidget:
- if (isLeftToRight())
- targetWidget = abstractScrollArea()->horizontalScrollBar();
- break;
- default:
- break;
- }
- break;
- case QAccessible::Right:
- if (entry < 1)
- break;
- switch (entryElement) {
- case Viewport:
- if (isLeftToRight())
- targetWidget = abstractScrollArea()->verticalScrollBar();
- break;
- case HorizontalContainer:
- targetWidget = abstractScrollArea()->cornerWidget();
- break;
- case VerticalContainer:
- if (!isLeftToRight())
- targetWidget = abstractScrollArea()->viewport();
- break;
- case CornerWidget:
- if (!isLeftToRight())
- targetWidget = abstractScrollArea()->horizontalScrollBar();
- break;
- default:
- break;
- }
- break;
- case QAccessible::Up:
- if (entry < 1)
- break;
- switch (entryElement) {
- case HorizontalContainer:
- targetWidget = abstractScrollArea()->viewport();
- break;
- case CornerWidget:
- targetWidget = abstractScrollArea()->verticalScrollBar();
- break;
- default:
- break;
- }
- break;
- case QAccessible::Down:
- if (entry < 1)
- break;
- switch (entryElement) {
- case Viewport:
- targetWidget = abstractScrollArea()->horizontalScrollBar();
- break;
- case VerticalContainer:
- targetWidget = abstractScrollArea()->cornerWidget();
- break;
- default:
- break;
- }
- break;
- default:
- break;
- }
- } else {
- return QAccessibleWidget::navigate(relation, entry, target);
- }
-
- if (qobject_cast<const QScrollBar *>(targetWidget))
- targetWidget = targetWidget->parentWidget();
- *target = QAccessible::queryAccessibleInterface(targetWidget);
- return *target ? 0: -1;
-}
-
QAccessibleInterface *QAccessibleAbstractScrollArea::childAt(int x, int y) const
{
if (!abstractScrollArea()->isVisible())
diff --git a/src/plugins/accessible/widgets/complexwidgets.h b/src/plugins/accessible/widgets/complexwidgets.h
index 24c033bda3..3145c5255f 100644
--- a/src/plugins/accessible/widgets/complexwidgets.h
+++ b/src/plugins/accessible/widgets/complexwidgets.h
@@ -79,7 +79,6 @@ public:
int childCount() const;
int indexOfChild(const QAccessibleInterface *child) const;
bool isValid() const;
- int navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const;
QAccessibleInterface *childAt(int x, int y) const;
//protected:
diff --git a/src/plugins/accessible/widgets/qaccessiblemenu.cpp b/src/plugins/accessible/widgets/qaccessiblemenu.cpp
index e188db284f..77157d1b62 100644
--- a/src/plugins/accessible/widgets/qaccessiblemenu.cpp
+++ b/src/plugins/accessible/widgets/qaccessiblemenu.cpp
@@ -206,31 +206,10 @@ QAccessibleInterface *QAccessibleMenuItem::child(int index) const
int QAccessibleMenuItem::navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const
{
+ Q_UNUSED(relation);
+ Q_UNUSED(entry);
*target = 0;
- if (entry < 0) {
- return -1;
- }
-
- switch (relation) {
- case QAccessible::Up:
- case QAccessible::Down:{
- QAccessibleInterface *parentIface = parent();
- if (parentIface) {
- int index = parentIface->indexOfChild(this);
- if (index != -1) {
- index += (relation == QAccessible::Down ? +1 : -1);
- if (index >= 0)
- *target = parentIface->child(index);
- }
- }
- delete parentIface;
- break;
- }
- default:
- break;
-
- }
- return *target ? 0 : -1;
+ return -1;
}
void *QAccessibleMenuItem::interface_cast(QAccessible::InterfaceType t)
diff --git a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp
index a067adaaa8..1d6638ee42 100644
--- a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp
+++ b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp
@@ -98,121 +98,6 @@ QList<QWidget*> childWidgets(const QWidget *widget, bool includeTopLevel)
return widgets;
}
-static inline int distance(QWidget *source, QWidget *target,
- QAccessible::RelationFlag relation)
-{
- if (!source || !target)
- return -1;
-
- int returnValue = -1;
- switch (relation) {
- case QAccessible::Up:
- if (target->y() <= source->y())
- returnValue = source->y() - target->y();
- break;
- case QAccessible::Down:
- if (target->y() >= source->y() + source->height())
- returnValue = target->y() - (source->y() + source->height());
- break;
- case QAccessible::Right:
- if (target->x() >= source->x() + source->width())
- returnValue = target->x() - (source->x() + source->width());
- break;
- case QAccessible::Left:
- if (target->x() <= source->x())
- returnValue = source->x() - target->x();
- break;
- default:
- break;
- }
- return returnValue;
-}
-
-static inline QWidget *mdiAreaNavigate(QWidget *area,
- QAccessible::RelationFlag relation, int entry)
-{
-#if defined(QT_NO_MDIAREA) && defined(QT_NO_WORKSPACE)
- Q_UNUSED(area);
-#endif
-#ifndef QT_NO_MDIAREA
- const QMdiArea *mdiArea = qobject_cast<QMdiArea *>(area);
-#endif
-#ifndef QT_NO_WORKSPACE
- const QWorkspace *workspace = qobject_cast<QWorkspace *>(area);
-#endif
- if (true
-#ifndef QT_NO_MDIAREA
- && !mdiArea
-#endif
-#ifndef QT_NO_WORKSPACE
- && !workspace
-#endif
- )
- return 0;
-
- QWidgetList windows;
-#ifndef QT_NO_MDIAREA
- if (mdiArea) {
- foreach (QMdiSubWindow *window, mdiArea->subWindowList())
- windows.append(window);
- } else
-#endif
- {
-#ifndef QT_NO_WORKSPACE
- foreach (QWidget *window, workspace->windowList())
- windows.append(window->parentWidget());
-#endif
- }
-
- if (windows.isEmpty() || entry < 1 || entry > windows.count())
- return 0;
-
- QWidget *source = windows.at(entry - 1);
- QMap<int, QWidget *> candidates;
- foreach (QWidget *window, windows) {
- if (source == window)
- continue;
- int candidateDistance = distance(source, window, relation);
- if (candidateDistance >= 0)
- candidates.insert(candidateDistance, window);
- }
-
- int minimumDistance = INT_MAX;
- QWidget *target = 0;
- foreach (QWidget *candidate, candidates) {
- switch (relation) {
- case QAccessible::Up:
- case QAccessible::Down:
- if (qAbs(candidate->x() - source->x()) < minimumDistance) {
- target = candidate;
- minimumDistance = qAbs(candidate->x() - source->x());
- }
- break;
- case QAccessible::Left:
- case QAccessible::Right:
- if (qAbs(candidate->y() - source->y()) < minimumDistance) {
- target = candidate;
- minimumDistance = qAbs(candidate->y() - source->y());
- }
- break;
- default:
- break;
- }
- if (minimumDistance == 0)
- break;
- }
-
-#ifndef QT_NO_WORKSPACE
- if (workspace) {
- foreach (QWidget *widget, workspace->windowList()) {
- if (widget->parentWidget() == target)
- target = widget;
- }
- }
-#endif
- return target;
-}
-
#ifndef QT_NO_TEXTEDIT
/*!
@@ -790,24 +675,6 @@ int QAccessibleMdiArea::indexOfChild(const QAccessibleInterface *child) const
return -1;
}
-int QAccessibleMdiArea::navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const
-{
- *target = 0;
- QWidget *targetObject = 0;
- switch (relation) {
- case QAccessible::Up:
- case QAccessible::Down:
- case QAccessible::Left:
- case QAccessible::Right:
- targetObject = mdiAreaNavigate(mdiArea(), relation, entry);
- break;
- default:
- return QAccessibleWidget::navigate(relation, entry, target);
- }
- *target = QAccessible::queryAccessibleInterface(targetObject);
- return *target ? 0: -1;
-}
-
QMdiArea *QAccessibleMdiArea::mdiArea() const
{
return static_cast<QMdiArea *>(object());
@@ -881,44 +748,6 @@ int QAccessibleMdiSubWindow::indexOfChild(const QAccessibleInterface *child) con
return -1;
}
-int QAccessibleMdiSubWindow::navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const
-{
- *target = 0;
-
- if (!mdiSubWindow()->parent())
- return QAccessibleWidget::navigate(relation, entry, target);
-
- QWidget *targetObject = 0;
- QMdiSubWindow *source = mdiSubWindow();
- switch (relation) {
- case QAccessible::Up:
- case QAccessible::Down:
- case QAccessible::Left:
- case QAccessible::Right: {
- if (entry != 0)
- break;
- QWidget *parent = source->parentWidget();
- while (parent && !parent->inherits("QMdiArea"))
- parent = parent->parentWidget();
- QMdiArea *mdiArea = qobject_cast<QMdiArea *>(parent);
- if (!mdiArea)
- break;
- int index = mdiArea->subWindowList().indexOf(source);
- if (index == -1)
- break;
- if (QWidget *dest = mdiAreaNavigate(mdiArea, relation, index + 1)) {
- *target = QAccessible::queryAccessibleInterface(dest);
- return *target ? 0 : -1;
- }
- break;
- }
- default:
- return QAccessibleWidget::navigate(relation, entry, target);
- }
- *target = QAccessible::queryAccessibleInterface(targetObject);
- return *target ? 0: -1;
-}
-
QRect QAccessibleMdiSubWindow::rect() const
{
if (mdiSubWindow()->isHidden())
@@ -967,24 +796,6 @@ int QAccessibleWorkspace::indexOfChild(const QAccessibleInterface *child) const
return -1;
}
-int QAccessibleWorkspace::navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const
-{
- *target = 0;
- QWidget *targetObject = 0;
- switch (relation) {
- case QAccessible::Up:
- case QAccessible::Down:
- case QAccessible::Left:
- case QAccessible::Right:
- targetObject = mdiAreaNavigate(workspace(), relation, entry);
- break;
- default:
- return QAccessibleWidget::navigate(relation, entry, target);
- }
- *target = QAccessible::queryAccessibleInterface(targetObject);
- return *target ? 0: -1;
-}
-
QWorkspace *QAccessibleWorkspace::workspace() const
{
return static_cast<QWorkspace *>(object());
@@ -1056,28 +867,6 @@ QAccessibleInterface *QAccessibleCalendarWidget::child(int index) const
return QAccessible::queryAccessibleInterface(calendarView());
}
-int QAccessibleCalendarWidget::navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const
-{
- *target = 0;
- if (entry <= 0 || entry > childCount())
- return QAccessibleWidget::navigate(relation, entry, target);
- QWidget *targetWidget = 0;
- switch (relation) {
- case QAccessible::Up:
- if (entry == 2)
- targetWidget = navigationBar();
- break;
- case QAccessible::Down:
- if (entry == 1 && childCount() == 2)
- targetWidget = calendarView();
- break;
- default:
- return QAccessibleWidget::navigate(relation, entry, target);
- }
- *target = QAccessible::queryAccessibleInterface(targetWidget);
- return *target ? 0 : -1;
-}
-
QCalendarWidget *QAccessibleCalendarWidget::calendarWidget() const
{
return static_cast<QCalendarWidget *>(object());
diff --git a/src/plugins/accessible/widgets/qaccessiblewidgets.h b/src/plugins/accessible/widgets/qaccessiblewidgets.h
index e60ed06b59..c1c1cbbd0e 100644
--- a/src/plugins/accessible/widgets/qaccessiblewidgets.h
+++ b/src/plugins/accessible/widgets/qaccessiblewidgets.h
@@ -154,7 +154,6 @@ public:
int childCount() const;
QAccessibleInterface *child(int index) const;
int indexOfChild(const QAccessibleInterface *child) const;
- int navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const;
protected:
QMdiArea *mdiArea() const;
@@ -171,7 +170,6 @@ public:
int childCount() const;
QAccessibleInterface *child(int index) const;
int indexOfChild(const QAccessibleInterface *child) const;
- int navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const;
QRect rect() const;
protected:
@@ -188,7 +186,6 @@ public:
int childCount() const;
QAccessibleInterface *child(int index) const;
int indexOfChild(const QAccessibleInterface *child) const;
- int navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const;
protected:
QWorkspace *workspace() const;
@@ -221,7 +218,6 @@ public:
int childCount() const;
int indexOfChild(const QAccessibleInterface *child) const;
- int navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const;
QAccessibleInterface *child(int index) const;