}
/*!
+ Returns the object that has the keyboard focus.
+
+ The object returned can be any descendant, including itself.
+*/
+QAccessibleInterface *QAccessibleInterface::focusChild() const
+{
+ return 0;
+}
+
+/*!
\fn QAccessibleInterface *QAccessibleInterface::childAt(int x, int y) const
Returns the QAccessibleInterface of a child that contains the screen coordinates (\a x, \a y).
\sa relationTo(), childCount(), parent(), child()
*/
+int QAccessibleInterface::navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const
+{
+ Q_UNUSED(entry);
+ Q_UNUSED(relation);
+ *target = 0;
+ return -1;
+}
+
/*!
\fn QString QAccessibleInterface::text(QAccessible::Text t) const
enum RelationFlag {
Unrelated = 0x00000000,
- FocusChild = 0x00010000,
Label = 0x00020000,
Labelled = 0x00040000,
Controller = 0x00080000,
// relations
virtual QAccessible::Relation relationTo(const QAccessibleInterface *other) const;
virtual QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > relations() const;
+ virtual QAccessibleInterface *focusChild() const;
virtual QAccessibleInterface *childAt(int x, int y) const = 0;
virtual QAccessibleInterface *child(int index) const = 0;
virtual int childCount() const = 0;
virtual int indexOfChild(const QAccessibleInterface *) const = 0;
- virtual int navigate(QAccessible::RelationFlag relation, int index, QAccessibleInterface **iface) const = 0;
+ virtual int navigate(QAccessible::RelationFlag relation, int index, QAccessibleInterface **iface) const;
// properties and state
virtual QString text(QAccessible::Text t) const = 0;
return 0;
}
+
/*! \reimp */
-int QAccessibleApplication::navigate(QAccessible::RelationFlag relation, int,
- QAccessibleInterface **target) const
+QAccessibleInterface *QAccessibleApplication::focusChild() const
{
- if (!target)
- return -1;
-
- *target = 0;
- QObject *targetObject = 0;
-
- switch (relation) {
- case QAccessible::FocusChild:
- if (QWindow *window = QGuiApplication::activeWindow()) {
- *target = window->accessibleRoot();
- return 0;
- }
- break;
- default:
- break;
- }
- *target = QAccessible::queryAccessibleInterface(targetObject);
- return *target ? 0 : -1;
+ if (QWindow *window = QGuiApplication::activeWindow())
+ return window->accessibleRoot();
+ return 0;
}
/*! \reimp */
// relations
int childCount() const;
int indexOfChild(const QAccessibleInterface*) const;
+ QAccessibleInterface *focusChild() const;
// navigation
QAccessibleInterface *parent() const;
QAccessibleInterface *child(int index) const;
- int navigate(QAccessible::RelationFlag, int, QAccessibleInterface **) const;
// properties and state
QString text(QAccessible::Text t) const;
return QAccessible::queryAccessibleInterface(m_parent);
}
QAccessibleInterface *child(int) const { return 0; }
- int navigate(QAccessible::RelationFlag relation, int index, QAccessibleInterface **iface) const
- {
- Q_UNUSED(relation);
- Q_UNUSED(index);
- Q_UNUSED(iface);
- return -1;
- }
// action interface
QStringList actionNames() const
{
return childFromLogical(index + 1);
}
-int QAccessibleTable::navigate(QAccessible::RelationFlag relation, int index, QAccessibleInterface **iface) const
-{
- Q_UNUSED(relation);
- Q_UNUSED(index);
- *iface = 0;
- return -1;
-}
-
void *QAccessibleTable::interface_cast(QAccessible::InterfaceType t)
{
if (t == QAccessible::TableInterface)
return 0;
}
-int QAccessibleTableCell::navigate(QAccessible::RelationFlag relation, int index, QAccessibleInterface **iface) const
-{
- Q_UNUSED(index);
- Q_UNUSED(relation);
-
-// switch (relation) {
-// From table1 implementation:
-// case Up:
-// case Down:
-// case Left:
-// case Right: {
-// // This is in the "not so nice" category. In order to find out which item
-// // is geometrically around, we have to set the current index, navigate
-// // and restore the index as well as the old selection
-// view->setUpdatesEnabled(false);
-// const QModelIndex oldIdx = view->currentIndex();
-// QList<QModelIndex> kids = children();
-// const QModelIndex currentIndex = index ? kids.at(index - 1) : QModelIndex(row);
-// const QItemSelection oldSelection = view->selectionModel()->selection();
-// view->setCurrentIndex(currentIndex);
-// const QModelIndex idx = view->moveCursor(toCursorAction(relation), Qt::NoModifier);
-// view->setCurrentIndex(oldIdx);
-// view->selectionModel()->select(oldSelection, QItemSelectionModel::ClearAndSelect);
-// view->setUpdatesEnabled(true);
-// if (!idx.isValid())
-// return -1;
-
-// if (idx.parent() != row.parent() || idx.row() != row.row())
-// *iface = cell(idx);
-// return index ? kids.indexOf(idx) + 1 : 0; }
-// }
- *iface = 0;
- return -1;
-}
-
QAccessibleTableHeaderCell::QAccessibleTableHeaderCell(QAbstractItemView *view_, int index_, Qt::Orientation orientation_)
: view(view_), index(index_), orientation(orientation_)
{
return 0;
}
-int QAccessibleTableHeaderCell::navigate(QAccessible::RelationFlag relation, int index, QAccessibleInterface **iface) const
-{
- Q_UNUSED(relation);
- Q_UNUSED(index);
- Q_UNUSED(iface);
-
- return -1;
-}
-
#endif // QT_NO_ITEMVIEWS
QT_END_NAMESPACE
QAccessibleInterface *parent() const;
QAccessibleInterface *child(int index) const;
- int navigate(QAccessible::RelationFlag relation, int index, QAccessibleInterface **iface) const;
void *interface_cast(QAccessible::InterfaceType t);
QAccessibleInterface *parent() const;
QAccessibleInterface *child(int) const;
- int navigate(QAccessible::RelationFlag relation, int m_index, QAccessibleInterface **iface) const;
// cell interface
virtual int columnExtent() const;
QAccessibleInterface *parent() const;
QAccessibleInterface *child(int index) const;
- int navigate(QAccessible::RelationFlag relation, int index, QAccessibleInterface **iface) const;
private:
QAbstractItemView *view;
QAccessibleInterface *child(int) const {
return 0;
}
- int navigate(QAccessible::RelationFlag relation, int, QAccessibleInterface **iface) const
- {
- Q_UNUSED(relation);
- Q_UNUSED(iface);
- return -1;
- }
-
private:
QAbstractItemView *view;
};
return 0;
}
-int QAccessibleMenuItem::navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const
-{
- Q_UNUSED(relation);
- Q_UNUSED(entry);
- *target = 0;
- return -1;
-}
-
void *QAccessibleMenuItem::interface_cast(QAccessible::InterfaceType t)
{
if (t == QAccessible::ActionInterface)
QAccessibleInterface *parent() const;
QAccessibleInterface *child(int index) const;
- int navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface ** target) const;
QObject * object() const;
QRect rect() const;
QAccessible::Role role() const;
return 0;
}
-int QAccessibleTitleBar::navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **iface) const
-{
- switch (relation) {
- case QAccessible::FocusChild:
- // ###
- if (entry >= 1) {
- QDockWidgetLayout *layout = dockWidgetLayout();
- int index = 1;
- int role;
- for (role = QDockWidgetLayout::CloseButton; role <= QDockWidgetLayout::FloatButton; ++role) {
- QWidget *w = layout->widgetForRole((QDockWidgetLayout::Role)role);
- if (!w->isVisible())
- continue;
- if (index == entry)
- break;
- ++index;
- }
- *iface = 0;
- return role > QDockWidgetLayout::FloatButton ? -1 : index;
- }
- break;
- default:
- break;
- }
- *iface = 0;
- return -1;
-}
-
int QAccessibleTitleBar::indexOfChild(const QAccessibleInterface * /*child*/) const
{
return -1;
QAccessibleInterface *parent() const;
QAccessibleInterface *child(int index) const;
- int navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **iface) const;
int indexOfChild(const QAccessibleInterface *child) const;
int childCount() const;
QAccessibleInterface *childAt(int x, int y) const;
if (!accessible->isValid())
return E_FAIL;
- QAccessibleInterface *acc = 0;
- int control = accessible->navigate(QAccessible::FocusChild, 1, &acc);
- if (control == -1) {
- (*pvarID).vt = VT_EMPTY;
- return S_FALSE;
- }
- if (!acc || control == 0) {
- (*pvarID).vt = VT_I4;
- (*pvarID).lVal = control ? control : CHILDID_SELF;
- return S_OK;
- }
-
- QWindowsAccessible* wacc = new QWindowsAccessible(acc);
- IDispatch *iface = 0;
- wacc->QueryInterface(IID_IDispatch, (void**)&iface);
- if (iface) {
- (*pvarID).vt = VT_DISPATCH;
- (*pvarID).pdispVal = iface;
- return S_OK;
- } else {
- delete wacc;
+ if (QAccessibleInterface *acc = accessible->focusChild()) {
+ QWindowsAccessible* wacc = new QWindowsAccessible(acc);
+ IDispatch *iface = 0;
+ wacc->QueryInterface(IID_IDispatch, (void**)&iface);
+ if (iface) {
+ (*pvarID).vt = VT_DISPATCH;
+ (*pvarID).pdispVal = iface;
+ return S_OK;
+ } else {
+ delete wacc;
+ }
}
-
(*pvarID).vt = VT_EMPTY;
return S_FALSE;
}
if (!o)
return relation;
- QWidget *focus = widget()->focusWidget();
- if (object() == focus && isAncestor(o, focus))
- relation |= QAccessible::FocusChild;
-
QACConnectionObject *connectionObject = (QACConnectionObject*)object();
for (int sig = 0; sig < d->primarySignals.count(); ++sig) {
if (connectionObject->isSender(o, d->primarySignals.at(sig).toAscii())) {
}
/*! \reimp */
+QAccessibleInterface *QAccessibleWidget::focusChild() const
+{
+ if (widget()->hasFocus())
+ return QAccessible::queryAccessibleInterface(object());
+
+ QWidget *fw = widget()->focusWidget();
+ if (!fw)
+ return 0;
+
+ if (isAncestor(widget(), fw) || fw == widget())
+ return QAccessible::queryAccessibleInterface(fw);
+}
+
+/*! \reimp */
int QAccessibleWidget::navigate(QAccessible::RelationFlag relation, int entry,
QAccessibleInterface **target) const
{
switch (relation) {
// Logical
- case QAccessible::FocusChild:
- {
- if (widget()->hasFocus()) {
- targetObject = object();
- break;
- }
-
- QWidget *fw = widget()->focusWidget();
- if (!fw)
- return -1;
-
- if (isAncestor(widget(), fw) || fw == widget())
- targetObject = fw;
- /* ###
- QWidget *parent = fw;
- while (parent && !targetObject) {
- parent = parent->parentWidget();
- if (parent == widget())
- targetObject = fw;
- }
- */
- }
- break;
case QAccessible::Label:
if (entry > 0) {
QAccessibleInterface *pIface = QAccessible::queryAccessibleInterface(parentObject());
int childCount() const;
int indexOfChild(const QAccessibleInterface *child) const;
QAccessible::Relation relationTo(const QAccessibleInterface *other) const;
+ QAccessibleInterface *focusChild() const;
QRect rect() const;