Cache QAccessibleInterfaces.
Since there already is a one-to-one relationship between QObject and QAccessibleInterface it makes little sense to create and destroy the interfaces on each call to queryAccessibleInterface. Add a cache and keep created interfaces around for the lifetime of the corresponding QObject. This changes the memory management rules: accessible interfaces must no longer be deleted. If you get an QAccessibleIntrface pointer that pointer will stay valid as long as the corresponding QObject is not deleted. This also re-enables accessibility for Mac. We limit the range of the IDs so that they are useable for Windows directly. That means we can get rid of the event cache there. This is based on: Iebf2f374916fc70a9dd29e95f45a6444b85f6cee Change-Id: I9fe6531812c0dbc5b41101ac05830a6dd75e13a3 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
This commit is contained in:
parent
8dfe1385b5
commit
b2ec0da956
@ -3,6 +3,7 @@
|
|||||||
contains(QT_CONFIG, accessibility) {
|
contains(QT_CONFIG, accessibility) {
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
accessible/qaccessible.h \
|
accessible/qaccessible.h \
|
||||||
|
accessible/qaccessiblecache_p.h \
|
||||||
accessible/qaccessible2_p.h \
|
accessible/qaccessible2_p.h \
|
||||||
accessible/qaccessibleobject.h \
|
accessible/qaccessibleobject.h \
|
||||||
accessible/qaccessibleplugin.h \
|
accessible/qaccessibleplugin.h \
|
||||||
@ -10,6 +11,7 @@ contains(QT_CONFIG, accessibility) {
|
|||||||
|
|
||||||
SOURCES += accessible/qaccessible.cpp \
|
SOURCES += accessible/qaccessible.cpp \
|
||||||
accessible/qaccessible2.cpp \
|
accessible/qaccessible2.cpp \
|
||||||
|
accessible/qaccessiblecache.cpp \
|
||||||
accessible/qaccessibleobject.cpp \
|
accessible/qaccessibleobject.cpp \
|
||||||
accessible/qaccessibleplugin.cpp \
|
accessible/qaccessibleplugin.cpp \
|
||||||
accessible/qplatformaccessibility.cpp
|
accessible/qplatformaccessibility.cpp
|
||||||
|
@ -41,6 +41,8 @@
|
|||||||
|
|
||||||
#include "qaccessible.h"
|
#include "qaccessible.h"
|
||||||
|
|
||||||
|
#include "qaccessible2_p.h"
|
||||||
|
#include "qaccessiblecache_p.h"
|
||||||
#include "qaccessibleplugin.h"
|
#include "qaccessibleplugin.h"
|
||||||
#include "qaccessibleobject.h"
|
#include "qaccessibleobject.h"
|
||||||
#include "qaccessiblebridge.h"
|
#include "qaccessiblebridge.h"
|
||||||
@ -558,6 +560,8 @@ QAccessible::RootObjectHandler QAccessible::installRootObjectHandler(RootObjectH
|
|||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Q_GLOBAL_STATIC(QAccessibleCache, qAccessibleCache)
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
If a QAccessibleInterface implementation exists for the given \a object,
|
If a QAccessibleInterface implementation exists for the given \a object,
|
||||||
this function returns a pointer to the implementation; otherwise it
|
this function returns a pointer to the implementation; otherwise it
|
||||||
@ -574,8 +578,7 @@ QAccessible::RootObjectHandler QAccessible::installRootObjectHandler(RootObjectH
|
|||||||
function tries to find an implementation for the object's parent
|
function tries to find an implementation for the object's parent
|
||||||
class, using the above strategy.
|
class, using the above strategy.
|
||||||
|
|
||||||
\warning The caller is responsible for deleting the returned
|
All interfaces are managed by an internal cache and should not be deleted.
|
||||||
interface after use.
|
|
||||||
*/
|
*/
|
||||||
QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object)
|
QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object)
|
||||||
{
|
{
|
||||||
@ -583,6 +586,9 @@ QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object)
|
|||||||
if (!object)
|
if (!object)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (Id id = qAccessibleCache->objectToId.value(object))
|
||||||
|
return qAccessibleCache->interfaceForId(id);
|
||||||
|
|
||||||
// Create a QAccessibleInterface for the object class. Start by the most
|
// Create a QAccessibleInterface for the object class. Start by the most
|
||||||
// derived class and walk up the class hierarchy.
|
// derived class and walk up the class hierarchy.
|
||||||
const QMetaObject *mo = object->metaObject();
|
const QMetaObject *mo = object->metaObject();
|
||||||
@ -592,8 +598,11 @@ QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object)
|
|||||||
// Check if the class has a InterfaceFactory installed.
|
// Check if the class has a InterfaceFactory installed.
|
||||||
for (int i = qAccessibleFactories()->count(); i > 0; --i) {
|
for (int i = qAccessibleFactories()->count(); i > 0; --i) {
|
||||||
InterfaceFactory factory = qAccessibleFactories()->at(i - 1);
|
InterfaceFactory factory = qAccessibleFactories()->at(i - 1);
|
||||||
if (QAccessibleInterface *iface = factory(cn, object))
|
if (QAccessibleInterface *iface = factory(cn, object)) {
|
||||||
|
qAccessibleCache->insert(object, iface);
|
||||||
|
Q_ASSERT(qAccessibleCache->objectToId.contains(object));
|
||||||
return iface;
|
return iface;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#ifndef QT_NO_ACCESSIBILITY
|
#ifndef QT_NO_ACCESSIBILITY
|
||||||
#ifndef QT_NO_LIBRARY
|
#ifndef QT_NO_LIBRARY
|
||||||
@ -610,21 +619,83 @@ QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object)
|
|||||||
// At this point the cache should contain a valid factory pointer or 0:
|
// At this point the cache should contain a valid factory pointer or 0:
|
||||||
Q_ASSERT(qAccessiblePlugins()->contains(cn));
|
Q_ASSERT(qAccessiblePlugins()->contains(cn));
|
||||||
QAccessiblePlugin *factory = qAccessiblePlugins()->value(cn);
|
QAccessiblePlugin *factory = qAccessiblePlugins()->value(cn);
|
||||||
if (factory)
|
if (factory) {
|
||||||
return factory->create(cn, object);
|
QAccessibleInterface *result = factory->create(cn, object);
|
||||||
|
if (result) { // Need this condition because of QDesktopScreenWidget
|
||||||
|
qAccessibleCache->insert(object, result);
|
||||||
|
Q_ASSERT(qAccessibleCache->objectToId.contains(object));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
mo = mo->superClass();
|
mo = mo->superClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef QT_NO_ACCESSIBILITY
|
#ifndef QT_NO_ACCESSIBILITY
|
||||||
if (object == qApp)
|
if (object == qApp) {
|
||||||
return new QAccessibleApplication;
|
QAccessibleInterface *appInterface = new QAccessibleApplication;
|
||||||
|
qAccessibleCache->insert(object, appInterface);
|
||||||
|
Q_ASSERT(qAccessibleCache->objectToId.contains(qApp));
|
||||||
|
return appInterface;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\internal
|
||||||
|
Required to ensure that manually created interfaces
|
||||||
|
are properly memory managed.
|
||||||
|
|
||||||
|
Must only be called exactly once per interface.
|
||||||
|
This is implicitly called when calling queryAccessibleInterface,
|
||||||
|
so it's only required when re-implementing for example
|
||||||
|
the child function and returning the child after new-ing
|
||||||
|
a QAccessibleInterface subclass.
|
||||||
|
*/
|
||||||
|
QAccessible::Id QAccessible::registerAccessibleInterface(QAccessibleInterface *iface)
|
||||||
|
{
|
||||||
|
Q_ASSERT(iface);
|
||||||
|
return qAccessibleCache->insert(iface->object(), iface);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\internal
|
||||||
|
Removes the interface belonging to this id from the cache and
|
||||||
|
deletes it. The id becomes invalid an may be re-used by the
|
||||||
|
cache.
|
||||||
|
*/
|
||||||
|
void QAccessible::deleteAccessibleInterface(Id id)
|
||||||
|
{
|
||||||
|
qAccessibleCache->deleteInterface(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\internal
|
||||||
|
Returns the unique ID for the accessibleInterface.
|
||||||
|
*/
|
||||||
|
QAccessible::Id QAccessible::uniqueId(QAccessibleInterface *iface)
|
||||||
|
{
|
||||||
|
Id id = qAccessibleCache->idToInterface.key(iface);
|
||||||
|
if (!id)
|
||||||
|
id = registerAccessibleInterface(iface);
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\internal
|
||||||
|
Returns the QAccessibleInterface belonging to the id.
|
||||||
|
|
||||||
|
Returns 0 if the id is invalid.
|
||||||
|
*/
|
||||||
|
QAccessibleInterface *QAccessible::accessibleInterface(Id id)
|
||||||
|
{
|
||||||
|
return qAccessibleCache->idToInterface.value(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns true if an accessibility implementation has been requested
|
Returns true if an accessibility implementation has been requested
|
||||||
during the runtime of the application; otherwise returns false.
|
during the runtime of the application; otherwise returns false.
|
||||||
@ -687,15 +758,23 @@ void QAccessible::setRootObject(QObject *object)
|
|||||||
*/
|
*/
|
||||||
void QAccessible::updateAccessibility(QAccessibleEvent *event)
|
void QAccessible::updateAccessibility(QAccessibleEvent *event)
|
||||||
{
|
{
|
||||||
|
if (!isActive())
|
||||||
|
return;
|
||||||
|
|
||||||
|
#ifndef QT_NO_ACCESSIBILITY
|
||||||
|
if (event->type() == QAccessible::TableModelChanged) {
|
||||||
|
Q_ASSERT(event->object());
|
||||||
|
if (QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(event->object())) {
|
||||||
|
if (iface->tableInterface())
|
||||||
|
iface->tableInterface()->modelChange(static_cast<QAccessibleTableModelChangeEvent*>(event));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (updateHandler) {
|
if (updateHandler) {
|
||||||
updateHandler(event);
|
updateHandler(event);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isActive())
|
|
||||||
return;
|
|
||||||
|
|
||||||
#ifndef QT_NO_ACCESSIBILITY
|
|
||||||
if (QPlatformAccessibility *pfAccessibility = platformAccessibility())
|
if (QPlatformAccessibility *pfAccessibility = platformAccessibility())
|
||||||
pfAccessibility->notifyAccessibilityUpdate(event);
|
pfAccessibility->notifyAccessibilityUpdate(event);
|
||||||
#endif
|
#endif
|
||||||
@ -1028,6 +1107,10 @@ QColor QAccessibleInterface::backgroundColor() const
|
|||||||
return QColor();
|
return QColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QAccessibleInterface::~QAccessibleInterface()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn QAccessibleTextInterface *QAccessibleInterface::textInterface()
|
\fn QAccessibleTextInterface *QAccessibleInterface::textInterface()
|
||||||
\internal
|
\internal
|
||||||
@ -1362,7 +1445,6 @@ QAccessibleInterface *QAccessibleEvent::accessibleInterface() const
|
|||||||
if (m_child >= 0) {
|
if (m_child >= 0) {
|
||||||
QAccessibleInterface *child = iface->child(m_child);
|
QAccessibleInterface *child = iface->child(m_child);
|
||||||
if (child) {
|
if (child) {
|
||||||
delete iface;
|
|
||||||
iface = child;
|
iface = child;
|
||||||
} else {
|
} else {
|
||||||
qWarning() << "Cannot creat accessible child interface for object: " << m_object << " index: " << m_child;
|
qWarning() << "Cannot creat accessible child interface for object: " << m_object << " index: " << m_child;
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
#ifndef QACCESSIBLE_H
|
#ifndef QACCESSIBLE_H
|
||||||
#define QACCESSIBLE_H
|
#define QACCESSIBLE_H
|
||||||
|
|
||||||
|
#include <QtCore/qdebug.h>
|
||||||
#include <QtCore/qglobal.h>
|
#include <QtCore/qglobal.h>
|
||||||
#include <QtCore/qobject.h>
|
#include <QtCore/qobject.h>
|
||||||
#include <QtCore/qrect.h>
|
#include <QtCore/qrect.h>
|
||||||
@ -58,7 +59,6 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
|
||||||
class QAccessibleInterface;
|
class QAccessibleInterface;
|
||||||
class QAccessibleEvent;
|
class QAccessibleEvent;
|
||||||
class QWindow;
|
class QWindow;
|
||||||
@ -335,12 +335,20 @@ public:
|
|||||||
typedef void(*UpdateHandler)(QAccessibleEvent *event);
|
typedef void(*UpdateHandler)(QAccessibleEvent *event);
|
||||||
typedef void(*RootObjectHandler)(QObject*);
|
typedef void(*RootObjectHandler)(QObject*);
|
||||||
|
|
||||||
|
typedef unsigned Id;
|
||||||
|
|
||||||
static void installFactory(InterfaceFactory);
|
static void installFactory(InterfaceFactory);
|
||||||
static void removeFactory(InterfaceFactory);
|
static void removeFactory(InterfaceFactory);
|
||||||
static UpdateHandler installUpdateHandler(UpdateHandler);
|
static UpdateHandler installUpdateHandler(UpdateHandler);
|
||||||
static RootObjectHandler installRootObjectHandler(RootObjectHandler);
|
static RootObjectHandler installRootObjectHandler(RootObjectHandler);
|
||||||
|
|
||||||
static QAccessibleInterface *queryAccessibleInterface(QObject *);
|
static QAccessibleInterface *queryAccessibleInterface(QObject *);
|
||||||
|
static Id uniqueId(QAccessibleInterface *iface);
|
||||||
|
static QAccessibleInterface *accessibleInterface(Id uniqueId);
|
||||||
|
static Id registerAccessibleInterface(QAccessibleInterface *iface);
|
||||||
|
static void deleteAccessibleInterface(Id uniqueId);
|
||||||
|
|
||||||
|
|
||||||
#if QT_DEPRECATED_SINCE(5, 0)
|
#if QT_DEPRECATED_SINCE(5, 0)
|
||||||
QT_DEPRECATED static inline void updateAccessibility(QObject *object, int child, Event reason);
|
QT_DEPRECATED static inline void updateAccessibility(QObject *object, int child, Event reason);
|
||||||
#endif
|
#endif
|
||||||
@ -360,6 +368,8 @@ private:
|
|||||||
it is not supposed to be instantiated.
|
it is not supposed to be instantiated.
|
||||||
*/
|
*/
|
||||||
QAccessible() {}
|
QAccessible() {}
|
||||||
|
|
||||||
|
friend class QAccessibleCache;
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_GUI_EXPORT bool operator==(const QAccessible::State &first, const QAccessible::State &second);
|
Q_GUI_EXPORT bool operator==(const QAccessible::State &first, const QAccessible::State &second);
|
||||||
@ -377,8 +387,10 @@ class QAccessibleTableCellInterface;
|
|||||||
|
|
||||||
class Q_GUI_EXPORT QAccessibleInterface
|
class Q_GUI_EXPORT QAccessibleInterface
|
||||||
{
|
{
|
||||||
|
protected:
|
||||||
|
virtual ~QAccessibleInterface();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~QAccessibleInterface() {}
|
|
||||||
// check for valid pointers
|
// check for valid pointers
|
||||||
virtual bool isValid() const = 0;
|
virtual bool isValid() const = 0;
|
||||||
virtual QObject *object() const = 0;
|
virtual QObject *object() const = 0;
|
||||||
@ -431,7 +443,9 @@ public:
|
|||||||
|
|
||||||
virtual void *interface_cast(QAccessible::InterfaceType)
|
virtual void *interface_cast(QAccessible::InterfaceType)
|
||||||
{ return 0; }
|
{ return 0; }
|
||||||
private:
|
|
||||||
|
protected:
|
||||||
|
friend class QAccessibleCache;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Q_GUI_EXPORT QAccessibleEvent
|
class Q_GUI_EXPORT QAccessibleEvent
|
||||||
|
@ -193,6 +193,8 @@ public:
|
|||||||
// Unselects one column, leaving other selected columns selected (if any).
|
// Unselects one column, leaving other selected columns selected (if any).
|
||||||
virtual bool unselectColumn(int column) = 0;
|
virtual bool unselectColumn(int column) = 0;
|
||||||
|
|
||||||
|
virtual void modelChange(QAccessibleTableModelChangeEvent *event) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class QAbstractItemView;
|
friend class QAbstractItemView;
|
||||||
friend class QAbstractItemViewPrivate;
|
friend class QAbstractItemViewPrivate;
|
||||||
|
116
src/gui/accessible/qaccessiblecache.cpp
Normal file
116
src/gui/accessible/qaccessiblecache.cpp
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||||
|
** Contact: http://www.qt-project.org/legal
|
||||||
|
**
|
||||||
|
** This file is part of the QtGui module of the Qt Toolkit.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:LGPL$
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and Digia. For licensing terms and
|
||||||
|
** conditions see http://qt.digia.com/licensing. For further information
|
||||||
|
** use the contact form at http://qt.digia.com/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Digia gives you certain additional
|
||||||
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
|
** General Public License version 3.0 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU General Public License version 3.0 requirements will be
|
||||||
|
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "qaccessiblecache_p.h"
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\class QAccessibleCache
|
||||||
|
\internal
|
||||||
|
\brief Maintains a cache of accessible interfaces.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
The ID is always in the range [INT_MAX+1, UINT_MAX].
|
||||||
|
This makes it easy on windows to reserve the positive integer range
|
||||||
|
for the index of a child and not clash with the unique ids.
|
||||||
|
*/
|
||||||
|
QAccessible::Id QAccessibleCache::acquireId() const
|
||||||
|
{
|
||||||
|
static const QAccessible::Id FirstId = QAccessible::Id(INT_MAX) + 1;
|
||||||
|
static QAccessible::Id lastUsedId = FirstId;
|
||||||
|
|
||||||
|
while (idToInterface.contains(lastUsedId)) {
|
||||||
|
if (lastUsedId == UINT_MAX) // (wrap back when when we reach UINT_MAX)
|
||||||
|
lastUsedId = FirstId;
|
||||||
|
else
|
||||||
|
++lastUsedId;
|
||||||
|
}
|
||||||
|
|
||||||
|
return lastUsedId;
|
||||||
|
}
|
||||||
|
|
||||||
|
QAccessibleInterface *QAccessibleCache::interfaceForId(QAccessible::Id id) const
|
||||||
|
{
|
||||||
|
return idToInterface.value(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
QAccessible::Id QAccessibleCache::insert(QObject *object, QAccessibleInterface *iface) const
|
||||||
|
{
|
||||||
|
Q_ASSERT(iface);
|
||||||
|
Q_UNUSED(object)
|
||||||
|
|
||||||
|
// object might be 0
|
||||||
|
Q_ASSERT(!objectToId.contains(object));
|
||||||
|
Q_ASSERT_X(!idToInterface.values().contains(iface), "", "Accessible interface inserted into cache twice!");
|
||||||
|
|
||||||
|
QAccessible::Id id = acquireId();
|
||||||
|
QObject *obj = iface->object();
|
||||||
|
Q_ASSERT(object == obj);
|
||||||
|
if (obj) {
|
||||||
|
objectToId.insert(obj, id);
|
||||||
|
connect(obj, SIGNAL(destroyed(QObject *)), this, SLOT(objectDestroyed(QObject *)));
|
||||||
|
}
|
||||||
|
idToInterface.insert(id, iface);
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QAccessibleCache::objectDestroyed(QObject* obj)
|
||||||
|
{
|
||||||
|
QAccessible::Id id = objectToId.value(obj);
|
||||||
|
if (id) {
|
||||||
|
Q_ASSERT_X(idToInterface.contains(id), "", "QObject with accessible interface deleted, where interface not in cache!");
|
||||||
|
deleteInterface(id, obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void QAccessibleCache::deleteInterface(QAccessible::Id id, QObject *obj)
|
||||||
|
{
|
||||||
|
QAccessibleInterface *iface = idToInterface.take(id);
|
||||||
|
if (!obj)
|
||||||
|
obj = iface->object();
|
||||||
|
if (obj)
|
||||||
|
objectToId.remove(obj);
|
||||||
|
delete iface;
|
||||||
|
}
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
78
src/gui/accessible/qaccessiblecache_p.h
Normal file
78
src/gui/accessible/qaccessiblecache_p.h
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||||
|
** Contact: http://www.qt-project.org/legal
|
||||||
|
**
|
||||||
|
** This file is part of the QtGui module of the Qt Toolkit.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:LGPL$
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and Digia. For licensing terms and
|
||||||
|
** conditions see http://qt.digia.com/licensing. For further information
|
||||||
|
** use the contact form at http://qt.digia.com/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Digia gives you certain additional
|
||||||
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
|
** General Public License version 3.0 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU General Public License version 3.0 requirements will be
|
||||||
|
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef QACCESSIBLECACHE_P
|
||||||
|
#define QACCESSIBLECACHE_P
|
||||||
|
|
||||||
|
#include <QtCore/qglobal.h>
|
||||||
|
#include <QtCore/qobject.h>
|
||||||
|
#include <QtCore/qhash.h>
|
||||||
|
|
||||||
|
#include "qaccessible.h"
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
|
||||||
|
class QAccessibleCache :public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
QAccessibleInterface *interfaceForId(QAccessible::Id id) const;
|
||||||
|
QAccessible::Id insert(QObject *object, QAccessibleInterface *iface) const;
|
||||||
|
void deleteInterface(QAccessible::Id id, QObject *obj = 0);
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void objectDestroyed(QObject *obj);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QAccessible::Id acquireId() const;
|
||||||
|
|
||||||
|
mutable QHash<QAccessible::Id, QAccessibleInterface *> idToInterface;
|
||||||
|
mutable QHash<QObject *, QAccessible::Id> objectToId;
|
||||||
|
|
||||||
|
friend class QAccessible;
|
||||||
|
friend class QAccessibleInterface;
|
||||||
|
};
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
@ -132,11 +132,8 @@ QAccessibleInterface *QAccessibleObject::childAt(int x, int y) const
|
|||||||
for (int i = 0; i < childCount(); ++i) {
|
for (int i = 0; i < childCount(); ++i) {
|
||||||
QAccessibleInterface *childIface = child(i);
|
QAccessibleInterface *childIface = child(i);
|
||||||
Q_ASSERT(childIface);
|
Q_ASSERT(childIface);
|
||||||
if (childIface->rect().contains(x,y)) {
|
if (childIface->rect().contains(x,y))
|
||||||
return childIface;
|
return childIface;
|
||||||
} else {
|
|
||||||
delete childIface;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -176,7 +173,6 @@ static QObjectList topLevelObjects()
|
|||||||
if (QAccessibleInterface *root = w->accessibleRoot()) {
|
if (QAccessibleInterface *root = w->accessibleRoot()) {
|
||||||
if (root->object())
|
if (root->object())
|
||||||
list.append(root->object());
|
list.append(root->object());
|
||||||
delete root;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -587,7 +587,7 @@ QString AtSpiAdaptor::introspect(const QString &path) const
|
|||||||
" </interface>\n"
|
" </interface>\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
QAIPointer interface = interfaceFromPath(path);
|
QAccessibleInterface * interface = interfaceFromPath(path);
|
||||||
if (!interface) {
|
if (!interface) {
|
||||||
qAtspiDebug() << "WARNING Qt AtSpiAdaptor: Could not find accessible on path: " << path;
|
qAtspiDebug() << "WARNING Qt AtSpiAdaptor: Could not find accessible on path: " << path;
|
||||||
return QString();
|
return QString();
|
||||||
@ -816,7 +816,6 @@ void AtSpiAdaptor::windowActivated(QObject* window, bool active)
|
|||||||
// in dtor it may be invalid
|
// in dtor it may be invalid
|
||||||
if (iface->isValid())
|
if (iface->isValid())
|
||||||
windowTitle = iface->text(QAccessible::Name);
|
windowTitle = iface->text(QAccessible::Name);
|
||||||
delete iface;
|
|
||||||
|
|
||||||
QDBusVariant data;
|
QDBusVariant data;
|
||||||
data.setVariant(windowTitle);
|
data.setVariant(windowTitle);
|
||||||
@ -854,48 +853,28 @@ bool AtSpiAdaptor::sendDBusSignal(const QString &path, const QString &interface,
|
|||||||
return m_dbus->connection().send(message);
|
return m_dbus->connection().send(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
QAIPointer AtSpiAdaptor::interfaceFromPath(const QString& dbusPath) const
|
QAccessibleInterface *AtSpiAdaptor::interfaceFromPath(const QString& dbusPath) const
|
||||||
{
|
{
|
||||||
if (dbusPath == QLatin1String(QSPI_OBJECT_PATH_ROOT))
|
if (dbusPath == QLatin1String(QSPI_OBJECT_PATH_ROOT))
|
||||||
return QAIPointer(QAccessible::queryAccessibleInterface(qApp));
|
return QAccessible::queryAccessibleInterface(qApp);
|
||||||
|
|
||||||
QStringList parts = dbusPath.split(QLatin1Char('/'));
|
QStringList parts = dbusPath.split(QLatin1Char('/'));
|
||||||
if (parts.size() <= 5) {
|
if (parts.size() != 6) {
|
||||||
qAtspiDebug() << "invalid path: " << dbusPath;
|
qAtspiDebug() << "invalid path: " << dbusPath;
|
||||||
return QAIPointer();
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString objectString = parts.at(5);
|
QString objectString = parts.at(5);
|
||||||
quintptr uintptr = objectString.toULongLong();
|
QAccessible::Id id = objectString.toUInt();
|
||||||
|
|
||||||
if (uintptr && m_handledObjects.contains(uintptr)) {
|
// The id is always in the range [INT_MAX+1, UINT_MAX]
|
||||||
// We found the pointer, check if it's still valid:
|
if ((int)id >= 0)
|
||||||
if (m_handledObjects[uintptr]) {
|
qWarning() << "No accessible object found for id: " << id;
|
||||||
QObject* object = reinterpret_cast<QObject*>(uintptr);
|
|
||||||
|
|
||||||
QAIPointer interface = QAIPointer(QAccessible::queryAccessibleInterface(object));
|
return QAccessible::accessibleInterface(id);
|
||||||
if (!interface)
|
|
||||||
return QAIPointer();
|
|
||||||
|
|
||||||
for (int i = 6; i < parts.size(); ++i) {
|
|
||||||
int childIndex = parts.at(i).toInt();
|
|
||||||
if (childIndex < 0) {
|
|
||||||
qAtspiDebug() << "Invalid child index";
|
|
||||||
return QAIPointer();
|
|
||||||
}
|
|
||||||
QAIPointer childInterface(interface->child(childIndex));
|
|
||||||
if (childInterface)
|
|
||||||
interface = childInterface;
|
|
||||||
}
|
|
||||||
return interface;
|
|
||||||
} else {
|
|
||||||
m_handledObjects.remove(uintptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return QAIPointer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AtSpiAdaptor::notifyStateChange(const QAIPointer &interface, const QString &state, int value)
|
void AtSpiAdaptor::notifyStateChange(QAccessibleInterface *interface, const QString &state, int value)
|
||||||
{
|
{
|
||||||
QString path = pathForInterface(interface);
|
QString path = pathForInterface(interface);
|
||||||
QVariantList stateArgs = packDBusSignalArguments(state, value, 0, variantForPath(path));
|
QVariantList stateArgs = packDBusSignalArguments(state, value, 0, variantForPath(path));
|
||||||
@ -912,28 +891,28 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event)
|
|||||||
switch (event->type()) {
|
switch (event->type()) {
|
||||||
case QAccessible::ObjectCreated:
|
case QAccessible::ObjectCreated:
|
||||||
if (sendObject || sendObject_children_changed)
|
if (sendObject || sendObject_children_changed)
|
||||||
notifyAboutCreation(QAIPointer(event->accessibleInterface()));
|
notifyAboutCreation(event->accessibleInterface());
|
||||||
break;
|
break;
|
||||||
case QAccessible::ObjectShow: {
|
case QAccessible::ObjectShow: {
|
||||||
if (sendObject || sendObject_state_changed) {
|
if (sendObject || sendObject_state_changed) {
|
||||||
notifyStateChange(QAIPointer(event->accessibleInterface()), QLatin1String("showing"), 1);
|
notifyStateChange(event->accessibleInterface(), QLatin1String("showing"), 1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case QAccessible::ObjectHide: {
|
case QAccessible::ObjectHide: {
|
||||||
if (sendObject || sendObject_state_changed) {
|
if (sendObject || sendObject_state_changed) {
|
||||||
notifyStateChange(QAIPointer(event->accessibleInterface()), QLatin1String("showing"), 0);
|
notifyStateChange(event->accessibleInterface(), QLatin1String("showing"), 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case QAccessible::ObjectDestroyed: {
|
case QAccessible::ObjectDestroyed: {
|
||||||
if (sendObject || sendObject_state_changed)
|
if (sendObject || sendObject_state_changed)
|
||||||
notifyAboutDestruction(QAIPointer(event->accessibleInterface()));
|
notifyAboutDestruction(event->accessibleInterface());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case QAccessible::NameChanged: {
|
case QAccessible::NameChanged: {
|
||||||
if (sendObject || sendObject_property_change || sendObject_property_change_accessible_name) {
|
if (sendObject || sendObject_property_change || sendObject_property_change_accessible_name) {
|
||||||
QString path = pathForInterface(QAIPointer(event->accessibleInterface()));
|
QString path = pathForInterface(event->accessibleInterface());
|
||||||
QVariantList args = packDBusSignalArguments(QLatin1String("accessible-name"), 0, 0, variantForPath(path));
|
QVariantList args = packDBusSignalArguments(QLatin1String("accessible-name"), 0, 0, variantForPath(path));
|
||||||
sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT),
|
sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT),
|
||||||
QLatin1String("PropertyChange"), args);
|
QLatin1String("PropertyChange"), args);
|
||||||
@ -942,7 +921,7 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event)
|
|||||||
}
|
}
|
||||||
case QAccessible::DescriptionChanged: {
|
case QAccessible::DescriptionChanged: {
|
||||||
if (sendObject || sendObject_property_change || sendObject_property_change_accessible_description) {
|
if (sendObject || sendObject_property_change || sendObject_property_change_accessible_description) {
|
||||||
QString path = pathForInterface(QAIPointer(event->accessibleInterface()));
|
QString path = pathForInterface(event->accessibleInterface());
|
||||||
QVariantList args = packDBusSignalArguments(QLatin1String("accessible-description"), 0, 0, variantForPath(path));
|
QVariantList args = packDBusSignalArguments(QLatin1String("accessible-description"), 0, 0, variantForPath(path));
|
||||||
sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT),
|
sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT),
|
||||||
QLatin1String("PropertyChange"), args);
|
QLatin1String("PropertyChange"), args);
|
||||||
@ -951,14 +930,14 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event)
|
|||||||
}
|
}
|
||||||
case QAccessible::Focus: {
|
case QAccessible::Focus: {
|
||||||
if (sendFocus || sendObject || sendObject_state_changed)
|
if (sendFocus || sendObject || sendObject_state_changed)
|
||||||
sendFocusChanged(QAIPointer(event->accessibleInterface()));
|
sendFocusChanged(event->accessibleInterface());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case QAccessible::TextInserted:
|
case QAccessible::TextInserted:
|
||||||
case QAccessible::TextRemoved:
|
case QAccessible::TextRemoved:
|
||||||
case QAccessible::TextUpdated: {
|
case QAccessible::TextUpdated: {
|
||||||
if (sendObject || sendObject_text_changed) {
|
if (sendObject || sendObject_text_changed) {
|
||||||
QAIPointer iface = QAIPointer(event->accessibleInterface());
|
QAccessibleInterface * iface = event->accessibleInterface();
|
||||||
if (!iface || !iface->textInterface()) {
|
if (!iface || !iface->textInterface()) {
|
||||||
qAtspiDebug() << "Received text event for invalid interface.";
|
qAtspiDebug() << "Received text event for invalid interface.";
|
||||||
return;
|
return;
|
||||||
@ -1016,7 +995,7 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event)
|
|||||||
}
|
}
|
||||||
case QAccessible::TextCaretMoved: {
|
case QAccessible::TextCaretMoved: {
|
||||||
if (sendObject || sendObject_text_caret_moved) {
|
if (sendObject || sendObject_text_caret_moved) {
|
||||||
QAIPointer iface = QAIPointer(event->accessibleInterface());
|
QAccessibleInterface * iface = event->accessibleInterface();
|
||||||
if (!iface || !iface->textInterface()) {
|
if (!iface || !iface->textInterface()) {
|
||||||
qWarning() << "Sending TextCaretMoved from object that does not implement text interface: " << iface;
|
qWarning() << "Sending TextCaretMoved from object that does not implement text interface: " << iface;
|
||||||
return;
|
return;
|
||||||
@ -1034,7 +1013,7 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event)
|
|||||||
}
|
}
|
||||||
case QAccessible::TextSelectionChanged: {
|
case QAccessible::TextSelectionChanged: {
|
||||||
if (sendObject || sendObject_text_selection_changed) {
|
if (sendObject || sendObject_text_selection_changed) {
|
||||||
QAIPointer iface = QAIPointer(event->accessibleInterface());
|
QAccessibleInterface * iface = event->accessibleInterface();
|
||||||
QString path = pathForInterface(iface);
|
QString path = pathForInterface(iface);
|
||||||
QVariantList args = packDBusSignalArguments(QString(), 0, 0, QVariant::fromValue(QDBusVariant(QVariant(QString()))));
|
QVariantList args = packDBusSignalArguments(QString(), 0, 0, QVariant::fromValue(QDBusVariant(QVariant(QString()))));
|
||||||
sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT),
|
sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT),
|
||||||
@ -1044,7 +1023,7 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event)
|
|||||||
}
|
}
|
||||||
case QAccessible::ValueChanged: {
|
case QAccessible::ValueChanged: {
|
||||||
if (sendObject || sendObject_value_changed || sendObject_property_change_accessible_value) {
|
if (sendObject || sendObject_value_changed || sendObject_property_change_accessible_value) {
|
||||||
QAIPointer iface = QAIPointer(event->accessibleInterface());
|
QAccessibleInterface * iface = event->accessibleInterface();
|
||||||
if (!iface || !iface->valueInterface()) {
|
if (!iface || !iface->valueInterface()) {
|
||||||
qWarning() << "ValueChanged event from invalid accessible: " << iface;
|
qWarning() << "ValueChanged event from invalid accessible: " << iface;
|
||||||
return;
|
return;
|
||||||
@ -1058,7 +1037,7 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case QAccessible::Selection: {
|
case QAccessible::Selection: {
|
||||||
QAIPointer iface = QAIPointer(event->accessibleInterface());
|
QAccessibleInterface * iface = event->accessibleInterface();
|
||||||
if (!iface) {
|
if (!iface) {
|
||||||
qWarning() << "Selection event from invalid accessible.";
|
qWarning() << "Selection event from invalid accessible.";
|
||||||
return;
|
return;
|
||||||
@ -1075,7 +1054,7 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event)
|
|||||||
if (sendObject || sendObject_state_changed || sendWindow || sendWindow_activate) {
|
if (sendObject || sendObject_state_changed || sendWindow || sendWindow_activate) {
|
||||||
QAccessible::State stateChange = static_cast<QAccessibleStateChangeEvent*>(event)->changedStates();
|
QAccessible::State stateChange = static_cast<QAccessibleStateChangeEvent*>(event)->changedStates();
|
||||||
if (stateChange.checked) {
|
if (stateChange.checked) {
|
||||||
QAIPointer iface = QAIPointer(event->accessibleInterface());
|
QAccessibleInterface * iface = event->accessibleInterface();
|
||||||
if (!iface) {
|
if (!iface) {
|
||||||
qWarning() << "StateChanged event from invalid accessible.";
|
qWarning() << "StateChanged event from invalid accessible.";
|
||||||
return;
|
return;
|
||||||
@ -1083,7 +1062,7 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event)
|
|||||||
int checked = iface->state().checked;
|
int checked = iface->state().checked;
|
||||||
notifyStateChange(iface, QLatin1String("checked"), checked);
|
notifyStateChange(iface, QLatin1String("checked"), checked);
|
||||||
} else if (stateChange.active) {
|
} else if (stateChange.active) {
|
||||||
QAIPointer iface = QAIPointer(event->accessibleInterface());
|
QAccessibleInterface * iface = event->accessibleInterface();
|
||||||
if (!iface || !(iface->role() == QAccessible::Window && (sendWindow || sendWindow_activate)))
|
if (!iface || !(iface->role() == QAccessible::Window && (sendWindow || sendWindow_activate)))
|
||||||
return;
|
return;
|
||||||
QString windowTitle = iface->text(QAccessible::Name);
|
QString windowTitle = iface->text(QAccessible::Name);
|
||||||
@ -1098,7 +1077,7 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event)
|
|||||||
int isActive = iface->state().active;
|
int isActive = iface->state().active;
|
||||||
notifyStateChange(iface, QLatin1String("active"), isActive);
|
notifyStateChange(iface, QLatin1String("active"), isActive);
|
||||||
} else if (stateChange.disabled) {
|
} else if (stateChange.disabled) {
|
||||||
QAIPointer iface = QAIPointer(event->accessibleInterface());
|
QAccessibleInterface *iface = event->accessibleInterface();
|
||||||
QAccessible::State state = iface->state();
|
QAccessible::State state = iface->state();
|
||||||
bool enabled = !state.disabled;
|
bool enabled = !state.disabled;
|
||||||
|
|
||||||
@ -1170,7 +1149,7 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AtSpiAdaptor::sendFocusChanged(const QAIPointer &interface) const
|
void AtSpiAdaptor::sendFocusChanged(QAccessibleInterface *interface) const
|
||||||
{
|
{
|
||||||
static QString lastFocusPath;
|
static QString lastFocusPath;
|
||||||
// "remove" old focus
|
// "remove" old focus
|
||||||
@ -1194,13 +1173,13 @@ void AtSpiAdaptor::sendFocusChanged(const QAIPointer &interface) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AtSpiAdaptor::notifyAboutCreation(const QAIPointer &interface) const
|
void AtSpiAdaptor::notifyAboutCreation(QAccessibleInterface *interface) const
|
||||||
{
|
{
|
||||||
// // say hello to d-bus
|
// // say hello to d-bus
|
||||||
// cache->emitAddAccessible(accessible->getCacheItem());
|
// cache->emitAddAccessible(accessible->getCacheItem());
|
||||||
|
|
||||||
// notify about the new child of our parent
|
// notify about the new child of our parent
|
||||||
QAIPointer parent(interface->parent());
|
QAccessibleInterface * parent = interface->parent();
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
qAtspiDebug() << "AtSpiAdaptor::notifyAboutCreation: Could not find parent for " << interface->object();
|
qAtspiDebug() << "AtSpiAdaptor::notifyAboutCreation: Could not find parent for " << interface->object();
|
||||||
return;
|
return;
|
||||||
@ -1212,12 +1191,12 @@ void AtSpiAdaptor::notifyAboutCreation(const QAIPointer &interface) const
|
|||||||
sendDBusSignal(parentPath, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), QLatin1String("ChildrenChanged"), args);
|
sendDBusSignal(parentPath, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), QLatin1String("ChildrenChanged"), args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AtSpiAdaptor::notifyAboutDestruction(const QAIPointer &interface) const
|
void AtSpiAdaptor::notifyAboutDestruction(QAccessibleInterface *interface) const
|
||||||
{
|
{
|
||||||
if (!interface || !interface->isValid())
|
if (!interface || !interface->isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QAIPointer parent(interface->parent());
|
QAccessibleInterface * parent = interface->parent();
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
qAtspiDebug() << "AtSpiAdaptor::notifyAboutDestruction: Could not find parent for " << interface->object();
|
qAtspiDebug() << "AtSpiAdaptor::notifyAboutDestruction: Could not find parent for " << interface->object();
|
||||||
return;
|
return;
|
||||||
@ -1233,7 +1212,7 @@ void AtSpiAdaptor::notifyAboutDestruction(const QAIPointer &interface) const
|
|||||||
// childIndex = parent->indexOfChild(interface);
|
// childIndex = parent->indexOfChild(interface);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
QString parentPath = pathForInterface(parent, true);
|
QString parentPath = pathForInterface(parent);
|
||||||
QVariantList args = packDBusSignalArguments(QLatin1String("remove"), childIndex, 0, variantForPath(path));
|
QVariantList args = packDBusSignalArguments(QLatin1String("remove"), childIndex, 0, variantForPath(path));
|
||||||
sendDBusSignal(parentPath, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), QLatin1String("ChildrenChanged"), args);
|
sendDBusSignal(parentPath, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), QLatin1String("ChildrenChanged"), args);
|
||||||
}
|
}
|
||||||
@ -1245,7 +1224,7 @@ void AtSpiAdaptor::notifyAboutDestruction(const QAIPointer &interface) const
|
|||||||
bool AtSpiAdaptor::handleMessage(const QDBusMessage &message, const QDBusConnection &connection)
|
bool AtSpiAdaptor::handleMessage(const QDBusMessage &message, const QDBusConnection &connection)
|
||||||
{
|
{
|
||||||
// get accessible interface
|
// get accessible interface
|
||||||
QAIPointer accessible = interfaceFromPath(message.path());
|
QAccessibleInterface * accessible = interfaceFromPath(message.path());
|
||||||
if (!accessible) {
|
if (!accessible) {
|
||||||
qAtspiDebug() << "WARNING Qt AtSpiAdaptor: Could not find accessible on path: " << message.path();
|
qAtspiDebug() << "WARNING Qt AtSpiAdaptor: Could not find accessible on path: " << message.path();
|
||||||
return false;
|
return false;
|
||||||
@ -1295,7 +1274,7 @@ bool AtSpiAdaptor::handleMessage(const QDBusMessage &message, const QDBusConnect
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Application
|
// Application
|
||||||
bool AtSpiAdaptor::applicationInterface(const QAIPointer &interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection)
|
bool AtSpiAdaptor::applicationInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection)
|
||||||
{
|
{
|
||||||
if (message.path() != QLatin1String(ATSPI_DBUS_PATH_ROOT)) {
|
if (message.path() != QLatin1String(ATSPI_DBUS_PATH_ROOT)) {
|
||||||
qAtspiDebug() << "WARNING Qt AtSpiAdaptor: Could not find application interface for: " << message.path() << interface;
|
qAtspiDebug() << "WARNING Qt AtSpiAdaptor: Could not find application interface for: " << message.path() << interface;
|
||||||
@ -1358,7 +1337,7 @@ void AtSpiAdaptor::registerApplication()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Accessible
|
// Accessible
|
||||||
bool AtSpiAdaptor::accessibleInterface(const QAIPointer &interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection)
|
bool AtSpiAdaptor::accessibleInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection)
|
||||||
{
|
{
|
||||||
if (function == QLatin1String("GetRole")) {
|
if (function == QLatin1String("GetRole")) {
|
||||||
sendReply(connection, message, (uint) getRole(interface));
|
sendReply(connection, message, (uint) getRole(interface));
|
||||||
@ -1372,9 +1351,9 @@ bool AtSpiAdaptor::accessibleInterface(const QAIPointer &interface, const QStrin
|
|||||||
sendReply(connection, message, QVariant::fromValue(QDBusVariant(interface->childCount())));
|
sendReply(connection, message, QVariant::fromValue(QDBusVariant(interface->childCount())));
|
||||||
} else if (function == QLatin1String("GetIndexInParent")) {
|
} else if (function == QLatin1String("GetIndexInParent")) {
|
||||||
int childIndex = -1;
|
int childIndex = -1;
|
||||||
QAIPointer parent(interface->parent());
|
QAccessibleInterface * parent = interface->parent();
|
||||||
if (parent) {
|
if (parent) {
|
||||||
childIndex = parent->indexOfChild(interface.data());
|
childIndex = parent->indexOfChild(interface);
|
||||||
if (childIndex < 0) {
|
if (childIndex < 0) {
|
||||||
qAtspiDebug() << "GetIndexInParent get invalid index: " << childIndex << interface;
|
qAtspiDebug() << "GetIndexInParent get invalid index: " << childIndex << interface;
|
||||||
}
|
}
|
||||||
@ -1382,7 +1361,7 @@ bool AtSpiAdaptor::accessibleInterface(const QAIPointer &interface, const QStrin
|
|||||||
sendReply(connection, message, childIndex);
|
sendReply(connection, message, childIndex);
|
||||||
} else if (function == QLatin1String("GetParent")) {
|
} else if (function == QLatin1String("GetParent")) {
|
||||||
QString path;
|
QString path;
|
||||||
QAIPointer parent(interface->parent());
|
QAccessibleInterface * parent = interface->parent();
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
path = QLatin1String(ATSPI_DBUS_PATH_NULL);
|
path = QLatin1String(ATSPI_DBUS_PATH_NULL);
|
||||||
} else if (parent->role() == QAccessible::Application) {
|
} else if (parent->role() == QAccessible::Application) {
|
||||||
@ -1399,7 +1378,7 @@ bool AtSpiAdaptor::accessibleInterface(const QAIPointer &interface, const QStrin
|
|||||||
sendReply(connection, message, QVariant::fromValue(
|
sendReply(connection, message, QVariant::fromValue(
|
||||||
QSpiObjectReference(connection, QDBusObjectPath(ATSPI_DBUS_PATH_NULL))));
|
QSpiObjectReference(connection, QDBusObjectPath(ATSPI_DBUS_PATH_NULL))));
|
||||||
} else {
|
} else {
|
||||||
QAIPointer childInterface = QAIPointer(interface->child(index));
|
QAccessibleInterface * childInterface = interface->child(index);
|
||||||
sendReply(connection, message, QVariant::fromValue(
|
sendReply(connection, message, QVariant::fromValue(
|
||||||
QSpiObjectReference(connection, QDBusObjectPath(pathForInterface(childInterface)))));
|
QSpiObjectReference(connection, QDBusObjectPath(pathForInterface(childInterface)))));
|
||||||
}
|
}
|
||||||
@ -1440,7 +1419,7 @@ bool AtSpiAdaptor::accessibleInterface(const QAIPointer &interface, const QStrin
|
|||||||
} else if (function == QLatin1String("GetChildren")) {
|
} else if (function == QLatin1String("GetChildren")) {
|
||||||
QSpiObjectReferenceArray children;
|
QSpiObjectReferenceArray children;
|
||||||
for (int i = 0; i < interface->childCount(); ++i) {
|
for (int i = 0; i < interface->childCount(); ++i) {
|
||||||
QString childPath = pathForInterface(QAIPointer(interface->child(i)));
|
QString childPath = pathForInterface(interface->child(i));
|
||||||
QSpiObjectReference ref(connection, QDBusObjectPath(childPath));
|
QSpiObjectReference ref(connection, QDBusObjectPath(childPath));
|
||||||
children << ref;
|
children << ref;
|
||||||
}
|
}
|
||||||
@ -1452,7 +1431,7 @@ bool AtSpiAdaptor::accessibleInterface(const QAIPointer &interface, const QStrin
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
AtspiRole AtSpiAdaptor::getRole(const QAIPointer &interface) const
|
AtspiRole AtSpiAdaptor::getRole(QAccessibleInterface *interface) const
|
||||||
{
|
{
|
||||||
if ((interface->role() == QAccessible::EditableText) && interface->state().passwordEdit)
|
if ((interface->role() == QAccessible::EditableText) && interface->state().passwordEdit)
|
||||||
return ATSPI_ROLE_PASSWORD_TEXT;
|
return ATSPI_ROLE_PASSWORD_TEXT;
|
||||||
@ -1461,7 +1440,7 @@ AtspiRole AtSpiAdaptor::getRole(const QAIPointer &interface) const
|
|||||||
|
|
||||||
//#define ACCESSIBLE_CREATION_DEBUG
|
//#define ACCESSIBLE_CREATION_DEBUG
|
||||||
|
|
||||||
QStringList AtSpiAdaptor::accessibleInterfaces(const QAIPointer &interface) const
|
QStringList AtSpiAdaptor::accessibleInterfaces(QAccessibleInterface *interface) const
|
||||||
{
|
{
|
||||||
QStringList ifaces;
|
QStringList ifaces;
|
||||||
#ifdef ACCESSIBLE_CREATION_DEBUG
|
#ifdef ACCESSIBLE_CREATION_DEBUG
|
||||||
@ -1505,7 +1484,7 @@ QStringList AtSpiAdaptor::accessibleInterfaces(const QAIPointer &interface) cons
|
|||||||
return ifaces;
|
return ifaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSpiRelationArray AtSpiAdaptor::relationSet(const QAIPointer &interface, const QDBusConnection &connection) const
|
QSpiRelationArray AtSpiAdaptor::relationSet(QAccessibleInterface *interface, const QDBusConnection &connection) const
|
||||||
{
|
{
|
||||||
typedef QPair<QAccessibleInterface*, QAccessible::Relation> RelationPair;
|
typedef QPair<QAccessibleInterface*, QAccessible::Relation> RelationPair;
|
||||||
QVector<RelationPair> relationInterfaces;
|
QVector<RelationPair> relationInterfaces;
|
||||||
@ -1517,7 +1496,7 @@ QSpiRelationArray AtSpiAdaptor::relationSet(const QAIPointer &interface, const Q
|
|||||||
//And why is it a list, when it always have one item? And it seems to assume that the QAccessible::Relation enum maps directly to AtSpi
|
//And why is it a list, when it always have one item? And it seems to assume that the QAccessible::Relation enum maps directly to AtSpi
|
||||||
QList<QSpiObjectReference> related;
|
QList<QSpiObjectReference> related;
|
||||||
|
|
||||||
QDBusObjectPath path = QDBusObjectPath(pathForInterface(QAIPointer(pair.first)));
|
QDBusObjectPath path = QDBusObjectPath(pathForInterface(pair.first));
|
||||||
related.append(QSpiObjectReference(connection, path));
|
related.append(QSpiObjectReference(connection, path));
|
||||||
|
|
||||||
if (!related.isEmpty())
|
if (!related.isEmpty())
|
||||||
@ -1537,56 +1516,24 @@ QString AtSpiAdaptor::pathForObject(QObject *object) const
|
|||||||
{
|
{
|
||||||
Q_ASSERT(object);
|
Q_ASSERT(object);
|
||||||
|
|
||||||
if (object == qApp) {
|
if (inheritsQAction(object)) {
|
||||||
return QLatin1String(QSPI_OBJECT_PATH_ROOT);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (qstrcmp(object->metaObject()->className(), "QAction") == 0) {
|
|
||||||
qAtspiDebug() << "AtSpiAdaptor::pathForObject: warning: creating path with QAction as object.";
|
qAtspiDebug() << "AtSpiAdaptor::pathForObject: warning: creating path with QAction as object.";
|
||||||
}
|
}
|
||||||
quintptr uintptr = reinterpret_cast<quintptr>(object);
|
|
||||||
if (!m_handledObjects.contains(uintptr) || m_handledObjects.value(uintptr) == 0)
|
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(object);
|
||||||
m_handledObjects[uintptr] = QPointer<QObject>(object);
|
return pathForInterface(iface);
|
||||||
return QLatin1String(QSPI_OBJECT_PATH_PREFIX) + QString::number(uintptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AtSpiAdaptor::pathForInterface(const QAIPointer &interface, bool inDestructor) const
|
QString AtSpiAdaptor::pathForInterface(QAccessibleInterface *interface) const
|
||||||
{
|
{
|
||||||
if (!interface || !interface->isValid())
|
if (!interface || !interface->isValid())
|
||||||
return QLatin1String(ATSPI_DBUS_PATH_NULL);
|
return QLatin1String(ATSPI_DBUS_PATH_NULL);
|
||||||
if (interface->role() == QAccessible::Application)
|
if (interface->role() == QAccessible::Application)
|
||||||
return QLatin1String(QSPI_OBJECT_PATH_ROOT);
|
return QLatin1String(QSPI_OBJECT_PATH_ROOT);
|
||||||
|
|
||||||
QAIPointer interfaceWithObject = interface;
|
QAccessible::Id id = QAccessible::uniqueId(interface);
|
||||||
QString path;
|
Q_ASSERT((int)id < 0);
|
||||||
|
return QLatin1String(QSPI_OBJECT_PATH_PREFIX) + QString::number(id);
|
||||||
QAccessible::Role role = interface->role();
|
|
||||||
if (((role == QAccessible::MenuItem) || (role == QAccessible::Separator)) &&
|
|
||||||
interface->object() && inheritsQAction(interface->object())) {
|
|
||||||
interfaceWithObject = QAIPointer(interface->parent());
|
|
||||||
int childIndex = interfaceWithObject->indexOfChild(interface.data());
|
|
||||||
path.append(QString::fromLatin1("/%1").arg(childIndex));
|
|
||||||
}
|
|
||||||
|
|
||||||
while (!interfaceWithObject->object()) {
|
|
||||||
QAIPointer parentInterface(interfaceWithObject->parent());
|
|
||||||
|
|
||||||
Q_ASSERT(parentInterface->isValid());
|
|
||||||
int index = parentInterface->indexOfChild(interfaceWithObject.data());
|
|
||||||
if (index < 0) {
|
|
||||||
qAtspiDebug() << "Object claims to have child that we cannot navigate to. FIX IT!" << parentInterface->object();
|
|
||||||
return QLatin1String(ATSPI_DBUS_PATH_NULL);
|
|
||||||
}
|
|
||||||
path.prepend(QLatin1Char('/') + QString::number(index));
|
|
||||||
interfaceWithObject = parentInterface;
|
|
||||||
}
|
|
||||||
quintptr uintptr = reinterpret_cast<quintptr>(interfaceWithObject->object());
|
|
||||||
path.prepend(QLatin1String(QSPI_OBJECT_PATH_PREFIX) + QString::number(uintptr));
|
|
||||||
|
|
||||||
if (!inDestructor && (!m_handledObjects.contains(uintptr) || m_handledObjects.value(uintptr) == 0))
|
|
||||||
m_handledObjects[uintptr] = QPointer<QObject>(interfaceWithObject->object());
|
|
||||||
|
|
||||||
return path;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AtSpiAdaptor::inheritsQAction(QObject *object)
|
bool AtSpiAdaptor::inheritsQAction(QObject *object)
|
||||||
@ -1602,21 +1549,21 @@ bool AtSpiAdaptor::inheritsQAction(QObject *object)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Component
|
// Component
|
||||||
static QAIPointer getWindow(QAIPointer interface)
|
static QAccessibleInterface * getWindow(QAccessibleInterface * interface)
|
||||||
{
|
{
|
||||||
if (interface->role() == QAccessible::Window)
|
if (interface->role() == QAccessible::Window)
|
||||||
return interface;
|
return interface;
|
||||||
|
|
||||||
QAIPointer parent(interface->parent());
|
QAccessibleInterface * parent = interface->parent();
|
||||||
while (parent && parent->role() != QAccessible::Window)
|
while (parent && parent->role() != QAccessible::Window)
|
||||||
parent = QAIPointer(parent->parent());
|
parent = parent->parent();
|
||||||
|
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QRect getRelativeRect(const QAIPointer &interface)
|
static QRect getRelativeRect(QAccessibleInterface *interface)
|
||||||
{
|
{
|
||||||
QAIPointer window;
|
QAccessibleInterface * window;
|
||||||
QRect wr, cr;
|
QRect wr, cr;
|
||||||
|
|
||||||
cr = interface->rect();
|
cr = interface->rect();
|
||||||
@ -1631,7 +1578,7 @@ static QRect getRelativeRect(const QAIPointer &interface)
|
|||||||
return cr;
|
return cr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AtSpiAdaptor::componentInterface(const QAIPointer &interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection)
|
bool AtSpiAdaptor::componentInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection)
|
||||||
{
|
{
|
||||||
if (function == QLatin1String("Contains")) {
|
if (function == QLatin1String("Contains")) {
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
@ -1649,11 +1596,11 @@ bool AtSpiAdaptor::componentInterface(const QAIPointer &interface, const QString
|
|||||||
uint coordType = message.arguments().at(2).toUInt();
|
uint coordType = message.arguments().at(2).toUInt();
|
||||||
Q_UNUSED (coordType) // FIXME
|
Q_UNUSED (coordType) // FIXME
|
||||||
|
|
||||||
QAIPointer childInterface(interface->childAt(x, y));
|
QAccessibleInterface * childInterface(interface->childAt(x, y));
|
||||||
QAIPointer iface;
|
QAccessibleInterface * iface = 0;
|
||||||
while (childInterface) {
|
while (childInterface) {
|
||||||
iface = childInterface;
|
iface = childInterface;
|
||||||
childInterface = QAIPointer(iface->childAt(x, y));
|
childInterface = iface->childAt(x, y);
|
||||||
}
|
}
|
||||||
if (iface) {
|
if (iface) {
|
||||||
QString path = pathForInterface(iface);
|
QString path = pathForInterface(iface);
|
||||||
@ -1721,13 +1668,13 @@ bool AtSpiAdaptor::componentInterface(const QAIPointer &interface, const QString
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QRect AtSpiAdaptor::getExtents(const QAIPointer &interface, uint coordType)
|
QRect AtSpiAdaptor::getExtents(QAccessibleInterface *interface, uint coordType)
|
||||||
{
|
{
|
||||||
return (coordType == ATSPI_COORD_TYPE_SCREEN) ? interface->rect() : getRelativeRect(interface);
|
return (coordType == ATSPI_COORD_TYPE_SCREEN) ? interface->rect() : getRelativeRect(interface);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Action interface
|
// Action interface
|
||||||
bool AtSpiAdaptor::actionInterface(const QAIPointer &interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection)
|
bool AtSpiAdaptor::actionInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection)
|
||||||
{
|
{
|
||||||
QAccessibleActionInterface *actionIface = interface->actionInterface();
|
QAccessibleActionInterface *actionIface = interface->actionInterface();
|
||||||
if (!actionIface)
|
if (!actionIface)
|
||||||
@ -1797,7 +1744,7 @@ QSpiActionArray AtSpiAdaptor::getActions(QAccessibleActionInterface *actionInter
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Text interface
|
// Text interface
|
||||||
bool AtSpiAdaptor::textInterface(const QAIPointer &interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection)
|
bool AtSpiAdaptor::textInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection)
|
||||||
{
|
{
|
||||||
if (!interface->textInterface())
|
if (!interface->textInterface())
|
||||||
return false;
|
return false;
|
||||||
@ -1952,7 +1899,7 @@ QAccessible2::BoundaryType AtSpiAdaptor::qAccessibleBoundaryType(int atspiTextBo
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FIXME all attribute methods below should share code
|
// FIXME all attribute methods below should share code
|
||||||
QVariantList AtSpiAdaptor::getAttributes(const QAIPointer &interface, int offset, bool includeDefaults) const
|
QVariantList AtSpiAdaptor::getAttributes(QAccessibleInterface *interface, int offset, bool includeDefaults) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(includeDefaults);
|
Q_UNUSED(includeDefaults);
|
||||||
|
|
||||||
@ -1974,7 +1921,7 @@ QVariantList AtSpiAdaptor::getAttributes(const QAIPointer &interface, int offset
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantList AtSpiAdaptor::getAttributeValue(const QAIPointer &interface, int offset, const QString &attributeName) const
|
QVariantList AtSpiAdaptor::getAttributeValue(QAccessibleInterface *interface, int offset, const QString &attributeName) const
|
||||||
{
|
{
|
||||||
QString mapped;
|
QString mapped;
|
||||||
QString joined;
|
QString joined;
|
||||||
@ -1998,7 +1945,7 @@ QVariantList AtSpiAdaptor::getAttributeValue(const QAIPointer &interface, int of
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
QRect AtSpiAdaptor::getCharacterExtents(const QAIPointer &interface, int offset, uint coordType) const
|
QRect AtSpiAdaptor::getCharacterExtents(QAccessibleInterface *interface, int offset, uint coordType) const
|
||||||
{
|
{
|
||||||
QRect rect = interface->textInterface()->characterRect(offset);
|
QRect rect = interface->textInterface()->characterRect(offset);
|
||||||
|
|
||||||
@ -2008,7 +1955,7 @@ QRect AtSpiAdaptor::getCharacterExtents(const QAIPointer &interface, int offset,
|
|||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
QRect AtSpiAdaptor::getRangeExtents(const QAIPointer &interface,
|
QRect AtSpiAdaptor::getRangeExtents(QAccessibleInterface *interface,
|
||||||
int startOffset, int endOffset, uint coordType) const
|
int startOffset, int endOffset, uint coordType) const
|
||||||
{
|
{
|
||||||
if (endOffset == -1)
|
if (endOffset == -1)
|
||||||
@ -2029,9 +1976,9 @@ QRect AtSpiAdaptor::getRangeExtents(const QAIPointer &interface,
|
|||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
QRect AtSpiAdaptor::translateRectToWindowCoordinates(const QAIPointer &interface, const QRect &rect)
|
QRect AtSpiAdaptor::translateRectToWindowCoordinates(QAccessibleInterface *interface, const QRect &rect)
|
||||||
{
|
{
|
||||||
QAIPointer window = getWindow(interface);
|
QAccessibleInterface * window = getWindow(interface);
|
||||||
if (window)
|
if (window)
|
||||||
return rect.translated(-window->rect().x(), -window->rect().y());
|
return rect.translated(-window->rect().x(), -window->rect().y());
|
||||||
|
|
||||||
@ -2065,13 +2012,13 @@ static void replaceTextFallback(QAccessibleInterface *accessible, long startOffs
|
|||||||
accessible->setText(QAccessible::Value, t);
|
accessible->setText(QAccessible::Value, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AtSpiAdaptor::editableTextInterface(const QAIPointer &interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection)
|
bool AtSpiAdaptor::editableTextInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection)
|
||||||
{
|
{
|
||||||
if (function == QLatin1String("CopyText")) {
|
if (function == QLatin1String("CopyText")) {
|
||||||
#ifndef QT_NO_CLIPBOARD
|
#ifndef QT_NO_CLIPBOARD
|
||||||
int startOffset = message.arguments().at(0).toInt();
|
int startOffset = message.arguments().at(0).toInt();
|
||||||
int endOffset = message.arguments().at(1).toInt();
|
int endOffset = message.arguments().at(1).toInt();
|
||||||
const QString t = textForRange(interface.data(), startOffset, endOffset);
|
const QString t = textForRange(interface, startOffset, endOffset);
|
||||||
QGuiApplication::clipboard()->setText(t);
|
QGuiApplication::clipboard()->setText(t);
|
||||||
#endif
|
#endif
|
||||||
connection.send(message.createReply(true));
|
connection.send(message.createReply(true));
|
||||||
@ -2079,11 +2026,11 @@ bool AtSpiAdaptor::editableTextInterface(const QAIPointer &interface, const QStr
|
|||||||
#ifndef QT_NO_CLIPBOARD
|
#ifndef QT_NO_CLIPBOARD
|
||||||
int startOffset = message.arguments().at(0).toInt();
|
int startOffset = message.arguments().at(0).toInt();
|
||||||
int endOffset = message.arguments().at(1).toInt();
|
int endOffset = message.arguments().at(1).toInt();
|
||||||
const QString t = textForRange(interface.data(), startOffset, endOffset);
|
const QString t = textForRange(interface, startOffset, endOffset);
|
||||||
if (QAccessibleEditableTextInterface *editableTextIface = interface->editableTextInterface())
|
if (QAccessibleEditableTextInterface *editableTextIface = interface->editableTextInterface())
|
||||||
editableTextIface->deleteText(startOffset, endOffset);
|
editableTextIface->deleteText(startOffset, endOffset);
|
||||||
else
|
else
|
||||||
replaceTextFallback(interface.data(), startOffset, endOffset, QString());
|
replaceTextFallback(interface, startOffset, endOffset, QString());
|
||||||
QGuiApplication::clipboard()->setText(t);
|
QGuiApplication::clipboard()->setText(t);
|
||||||
#endif
|
#endif
|
||||||
connection.send(message.createReply(true));
|
connection.send(message.createReply(true));
|
||||||
@ -2093,7 +2040,7 @@ bool AtSpiAdaptor::editableTextInterface(const QAIPointer &interface, const QStr
|
|||||||
if (QAccessibleEditableTextInterface *editableTextIface = interface->editableTextInterface())
|
if (QAccessibleEditableTextInterface *editableTextIface = interface->editableTextInterface())
|
||||||
editableTextIface->deleteText(startOffset, endOffset);
|
editableTextIface->deleteText(startOffset, endOffset);
|
||||||
else
|
else
|
||||||
replaceTextFallback(interface.data(), startOffset, endOffset, QString());
|
replaceTextFallback(interface, startOffset, endOffset, QString());
|
||||||
connection.send(message.createReply(true));
|
connection.send(message.createReply(true));
|
||||||
} else if (function == QLatin1String("InsertText")) {
|
} else if (function == QLatin1String("InsertText")) {
|
||||||
int position = message.arguments().at(0).toInt();
|
int position = message.arguments().at(0).toInt();
|
||||||
@ -2103,7 +2050,7 @@ bool AtSpiAdaptor::editableTextInterface(const QAIPointer &interface, const QStr
|
|||||||
if (QAccessibleEditableTextInterface *editableTextIface = interface->editableTextInterface())
|
if (QAccessibleEditableTextInterface *editableTextIface = interface->editableTextInterface())
|
||||||
editableTextIface->insertText(position, text);
|
editableTextIface->insertText(position, text);
|
||||||
else
|
else
|
||||||
replaceTextFallback(interface.data(), position, position, text);
|
replaceTextFallback(interface, position, position, text);
|
||||||
connection.send(message.createReply(true));
|
connection.send(message.createReply(true));
|
||||||
} else if (function == QLatin1String("PasteText")) {
|
} else if (function == QLatin1String("PasteText")) {
|
||||||
#ifndef QT_NO_CLIPBOARD
|
#ifndef QT_NO_CLIPBOARD
|
||||||
@ -2112,7 +2059,7 @@ bool AtSpiAdaptor::editableTextInterface(const QAIPointer &interface, const QStr
|
|||||||
if (QAccessibleEditableTextInterface *editableTextIface = interface->editableTextInterface())
|
if (QAccessibleEditableTextInterface *editableTextIface = interface->editableTextInterface())
|
||||||
editableTextIface->insertText(position, txt);
|
editableTextIface->insertText(position, txt);
|
||||||
else
|
else
|
||||||
replaceTextFallback(interface.data(), position, position, txt);
|
replaceTextFallback(interface, position, position, txt);
|
||||||
#endif
|
#endif
|
||||||
connection.send(message.createReply(true));
|
connection.send(message.createReply(true));
|
||||||
} else if (function == QLatin1String("SetTextContents")) {
|
} else if (function == QLatin1String("SetTextContents")) {
|
||||||
@ -2129,7 +2076,7 @@ bool AtSpiAdaptor::editableTextInterface(const QAIPointer &interface, const QStr
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Value interface
|
// Value interface
|
||||||
bool AtSpiAdaptor::valueInterface(const QAIPointer &interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection)
|
bool AtSpiAdaptor::valueInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection)
|
||||||
{
|
{
|
||||||
if (function == QLatin1String("SetCurrentValue")) {
|
if (function == QLatin1String("SetCurrentValue")) {
|
||||||
QDBusVariant v = message.arguments().at(2).value<QDBusVariant>();
|
QDBusVariant v = message.arguments().at(2).value<QDBusVariant>();
|
||||||
@ -2165,7 +2112,7 @@ bool AtSpiAdaptor::valueInterface(const QAIPointer &interface, const QString &fu
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Table interface
|
// Table interface
|
||||||
bool AtSpiAdaptor::tableInterface(const QAIPointer &interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection)
|
bool AtSpiAdaptor::tableInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection)
|
||||||
{
|
{
|
||||||
if (!(interface->tableInterface() || interface->tableCellInterface())) {
|
if (!(interface->tableInterface() || interface->tableCellInterface())) {
|
||||||
qAtspiDebug() << "WARNING Qt AtSpiAdaptor: Could not find table interface for: " << message.path() << interface;
|
qAtspiDebug() << "WARNING Qt AtSpiAdaptor: Could not find table interface for: " << message.path() << interface;
|
||||||
@ -2175,7 +2122,7 @@ bool AtSpiAdaptor::tableInterface(const QAIPointer &interface, const QString &fu
|
|||||||
if (0) {
|
if (0) {
|
||||||
// properties
|
// properties
|
||||||
} else if (function == QLatin1String("GetCaption")) {
|
} else if (function == QLatin1String("GetCaption")) {
|
||||||
QAIPointer captionInterface= QAIPointer(interface->tableInterface()->caption());
|
QAccessibleInterface * captionInterface= interface->tableInterface()->caption();
|
||||||
if (captionInterface) {
|
if (captionInterface) {
|
||||||
QSpiObjectReference ref = QSpiObjectReference(connection, QDBusObjectPath(pathForInterface(captionInterface)));
|
QSpiObjectReference ref = QSpiObjectReference(connection, QDBusObjectPath(pathForInterface(captionInterface)));
|
||||||
sendReply(connection, message, QVariant::fromValue(ref));
|
sendReply(connection, message, QVariant::fromValue(ref));
|
||||||
@ -2196,7 +2143,7 @@ bool AtSpiAdaptor::tableInterface(const QAIPointer &interface, const QString &fu
|
|||||||
connection.send(message.createReply(QVariant::fromValue(QDBusVariant(
|
connection.send(message.createReply(QVariant::fromValue(QDBusVariant(
|
||||||
QVariant::fromValue(interface->tableInterface()->selectedRowCount())))));
|
QVariant::fromValue(interface->tableInterface()->selectedRowCount())))));
|
||||||
} else if (function == QLatin1String("GetSummary")) {
|
} else if (function == QLatin1String("GetSummary")) {
|
||||||
QAIPointer summary = interface->tableInterface() ? QAIPointer(interface->tableInterface()->summary()) : QAIPointer(0);
|
QAccessibleInterface * summary = interface->tableInterface() ? interface->tableInterface()->summary() : 0;
|
||||||
QSpiObjectReference ref(connection, QDBusObjectPath(pathForInterface(summary)));
|
QSpiObjectReference ref(connection, QDBusObjectPath(pathForInterface(summary)));
|
||||||
connection.send(message.createReply(QVariant::fromValue(QDBusVariant(QVariant::fromValue(ref)))));
|
connection.send(message.createReply(QVariant::fromValue(QDBusVariant(QVariant::fromValue(ref)))));
|
||||||
} else if (function == QLatin1String("GetAccessibleAt")) {
|
} else if (function == QLatin1String("GetAccessibleAt")) {
|
||||||
@ -2211,7 +2158,7 @@ bool AtSpiAdaptor::tableInterface(const QAIPointer &interface, const QString &fu
|
|||||||
}
|
}
|
||||||
|
|
||||||
QSpiObjectReference ref;
|
QSpiObjectReference ref;
|
||||||
QAIPointer cell(interface->tableInterface()->cellAt(row, column));
|
QAccessibleInterface * cell(interface->tableInterface()->cellAt(row, column));
|
||||||
if (cell) {
|
if (cell) {
|
||||||
ref = QSpiObjectReference(connection, QDBusObjectPath(pathForInterface(cell)));
|
ref = QSpiObjectReference(connection, QDBusObjectPath(pathForInterface(cell)));
|
||||||
} else {
|
} else {
|
||||||
@ -2231,13 +2178,12 @@ bool AtSpiAdaptor::tableInterface(const QAIPointer &interface, const QString &fu
|
|||||||
int index = interface->indexOfChild(cell);
|
int index = interface->indexOfChild(cell);
|
||||||
qAtspiDebug() << "QSpiAdaptor::GetIndexAt row:" << row << " col:" << column << " logical index:" << index;
|
qAtspiDebug() << "QSpiAdaptor::GetIndexAt row:" << row << " col:" << column << " logical index:" << index;
|
||||||
Q_ASSERT(index > 0);
|
Q_ASSERT(index > 0);
|
||||||
delete cell;
|
|
||||||
connection.send(message.createReply(index));
|
connection.send(message.createReply(index));
|
||||||
} else if ((function == QLatin1String("GetColumnAtIndex")) || (function == QLatin1String("GetRowAtIndex"))) {
|
} else if ((function == QLatin1String("GetColumnAtIndex")) || (function == QLatin1String("GetRowAtIndex"))) {
|
||||||
int index = message.arguments().at(0).toInt();
|
int index = message.arguments().at(0).toInt();
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
QAIPointer cell = QAIPointer(interface->child(index));
|
QAccessibleInterface * cell = interface->child(index);
|
||||||
if (cell) {
|
if (cell) {
|
||||||
if (function == QLatin1String("GetColumnAtIndex")) {
|
if (function == QLatin1String("GetColumnAtIndex")) {
|
||||||
if (cell->role() == QAccessible::ColumnHeader) {
|
if (cell->role() == QAccessible::ColumnHeader) {
|
||||||
@ -2294,7 +2240,6 @@ bool AtSpiAdaptor::tableInterface(const QAIPointer &interface, const QString &fu
|
|||||||
if (cell) {
|
if (cell) {
|
||||||
cell->rowColumnExtents(&row, &col, &rowExtents, &colExtents, &isSelected);
|
cell->rowColumnExtents(&row, &col, &rowExtents, &colExtents, &isSelected);
|
||||||
success = true;
|
success = true;
|
||||||
delete cell;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantList list;
|
QVariantList list;
|
||||||
@ -2315,12 +2260,11 @@ bool AtSpiAdaptor::tableInterface(const QAIPointer &interface, const QString &fu
|
|||||||
int column = message.arguments().at(0).toInt();
|
int column = message.arguments().at(0).toInt();
|
||||||
QSpiObjectReference ref;
|
QSpiObjectReference ref;
|
||||||
|
|
||||||
QAIPointer cell(interface->tableInterface()->cellAt(0, column));
|
QAccessibleInterface * cell(interface->tableInterface()->cellAt(0, column));
|
||||||
if (cell && cell->tableCellInterface()) {
|
if (cell && cell->tableCellInterface()) {
|
||||||
QList<QAccessibleInterface*> header = cell->tableCellInterface()->columnHeaderCells();
|
QList<QAccessibleInterface*> header = cell->tableCellInterface()->columnHeaderCells();
|
||||||
if (header.size() > 0) {
|
if (header.size() > 0) {
|
||||||
ref = QSpiObjectReference(connection, QDBusObjectPath(pathForInterface(QAIPointer(header.takeAt(0)))));
|
ref = QSpiObjectReference(connection, QDBusObjectPath(pathForInterface(header.takeAt(0))));
|
||||||
qDeleteAll(header);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
connection.send(message.createReply(QVariant::fromValue(ref)));
|
connection.send(message.createReply(QVariant::fromValue(ref)));
|
||||||
@ -2331,10 +2275,8 @@ bool AtSpiAdaptor::tableInterface(const QAIPointer &interface, const QString &fu
|
|||||||
QAccessibleTableCellInterface *cell = interface->tableInterface()->cellAt(row, 0)->tableCellInterface();
|
QAccessibleTableCellInterface *cell = interface->tableInterface()->cellAt(row, 0)->tableCellInterface();
|
||||||
if (cell) {
|
if (cell) {
|
||||||
QList<QAccessibleInterface*> header = cell->rowHeaderCells();
|
QList<QAccessibleInterface*> header = cell->rowHeaderCells();
|
||||||
delete cell;
|
|
||||||
if (header.size() > 0) {
|
if (header.size() > 0) {
|
||||||
ref = QSpiObjectReference(connection, QDBusObjectPath(pathForInterface(QAIPointer(header.takeAt(0)))));
|
ref = QSpiObjectReference(connection, QDBusObjectPath(pathForInterface(header.takeAt(0))));
|
||||||
qDeleteAll(header);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
connection.send(message.createReply(QVariant::fromValue(ref)));
|
connection.send(message.createReply(QVariant::fromValue(ref)));
|
||||||
@ -2354,7 +2296,6 @@ bool AtSpiAdaptor::tableInterface(const QAIPointer &interface, const QString &fu
|
|||||||
int column = message.arguments().at(1).toInt();
|
int column = message.arguments().at(1).toInt();
|
||||||
QAccessibleTableCellInterface* cell = interface->tableInterface()->cellAt(row, column)->tableCellInterface();
|
QAccessibleTableCellInterface* cell = interface->tableInterface()->cellAt(row, column)->tableCellInterface();
|
||||||
connection.send(message.createReply(cell->isSelected()));
|
connection.send(message.createReply(cell->isSelected()));
|
||||||
delete cell;
|
|
||||||
} else if (function == QLatin1String("AddColumnSelection")) {
|
} else if (function == QLatin1String("AddColumnSelection")) {
|
||||||
int column = message.arguments().at(0).toInt();
|
int column = message.arguments().at(0).toInt();
|
||||||
connection.send(message.createReply(interface->tableInterface()->selectColumn(column)));
|
connection.send(message.createReply(interface->tableInterface()->selectColumn(column)));
|
||||||
|
@ -59,7 +59,6 @@ class QAccessibleInterface;
|
|||||||
class QSpiAccessibleInterface;
|
class QSpiAccessibleInterface;
|
||||||
class QSpiApplicationAdaptor;
|
class QSpiApplicationAdaptor;
|
||||||
|
|
||||||
typedef QSharedPointer<QAccessibleInterface> QAIPointer;
|
|
||||||
|
|
||||||
class AtSpiAdaptor :public QDBusVirtualObject
|
class AtSpiAdaptor :public QDBusVirtualObject
|
||||||
{
|
{
|
||||||
@ -90,45 +89,45 @@ private:
|
|||||||
bool sendDBusSignal(const QString &path, const QString &interface, const QString &name, const QVariantList &arguments) const;
|
bool sendDBusSignal(const QString &path, const QString &interface, const QString &name, const QVariantList &arguments) const;
|
||||||
QVariant variantForPath(const QString &path) const;
|
QVariant variantForPath(const QString &path) const;
|
||||||
|
|
||||||
void sendFocusChanged(const QAIPointer &interface) const;
|
void sendFocusChanged(QAccessibleInterface *interface) const;
|
||||||
void notifyAboutCreation(const QAIPointer &interface) const;
|
void notifyAboutCreation(QAccessibleInterface *interface) const;
|
||||||
void notifyAboutDestruction(const QAIPointer &interface) const;
|
void notifyAboutDestruction(QAccessibleInterface *interface) const;
|
||||||
|
|
||||||
// handlers for the different accessible interfaces
|
// handlers for the different accessible interfaces
|
||||||
bool applicationInterface(const QAIPointer &interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
|
bool applicationInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
|
||||||
bool accessibleInterface(const QAIPointer &interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
|
bool accessibleInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
|
||||||
bool componentInterface(const QAIPointer &interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
|
bool componentInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
|
||||||
bool actionInterface(const QAIPointer &interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
|
bool actionInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
|
||||||
bool textInterface(const QAIPointer &interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
|
bool textInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
|
||||||
bool editableTextInterface(const QAIPointer &interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
|
bool editableTextInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
|
||||||
bool valueInterface(const QAIPointer &interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
|
bool valueInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
|
||||||
bool tableInterface(const QAIPointer &interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
|
bool tableInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
|
||||||
|
|
||||||
void sendReply(const QDBusConnection &connection, const QDBusMessage &message, const QVariant &argument) const;
|
void sendReply(const QDBusConnection &connection, const QDBusMessage &message, const QVariant &argument) const;
|
||||||
|
|
||||||
QAIPointer interfaceFromPath(const QString& dbusPath) const;
|
QAccessibleInterface *interfaceFromPath(const QString& dbusPath) const;
|
||||||
QString pathForInterface(const QAIPointer &interface, bool inDestructor = false) const;
|
QString pathForInterface(QAccessibleInterface *interface) const;
|
||||||
QString pathForObject(QObject *object) const;
|
QString pathForObject(QObject *object) const;
|
||||||
|
|
||||||
void notifyStateChange(const QAIPointer& interface, const QString& state, int value);
|
void notifyStateChange(QAccessibleInterface *interface, const QString& state, int value);
|
||||||
|
|
||||||
// accessible helper functions
|
// accessible helper functions
|
||||||
AtspiRole getRole(const QAIPointer &interface) const;
|
AtspiRole getRole(QAccessibleInterface *interface) const;
|
||||||
QSpiRelationArray relationSet(const QAIPointer &interface, const QDBusConnection &connection) const;
|
QSpiRelationArray relationSet(QAccessibleInterface *interface, const QDBusConnection &connection) const;
|
||||||
QStringList accessibleInterfaces(const QAIPointer &interface) const;
|
QStringList accessibleInterfaces(QAccessibleInterface *interface) const;
|
||||||
|
|
||||||
// component helper functions
|
// component helper functions
|
||||||
static QRect getExtents(const QAIPointer &interface, uint coordType);
|
static QRect getExtents(QAccessibleInterface *interface, uint coordType);
|
||||||
static QRect translateRectToWindowCoordinates(const QAIPointer &interface, const QRect &rect);
|
static QRect translateRectToWindowCoordinates(QAccessibleInterface *interface, const QRect &rect);
|
||||||
|
|
||||||
// action helper functions
|
// action helper functions
|
||||||
QSpiActionArray getActions(QAccessibleActionInterface* interface) const;
|
QSpiActionArray getActions(QAccessibleActionInterface* interface) const;
|
||||||
|
|
||||||
// text helper functions
|
// text helper functions
|
||||||
QVariantList getAttributes(const QAIPointer &, int offset, bool includeDefaults) const;
|
QVariantList getAttributes(QAccessibleInterface *, int offset, bool includeDefaults) const;
|
||||||
QVariantList getAttributeValue(const QAIPointer &, int offset, const QString &attributeName) const;
|
QVariantList getAttributeValue(QAccessibleInterface *, int offset, const QString &attributeName) const;
|
||||||
QRect getCharacterExtents(const QAIPointer &, int offset, uint coordType) const;
|
QRect getCharacterExtents(QAccessibleInterface *, int offset, uint coordType) const;
|
||||||
QRect getRangeExtents(const QAIPointer &, int startOffset, int endOffset, uint coordType) const;
|
QRect getRangeExtents(QAccessibleInterface *, int startOffset, int endOffset, uint coordType) const;
|
||||||
QAccessible2::BoundaryType qAccessibleBoundaryType(int atspiTextBoundaryType) const;
|
QAccessible2::BoundaryType qAccessibleBoundaryType(int atspiTextBoundaryType) const;
|
||||||
static bool inheritsQAction(QObject *object);
|
static bool inheritsQAction(QObject *object);
|
||||||
|
|
||||||
@ -140,8 +139,6 @@ private:
|
|||||||
/// Assigned from the accessibility registry.
|
/// Assigned from the accessibility registry.
|
||||||
int m_applicationId;
|
int m_applicationId;
|
||||||
|
|
||||||
mutable QHash<quintptr, QPointer<QObject> > m_handledObjects;
|
|
||||||
|
|
||||||
// Bit fields - which updates to send
|
// Bit fields - which updates to send
|
||||||
|
|
||||||
// AT-SPI has some events that we do not care about:
|
// AT-SPI has some events that we do not care about:
|
||||||
|
@ -96,7 +96,6 @@ public:
|
|||||||
QAccessible::State state() const {
|
QAccessible::State state() const {
|
||||||
QAccessibleInterface *parentInterface = parent();
|
QAccessibleInterface *parentInterface = parent();
|
||||||
QAccessible::State state = parentInterface->state();
|
QAccessible::State state = parentInterface->state();
|
||||||
delete parentInterface;
|
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
QRect rect() const {
|
QRect rect() const {
|
||||||
@ -153,6 +152,12 @@ QAccessibleTabBar::QAccessibleTabBar(QWidget *w)
|
|||||||
Q_ASSERT(tabBar());
|
Q_ASSERT(tabBar());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QAccessibleTabBar::~QAccessibleTabBar()
|
||||||
|
{
|
||||||
|
foreach (QAccessible::Id id, m_childInterfaces.values())
|
||||||
|
QAccessible::deleteAccessibleInterface(id);
|
||||||
|
}
|
||||||
|
|
||||||
/*! Returns the QTabBar. */
|
/*! Returns the QTabBar. */
|
||||||
QTabBar *QAccessibleTabBar::tabBar() const
|
QTabBar *QAccessibleTabBar::tabBar() const
|
||||||
{
|
{
|
||||||
@ -161,9 +166,14 @@ QTabBar *QAccessibleTabBar::tabBar() const
|
|||||||
|
|
||||||
QAccessibleInterface* QAccessibleTabBar::child(int index) const
|
QAccessibleInterface* QAccessibleTabBar::child(int index) const
|
||||||
{
|
{
|
||||||
|
if (QAccessible::Id id = m_childInterfaces.value(index))
|
||||||
|
return QAccessible::accessibleInterface(id);
|
||||||
|
|
||||||
// first the tabs, then 2 buttons
|
// first the tabs, then 2 buttons
|
||||||
if (index < tabBar()->count()) {
|
if (index < tabBar()->count()) {
|
||||||
QAccessibleTabButton *button = new QAccessibleTabButton(tabBar(), index);
|
QAccessibleTabButton *button = new QAccessibleTabButton(tabBar(), index);
|
||||||
|
QAccessible::registerAccessibleInterface(button);
|
||||||
|
m_childInterfaces.insert(index, QAccessible::uniqueId(button));
|
||||||
return button;
|
return button;
|
||||||
} else if (index >= tabBar()->count()) {
|
} else if (index >= tabBar()->count()) {
|
||||||
// left button
|
// left button
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
#include <QtWidgets/qabstractitemview.h>
|
#include <QtWidgets/qabstractitemview.h>
|
||||||
#include <QtGui/private/qaccessible2_p.h>
|
#include <QtGui/private/qaccessible2_p.h>
|
||||||
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
#ifndef QT_NO_ACCESSIBILITY
|
#ifndef QT_NO_ACCESSIBILITY
|
||||||
@ -101,6 +102,7 @@ class QAccessibleTabBar : public QAccessibleWidget
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit QAccessibleTabBar(QWidget *w);
|
explicit QAccessibleTabBar(QWidget *w);
|
||||||
|
~QAccessibleTabBar();
|
||||||
|
|
||||||
int childCount() const;
|
int childCount() const;
|
||||||
QString text(QAccessible::Text t) const;
|
QString text(QAccessible::Text t) const;
|
||||||
@ -113,6 +115,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
QTabBar *tabBar() const;
|
QTabBar *tabBar() const;
|
||||||
|
mutable QHash<int, QAccessible::Id> m_childInterfaces;
|
||||||
};
|
};
|
||||||
#endif // QT_NO_TABBAR
|
#endif // QT_NO_TABBAR
|
||||||
|
|
||||||
|
@ -47,7 +47,6 @@
|
|||||||
#include <qtreeview.h>
|
#include <qtreeview.h>
|
||||||
#include <private/qtreewidget_p.h>
|
#include <private/qtreewidget_p.h>
|
||||||
#include <QtGui/private/qaccessible2_p.h>
|
#include <QtGui/private/qaccessible2_p.h>
|
||||||
#include <QtWidgets/private/qwidget_p.h>
|
|
||||||
|
|
||||||
#ifndef QT_NO_ACCESSIBILITY
|
#ifndef QT_NO_ACCESSIBILITY
|
||||||
|
|
||||||
@ -82,43 +81,6 @@ int QAccessibleTable::logicalIndex(const QModelIndex &index) const
|
|||||||
return (index.row() + hHeader)*(index.model()->columnCount() + vHeader) + (index.column() + vHeader);
|
return (index.row() + hHeader)*(index.model()->columnCount() + vHeader) + (index.column() + vHeader);
|
||||||
}
|
}
|
||||||
|
|
||||||
QAccessibleInterface *QAccessibleTable::childFromLogical(int logicalIndex) const
|
|
||||||
{
|
|
||||||
if (!view()->model())
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
int vHeader = verticalHeader() ? 1 : 0;
|
|
||||||
int hHeader = horizontalHeader() ? 1 : 0;
|
|
||||||
|
|
||||||
int columns = view()->model()->columnCount() + vHeader;
|
|
||||||
|
|
||||||
int row = logicalIndex / columns;
|
|
||||||
int column = logicalIndex % columns;
|
|
||||||
|
|
||||||
if (vHeader) {
|
|
||||||
if (column == 0) {
|
|
||||||
if (row == 0) {
|
|
||||||
return new QAccessibleTableCornerButton(view());
|
|
||||||
}
|
|
||||||
return new QAccessibleTableHeaderCell(view(), row-1, Qt::Vertical);
|
|
||||||
}
|
|
||||||
--column;
|
|
||||||
}
|
|
||||||
if (hHeader) {
|
|
||||||
if (row == 0) {
|
|
||||||
return new QAccessibleTableHeaderCell(view(), column, Qt::Horizontal);
|
|
||||||
}
|
|
||||||
--row;
|
|
||||||
}
|
|
||||||
|
|
||||||
QModelIndex index = view()->model()->index(row, column, view()->rootIndex());
|
|
||||||
if (!index.isValid()) {
|
|
||||||
qWarning() << "QAccessibleTable::childFromLogical: Invalid index at: " << row << column;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return new QAccessibleTableCell(view(), index, cellRole());
|
|
||||||
}
|
|
||||||
|
|
||||||
QAccessibleTable::QAccessibleTable(QWidget *w)
|
QAccessibleTable::QAccessibleTable(QWidget *w)
|
||||||
: QAccessibleObject(w)
|
: QAccessibleObject(w)
|
||||||
{
|
{
|
||||||
@ -143,6 +105,8 @@ bool QAccessibleTable::isValid() const
|
|||||||
|
|
||||||
QAccessibleTable::~QAccessibleTable()
|
QAccessibleTable::~QAccessibleTable()
|
||||||
{
|
{
|
||||||
|
Q_FOREACH (QAccessible::Id id, childToId.values())
|
||||||
|
QAccessible::deleteAccessibleInterface(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
QHeaderView *QAccessibleTable::horizontalHeader() const
|
QHeaderView *QAccessibleTable::horizontalHeader() const
|
||||||
@ -173,13 +137,6 @@ QHeaderView *QAccessibleTable::verticalHeader() const
|
|||||||
return header;
|
return header;
|
||||||
}
|
}
|
||||||
|
|
||||||
QAccessibleTableCell *QAccessibleTable::cell(const QModelIndex &index) const
|
|
||||||
{
|
|
||||||
if (index.isValid())
|
|
||||||
return new QAccessibleTableCell(view(), index, cellRole());
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
QAccessibleInterface *QAccessibleTable::cellAt(int row, int column) const
|
QAccessibleInterface *QAccessibleTable::cellAt(int row, int column) const
|
||||||
{
|
{
|
||||||
if (!view()->model())
|
if (!view()->model())
|
||||||
@ -190,7 +147,7 @@ QAccessibleInterface *QAccessibleTable::cellAt(int row, int column) const
|
|||||||
qWarning() << "QAccessibleTable::cellAt: invalid index: " << index << " for " << view();
|
qWarning() << "QAccessibleTable::cellAt: invalid index: " << index << " for " << view();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return cell(index);
|
return child(logicalIndex(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
QAccessibleInterface *QAccessibleTable::caption() const
|
QAccessibleInterface *QAccessibleTable::caption() const
|
||||||
@ -252,9 +209,8 @@ QList<QAccessibleInterface *> QAccessibleTable::selectedCells() const
|
|||||||
QList<QAccessibleInterface*> cells;
|
QList<QAccessibleInterface*> cells;
|
||||||
if (!view()->selectionModel())
|
if (!view()->selectionModel())
|
||||||
return cells;
|
return cells;
|
||||||
Q_FOREACH (const QModelIndex &index, view()->selectionModel()->selectedIndexes()) {
|
Q_FOREACH (const QModelIndex &index, view()->selectionModel()->selectedIndexes())
|
||||||
cells.append(cell(index));
|
cells.append(child(logicalIndex(index)));
|
||||||
}
|
|
||||||
return cells;
|
return cells;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -447,7 +403,7 @@ QAccessibleInterface *QAccessibleTable::childAt(int x, int y) const
|
|||||||
|
|
||||||
QModelIndex index = view()->indexAt(indexPosition);
|
QModelIndex index = view()->indexAt(indexPosition);
|
||||||
if (index.isValid()) {
|
if (index.isValid()) {
|
||||||
return childFromLogical(logicalIndex(index));
|
return child(logicalIndex(index));
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -465,7 +421,7 @@ int QAccessibleTable::indexOfChild(const QAccessibleInterface *iface) const
|
|||||||
{
|
{
|
||||||
if (!view()->model())
|
if (!view()->model())
|
||||||
return -1;
|
return -1;
|
||||||
QSharedPointer<QAccessibleInterface> parent(iface->parent());
|
QAccessibleInterface *parent = iface->parent();
|
||||||
if (parent->object() != view())
|
if (parent->object() != view())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -478,7 +434,7 @@ int QAccessibleTable::indexOfChild(const QAccessibleInterface *iface) const
|
|||||||
return cell->index + (verticalHeader() ? 1 : 0);
|
return cell->index + (verticalHeader() ? 1 : 0);
|
||||||
} else if (iface->role() == QAccessible::RowHeader){
|
} else if (iface->role() == QAccessible::RowHeader){
|
||||||
const QAccessibleTableHeaderCell* cell = static_cast<const QAccessibleTableHeaderCell*>(iface);
|
const QAccessibleTableHeaderCell* cell = static_cast<const QAccessibleTableHeaderCell*>(iface);
|
||||||
return (cell->index + 1) * (view()->model()->rowCount() + 1);
|
return (cell->index + 1) * (view()->model()->columnCount() + 1);
|
||||||
} else if (iface->role() == QAccessible::Pane) {
|
} else if (iface->role() == QAccessible::Pane) {
|
||||||
return 0; // corner button
|
return 0; // corner button
|
||||||
} else {
|
} else {
|
||||||
@ -515,9 +471,55 @@ QAccessibleInterface *QAccessibleTable::parent() const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QAccessibleInterface *QAccessibleTable::child(int index) const
|
QAccessibleInterface *QAccessibleTable::child(int logicalIndex) const
|
||||||
{
|
{
|
||||||
return childFromLogical(index);
|
if (!view()->model())
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (childToId.contains(logicalIndex)) {
|
||||||
|
QAccessible::Id id = childToId.value(logicalIndex);
|
||||||
|
return QAccessible::accessibleInterface(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
int vHeader = verticalHeader() ? 1 : 0;
|
||||||
|
int hHeader = horizontalHeader() ? 1 : 0;
|
||||||
|
|
||||||
|
int columns = view()->model()->columnCount() + vHeader;
|
||||||
|
|
||||||
|
int row = logicalIndex / columns;
|
||||||
|
int column = logicalIndex % columns;
|
||||||
|
|
||||||
|
QAccessibleInterface *iface = 0;
|
||||||
|
|
||||||
|
if (vHeader) {
|
||||||
|
if (column == 0) {
|
||||||
|
if (hHeader && row == 0) {
|
||||||
|
iface = new QAccessibleTableCornerButton(view());
|
||||||
|
} else {
|
||||||
|
iface = new QAccessibleTableHeaderCell(view(), row - hHeader, Qt::Vertical);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
--column;
|
||||||
|
}
|
||||||
|
if (!iface && hHeader) {
|
||||||
|
if (row == 0) {
|
||||||
|
iface = new QAccessibleTableHeaderCell(view(), column, Qt::Horizontal);
|
||||||
|
}
|
||||||
|
--row;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!iface) {
|
||||||
|
QModelIndex index = view()->model()->index(row, column, view()->rootIndex());
|
||||||
|
if (!index.isValid()) {
|
||||||
|
qWarning() << "QAccessibleTable::child: Invalid index at: " << row << column;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
iface = new QAccessibleTableCell(view(), index, cellRole());
|
||||||
|
}
|
||||||
|
|
||||||
|
QAccessible::registerAccessibleInterface(iface);
|
||||||
|
childToId.insert(logicalIndex, QAccessible::uniqueId(iface));
|
||||||
|
return iface;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *QAccessibleTable::interface_cast(QAccessible::InterfaceType t)
|
void *QAccessibleTable::interface_cast(QAccessible::InterfaceType t)
|
||||||
@ -527,6 +529,140 @@ void *QAccessibleTable::interface_cast(QAccessible::InterfaceType t)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QAccessibleTable::modelChange(QAccessibleTableModelChangeEvent *event)
|
||||||
|
{
|
||||||
|
// if there is no cache yet, we don't update anything
|
||||||
|
if (childToId.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch (event->modelChangeType()) {
|
||||||
|
case QAccessibleTableModelChangeEvent::ModelReset:
|
||||||
|
Q_FOREACH (QAccessible::Id id, childToId.values())
|
||||||
|
QAccessible::deleteAccessibleInterface(id);
|
||||||
|
childToId.clear();
|
||||||
|
break;
|
||||||
|
|
||||||
|
// rows are inserted: move every row after that
|
||||||
|
case QAccessibleTableModelChangeEvent::RowsInserted:
|
||||||
|
case QAccessibleTableModelChangeEvent::ColumnsInserted: {
|
||||||
|
int newRows = event->lastRow() - event->firstRow() + 1;
|
||||||
|
int newColumns = event->lastColumn() - event->firstColumn() + 1;
|
||||||
|
|
||||||
|
ChildCache newCache;
|
||||||
|
ChildCache::ConstIterator iter = childToId.constBegin();
|
||||||
|
|
||||||
|
while (iter != childToId.constEnd()) {
|
||||||
|
QAccessible::Id id = iter.value();
|
||||||
|
QAccessibleInterface *iface = QAccessible::accessibleInterface(id);
|
||||||
|
Q_ASSERT(iface);
|
||||||
|
if (iface->role() == QAccessible::Cell || iface->role() == QAccessible::ListItem) {
|
||||||
|
Q_ASSERT(iface->tableCellInterface());
|
||||||
|
QAccessibleTableCell *cell = static_cast<QAccessibleTableCell*>(iface->tableCellInterface());
|
||||||
|
if (event->modelChangeType() == QAccessibleTableModelChangeEvent::RowsInserted
|
||||||
|
&& cell->m_index.row() >= event->firstRow()) {
|
||||||
|
int newRow = cell->m_index.row() + newRows;
|
||||||
|
cell->m_index = cell->m_index.sibling(newRow, cell->m_index.column());
|
||||||
|
} else if (event->modelChangeType() == QAccessibleTableModelChangeEvent::ColumnsInserted
|
||||||
|
&& cell->m_index.column() >= event->firstColumn()) {
|
||||||
|
int newColumn = cell->m_index.column() + newColumns;
|
||||||
|
cell->m_index = cell->m_index.sibling(cell->m_index.row(), newColumn);
|
||||||
|
}
|
||||||
|
} else if (event->modelChangeType() == QAccessibleTableModelChangeEvent::RowsInserted
|
||||||
|
&& iface->role() == QAccessible::RowHeader) {
|
||||||
|
QAccessibleTableHeaderCell *cell = static_cast<QAccessibleTableHeaderCell*>(iface);
|
||||||
|
if (cell->index >= event->firstRow()) {
|
||||||
|
cell->index += newRows;
|
||||||
|
}
|
||||||
|
} else if (event->modelChangeType() == QAccessibleTableModelChangeEvent::ColumnsInserted
|
||||||
|
&& iface->role() == QAccessible::ColumnHeader) {
|
||||||
|
QAccessibleTableHeaderCell *cell = static_cast<QAccessibleTableHeaderCell*>(iface);
|
||||||
|
if (cell->index >= event->firstColumn()) {
|
||||||
|
cell->index += newColumns;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (indexOfChild(iface) >= 0) {
|
||||||
|
newCache.insert(indexOfChild(iface), id);
|
||||||
|
} else {
|
||||||
|
// ### This should really not happen,
|
||||||
|
// but it might if the view has a root index set.
|
||||||
|
// This needs to be fixed.
|
||||||
|
QAccessible::deleteAccessibleInterface(id);
|
||||||
|
}
|
||||||
|
++iter;
|
||||||
|
}
|
||||||
|
childToId = newCache;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case QAccessibleTableModelChangeEvent::ColumnsRemoved:
|
||||||
|
case QAccessibleTableModelChangeEvent::RowsRemoved: {
|
||||||
|
int deletedColumns = event->lastColumn() - event->firstColumn() + 1;
|
||||||
|
int deletedRows = event->lastRow() - event->firstRow() + 1;
|
||||||
|
ChildCache newCache;
|
||||||
|
ChildCache::ConstIterator iter = childToId.constBegin();
|
||||||
|
while (iter != childToId.constEnd()) {
|
||||||
|
QAccessible::Id id = iter.value();
|
||||||
|
QAccessibleInterface *iface = QAccessible::accessibleInterface(id);
|
||||||
|
Q_ASSERT(iface);
|
||||||
|
if (iface->role() == QAccessible::Cell || iface->role() == QAccessible::ListItem) {
|
||||||
|
Q_ASSERT(iface->tableCellInterface());
|
||||||
|
QAccessibleTableCell *cell = static_cast<QAccessibleTableCell*>(iface->tableCellInterface());
|
||||||
|
if (event->modelChangeType() == QAccessibleTableModelChangeEvent::RowsRemoved) {
|
||||||
|
if (cell->m_index.row() < event->firstRow()) {
|
||||||
|
newCache.insert(indexOfChild(cell), id);
|
||||||
|
} else if (cell->m_index.row() > event->lastRow()) {
|
||||||
|
int newRow = cell->m_index.row() - deletedRows;
|
||||||
|
cell->m_index = cell->m_index.sibling(newRow, cell->m_index.column());
|
||||||
|
newCache.insert(indexOfChild(cell), id);
|
||||||
|
} else {
|
||||||
|
QAccessible::deleteAccessibleInterface(id);
|
||||||
|
}
|
||||||
|
} else if (event->modelChangeType() == QAccessibleTableModelChangeEvent::ColumnsRemoved) {
|
||||||
|
if (cell->m_index.column() < event->firstColumn()) {
|
||||||
|
newCache.insert(indexOfChild(cell), id);
|
||||||
|
} else if (cell->m_index.column() > event->lastColumn()) {
|
||||||
|
int newColumn = cell->m_index.column() - deletedColumns;
|
||||||
|
cell->m_index = cell->m_index.sibling(cell->m_index.row(), newColumn);
|
||||||
|
newCache.insert(indexOfChild(cell), id);
|
||||||
|
} else {
|
||||||
|
QAccessible::deleteAccessibleInterface(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (event->modelChangeType() == QAccessibleTableModelChangeEvent::RowsRemoved
|
||||||
|
&& iface->role() == QAccessible::RowHeader) {
|
||||||
|
QAccessibleTableHeaderCell *cell = static_cast<QAccessibleTableHeaderCell*>(iface);
|
||||||
|
if (cell->index < event->firstRow()) {
|
||||||
|
newCache.insert(indexOfChild(cell), id);
|
||||||
|
} else if (cell->index > event->lastRow()) {
|
||||||
|
cell->index -= deletedRows;
|
||||||
|
newCache.insert(indexOfChild(cell), id);
|
||||||
|
} else {
|
||||||
|
QAccessible::deleteAccessibleInterface(id);
|
||||||
|
}
|
||||||
|
} else if (event->modelChangeType() == QAccessibleTableModelChangeEvent::ColumnsRemoved
|
||||||
|
&& iface->role() == QAccessible::ColumnHeader) {
|
||||||
|
QAccessibleTableHeaderCell *cell = static_cast<QAccessibleTableHeaderCell*>(iface);
|
||||||
|
if (cell->index < event->firstColumn()) {
|
||||||
|
newCache.insert(indexOfChild(cell), id);
|
||||||
|
} else if (cell->index > event->lastColumn()) {
|
||||||
|
cell->index -= deletedColumns;
|
||||||
|
newCache.insert(indexOfChild(cell), id);
|
||||||
|
} else {
|
||||||
|
QAccessible::deleteAccessibleInterface(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
++iter;
|
||||||
|
}
|
||||||
|
childToId = newCache;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case QAccessibleTableModelChangeEvent::DataChanged:
|
||||||
|
// nothing to do in this case
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TREE VIEW
|
// TREE VIEW
|
||||||
|
|
||||||
QModelIndex QAccessibleTree::indexFromLogical(int row, int column) const
|
QModelIndex QAccessibleTree::indexFromLogical(int row, int column) const
|
||||||
@ -578,27 +714,33 @@ int QAccessibleTree::childCount() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QAccessibleInterface *QAccessibleTree::child(int index) const
|
QAccessibleInterface *QAccessibleTree::child(int logicalIndex) const
|
||||||
{
|
{
|
||||||
if (index < 0 || !view()->model() || !view()->model()->columnCount())
|
if (logicalIndex < 0 || !view()->model() || !view()->model()->columnCount())
|
||||||
return 0;
|
return 0;
|
||||||
int hHeader = horizontalHeader() ? 1 : 0;
|
|
||||||
|
|
||||||
if (hHeader) {
|
QAccessibleInterface *iface = 0;
|
||||||
|
int index = logicalIndex;
|
||||||
|
|
||||||
|
if (horizontalHeader()) {
|
||||||
if (index < view()->model()->columnCount()) {
|
if (index < view()->model()->columnCount()) {
|
||||||
return new QAccessibleTableHeaderCell(view(), index, Qt::Horizontal);
|
iface = new QAccessibleTableHeaderCell(view(), index, Qt::Horizontal);
|
||||||
} else {
|
} else {
|
||||||
index -= view()->model()->columnCount();
|
index -= view()->model()->columnCount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int row = index / view()->model()->columnCount();
|
if (!iface) {
|
||||||
int column = index % view()->model()->columnCount();
|
int row = index / view()->model()->columnCount();
|
||||||
QModelIndex modelIndex = indexFromLogical(row, column);
|
int column = index % view()->model()->columnCount();
|
||||||
if (modelIndex.isValid()) {
|
QModelIndex modelIndex = indexFromLogical(row, column);
|
||||||
return cell(modelIndex);
|
if (!modelIndex.isValid())
|
||||||
|
return 0;
|
||||||
|
iface = new QAccessibleTableCell(view(), modelIndex, cellRole());
|
||||||
}
|
}
|
||||||
return 0;
|
QAccessible::registerAccessibleInterface(iface);
|
||||||
|
// ### FIXME: get interfaces from the cache instead of re-creating them
|
||||||
|
return iface;
|
||||||
}
|
}
|
||||||
|
|
||||||
int QAccessibleTree::rowCount() const
|
int QAccessibleTree::rowCount() const
|
||||||
@ -612,7 +754,7 @@ int QAccessibleTree::indexOfChild(const QAccessibleInterface *iface) const
|
|||||||
{
|
{
|
||||||
if (!view()->model())
|
if (!view()->model())
|
||||||
return -1;
|
return -1;
|
||||||
QSharedPointer<QAccessibleInterface> parent(iface->parent());
|
QAccessibleInterface *parent = iface->parent();
|
||||||
if (parent->object() != view())
|
if (parent->object() != view())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -624,12 +766,10 @@ int QAccessibleTree::indexOfChild(const QAccessibleInterface *iface) const
|
|||||||
int column = cell->m_index.column();
|
int column = cell->m_index.column();
|
||||||
|
|
||||||
int index = row * view()->model()->columnCount() + column;
|
int index = row * view()->model()->columnCount() + column;
|
||||||
//qDebug() << "QAccessibleTree::indexOfChild r " << row << " c " << column << "index " << index;
|
|
||||||
Q_ASSERT(index >= treeView->model()->columnCount());
|
Q_ASSERT(index >= treeView->model()->columnCount());
|
||||||
return index;
|
return index;
|
||||||
} else if (iface->role() == QAccessible::ColumnHeader){
|
} else if (iface->role() == QAccessible::ColumnHeader){
|
||||||
const QAccessibleTableHeaderCell* cell = static_cast<const QAccessibleTableHeaderCell*>(iface);
|
const QAccessibleTableHeaderCell* cell = static_cast<const QAccessibleTableHeaderCell*>(iface);
|
||||||
//qDebug() << "QAccessibleTree::indexOfChild header " << cell->index;
|
|
||||||
return cell->index;
|
return cell->index;
|
||||||
} else {
|
} else {
|
||||||
qWarning() << "WARNING QAccessibleTable::indexOfChild invalid child"
|
qWarning() << "WARNING QAccessibleTable::indexOfChild invalid child"
|
||||||
@ -646,7 +786,11 @@ QAccessibleInterface *QAccessibleTree::cellAt(int row, int column) const
|
|||||||
qWarning() << "Requested invalid tree cell: " << row << column;
|
qWarning() << "Requested invalid tree cell: " << row << column;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return new QAccessibleTableCell(view(), index, cellRole());
|
const QTreeView *treeView = qobject_cast<const QTreeView*>(view());
|
||||||
|
Q_ASSERT(treeView);
|
||||||
|
int logicalIndex = treeView->d_func()->accessibleTable2Index(index);
|
||||||
|
|
||||||
|
return child(logicalIndex); // FIXME ### new QAccessibleTableCell(view(), index, cellRole());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QAccessibleTree::rowDescription(int) const
|
QString QAccessibleTree::rowDescription(int) const
|
||||||
@ -717,6 +861,7 @@ QList<QAccessibleInterface*> QAccessibleTableCell::rowHeaderCells() const
|
|||||||
{
|
{
|
||||||
QList<QAccessibleInterface*> headerCell;
|
QList<QAccessibleInterface*> headerCell;
|
||||||
if (verticalHeader()) {
|
if (verticalHeader()) {
|
||||||
|
// FIXME
|
||||||
headerCell.append(new QAccessibleTableHeaderCell(view, m_index.row(), Qt::Vertical));
|
headerCell.append(new QAccessibleTableHeaderCell(view, m_index.row(), Qt::Vertical));
|
||||||
}
|
}
|
||||||
return headerCell;
|
return headerCell;
|
||||||
@ -726,6 +871,7 @@ QList<QAccessibleInterface*> QAccessibleTableCell::columnHeaderCells() const
|
|||||||
{
|
{
|
||||||
QList<QAccessibleInterface*> headerCell;
|
QList<QAccessibleInterface*> headerCell;
|
||||||
if (horizontalHeader()) {
|
if (horizontalHeader()) {
|
||||||
|
// FIXME
|
||||||
headerCell.append(new QAccessibleTableHeaderCell(view, m_index.column(), Qt::Horizontal));
|
headerCell.append(new QAccessibleTableHeaderCell(view, m_index.column(), Qt::Horizontal));
|
||||||
}
|
}
|
||||||
return headerCell;
|
return headerCell;
|
||||||
@ -808,18 +954,18 @@ void QAccessibleTableCell::selectCell()
|
|||||||
QAbstractItemView::SelectionMode selectionMode = view->selectionMode();
|
QAbstractItemView::SelectionMode selectionMode = view->selectionMode();
|
||||||
if (!m_index.isValid() || (selectionMode == QAbstractItemView::NoSelection))
|
if (!m_index.isValid() || (selectionMode == QAbstractItemView::NoSelection))
|
||||||
return;
|
return;
|
||||||
|
Q_ASSERT(table());
|
||||||
QSharedPointer<QAccessibleTableInterface> cellTable(table()->tableInterface());
|
QAccessibleTableInterface *cellTable = table()->tableInterface();
|
||||||
|
|
||||||
switch (view->selectionBehavior()) {
|
switch (view->selectionBehavior()) {
|
||||||
case QAbstractItemView::SelectItems:
|
case QAbstractItemView::SelectItems:
|
||||||
break;
|
break;
|
||||||
case QAbstractItemView::SelectColumns:
|
case QAbstractItemView::SelectColumns:
|
||||||
if (cellTable.data())
|
if (cellTable)
|
||||||
cellTable->selectColumn(m_index.column());
|
cellTable->selectColumn(m_index.column());
|
||||||
return;
|
return;
|
||||||
case QAbstractItemView::SelectRows:
|
case QAbstractItemView::SelectRows:
|
||||||
if (cellTable.data())
|
if (cellTable)
|
||||||
cellTable->selectRow(m_index.row());
|
cellTable->selectRow(m_index.row());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -838,17 +984,17 @@ void QAccessibleTableCell::unselectCell()
|
|||||||
if (!m_index.isValid() || (selectionMode & QAbstractItemView::NoSelection))
|
if (!m_index.isValid() || (selectionMode & QAbstractItemView::NoSelection))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QSharedPointer<QAccessibleTableInterface> cellTable(table()->tableInterface());
|
QAccessibleTableInterface *cellTable = table()->tableInterface();
|
||||||
|
|
||||||
switch (view->selectionBehavior()) {
|
switch (view->selectionBehavior()) {
|
||||||
case QAbstractItemView::SelectItems:
|
case QAbstractItemView::SelectItems:
|
||||||
break;
|
break;
|
||||||
case QAbstractItemView::SelectColumns:
|
case QAbstractItemView::SelectColumns:
|
||||||
if (cellTable.data())
|
if (cellTable)
|
||||||
cellTable->unselectColumn(m_index.column());
|
cellTable->unselectColumn(m_index.column());
|
||||||
return;
|
return;
|
||||||
case QAbstractItemView::SelectRows:
|
case QAbstractItemView::SelectRows:
|
||||||
if (cellTable.data())
|
if (cellTable)
|
||||||
cellTable->unselectRow(m_index.row());
|
cellTable->unselectRow(m_index.row());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -962,10 +1108,7 @@ bool QAccessibleTableCell::isValid() const
|
|||||||
|
|
||||||
QAccessibleInterface *QAccessibleTableCell::parent() const
|
QAccessibleInterface *QAccessibleTableCell::parent() const
|
||||||
{
|
{
|
||||||
if (m_role == QAccessible::TreeItem)
|
return QAccessible::queryAccessibleInterface(view);
|
||||||
return new QAccessibleTree(view);
|
|
||||||
|
|
||||||
return new QAccessibleTable(view);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QAccessibleInterface *QAccessibleTableCell::child(int) const
|
QAccessibleInterface *QAccessibleTableCell::child(int) const
|
||||||
@ -1051,11 +1194,7 @@ bool QAccessibleTableHeaderCell::isValid() const
|
|||||||
|
|
||||||
QAccessibleInterface *QAccessibleTableHeaderCell::parent() const
|
QAccessibleInterface *QAccessibleTableHeaderCell::parent() const
|
||||||
{
|
{
|
||||||
#ifndef QT_NO_TREEVIEW
|
return QAccessible::queryAccessibleInterface(view);
|
||||||
if (qobject_cast<const QTreeView*>(view))
|
|
||||||
return new QAccessibleTree(view);
|
|
||||||
#endif
|
|
||||||
return new QAccessibleTable(view);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QAccessibleInterface *QAccessibleTableHeaderCell::child(int) const
|
QAccessibleInterface *QAccessibleTableHeaderCell::child(int) const
|
||||||
|
@ -65,8 +65,6 @@ public:
|
|||||||
explicit QAccessibleTable(QWidget *w);
|
explicit QAccessibleTable(QWidget *w);
|
||||||
bool isValid() const;
|
bool isValid() const;
|
||||||
|
|
||||||
virtual ~QAccessibleTable();
|
|
||||||
|
|
||||||
QAccessible::Role role() const;
|
QAccessible::Role role() const;
|
||||||
QAccessible::State state() const;
|
QAccessible::State state() const;
|
||||||
QString text(QAccessible::Text t) const;
|
QString text(QAccessible::Text t) const;
|
||||||
@ -106,9 +104,9 @@ public:
|
|||||||
|
|
||||||
QAbstractItemView *view() const;
|
QAbstractItemView *view() const;
|
||||||
|
|
||||||
protected:
|
void modelChange(QAccessibleTableModelChangeEvent *event);
|
||||||
inline QAccessibleTableCell *cell(const QModelIndex &index) const;
|
|
||||||
|
|
||||||
|
protected:
|
||||||
inline QAccessible::Role cellRole() const {
|
inline QAccessible::Role cellRole() const {
|
||||||
switch (m_role) {
|
switch (m_role) {
|
||||||
case QAccessible::List:
|
case QAccessible::List:
|
||||||
@ -125,11 +123,16 @@ protected:
|
|||||||
|
|
||||||
QHeaderView *horizontalHeader() const;
|
QHeaderView *horizontalHeader() const;
|
||||||
QHeaderView *verticalHeader() const;
|
QHeaderView *verticalHeader() const;
|
||||||
|
|
||||||
|
// maybe vector
|
||||||
|
typedef QHash<int, QAccessible::Id> ChildCache;
|
||||||
|
mutable ChildCache childToId;
|
||||||
|
|
||||||
|
virtual ~QAccessibleTable();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// the child index for a model index
|
// the child index for a model index
|
||||||
inline int logicalIndex(const QModelIndex &index) const;
|
inline int logicalIndex(const QModelIndex &index) const;
|
||||||
// the model index from the child index
|
|
||||||
QAccessibleInterface *childFromLogical(int logicalIndex) const;
|
|
||||||
QAccessible::Role m_role;
|
QAccessible::Role m_role;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -140,7 +143,6 @@ public:
|
|||||||
: QAccessibleTable(w)
|
: QAccessibleTable(w)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual ~QAccessibleTree() {}
|
|
||||||
|
|
||||||
QAccessibleInterface *childAt(int x, int y) const;
|
QAccessibleInterface *childAt(int x, int y) const;
|
||||||
int childCount() const;
|
int childCount() const;
|
||||||
@ -158,6 +160,8 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QModelIndex indexFromLogical(int row, int column = 0) const;
|
QModelIndex indexFromLogical(int row, int column = 0) const;
|
||||||
|
|
||||||
|
inline int logicalIndex(const QModelIndex &index) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class QAccessibleTableCell: public QAccessibleInterface, public QAccessibleTableCellInterface, public QAccessibleActionInterface
|
class QAccessibleTableCell: public QAccessibleInterface, public QAccessibleTableCellInterface, public QAccessibleActionInterface
|
||||||
@ -236,7 +240,7 @@ public:
|
|||||||
QAccessibleInterface *child(int index) const;
|
QAccessibleInterface *child(int index) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QAbstractItemView *view;
|
QPointer<QAbstractItemView> view;
|
||||||
int index;
|
int index;
|
||||||
Qt::Orientation orientation;
|
Qt::Orientation orientation;
|
||||||
|
|
||||||
@ -273,8 +277,9 @@ public:
|
|||||||
QAccessibleInterface *child(int) const {
|
QAccessibleInterface *child(int) const {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QAbstractItemView *view;
|
QPointer<QAbstractItemView> view;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -177,14 +177,6 @@ QAccessibleInterface *AccessibleFactory::create(const QString &classname, QObjec
|
|||||||
} else if (classname == QLatin1String("QTableView") || classname == QLatin1String("QListView")) {
|
} else if (classname == QLatin1String("QTableView") || classname == QLatin1String("QListView")) {
|
||||||
iface = new QAccessibleTable(widget);
|
iface = new QAccessibleTable(widget);
|
||||||
// ### This should be cleaned up. We return the parent for the scrollarea to hide it.
|
// ### This should be cleaned up. We return the parent for the scrollarea to hide it.
|
||||||
} else if (classname == QLatin1String("QWidget")
|
|
||||||
&& widget->objectName() == QLatin1String("qt_scrollarea_viewport")
|
|
||||||
&& qobject_cast<QAbstractItemView*>(widget->parentWidget())) {
|
|
||||||
if (qobject_cast<const QTreeView*>(widget->parentWidget())) {
|
|
||||||
iface = new QAccessibleTree(widget->parentWidget());
|
|
||||||
} else {
|
|
||||||
iface = new QAccessibleTable(widget->parentWidget());
|
|
||||||
}
|
|
||||||
#endif // QT_NO_ITEMVIEWS
|
#endif // QT_NO_ITEMVIEWS
|
||||||
#ifndef QT_NO_TABBAR
|
#ifndef QT_NO_TABBAR
|
||||||
} else if (classname == QLatin1String("QTabBar")) {
|
} else if (classname == QLatin1String("QTabBar")) {
|
||||||
|
@ -55,6 +55,16 @@ QT_BEGIN_NAMESPACE
|
|||||||
QString Q_GUI_EXPORT qt_accStripAmp(const QString &text);
|
QString Q_GUI_EXPORT qt_accStripAmp(const QString &text);
|
||||||
QString Q_GUI_EXPORT qt_accHotKey(const QString &text);
|
QString Q_GUI_EXPORT qt_accHotKey(const QString &text);
|
||||||
|
|
||||||
|
QAccessibleInterface *getOrCreateMenu(QWidget *menu, QAction *action)
|
||||||
|
{
|
||||||
|
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(action);
|
||||||
|
if (!iface) {
|
||||||
|
iface = new QAccessibleMenuItem(menu, action);
|
||||||
|
QAccessible::registerAccessibleInterface(iface);
|
||||||
|
}
|
||||||
|
return iface;
|
||||||
|
}
|
||||||
|
|
||||||
QAccessibleMenu::QAccessibleMenu(QWidget *w)
|
QAccessibleMenu::QAccessibleMenu(QWidget *w)
|
||||||
: QAccessibleWidget(w)
|
: QAccessibleWidget(w)
|
||||||
{
|
{
|
||||||
@ -76,7 +86,7 @@ QAccessibleInterface *QAccessibleMenu::childAt(int x, int y) const
|
|||||||
QAction *act = menu()->actionAt(menu()->mapFromGlobal(QPoint(x,y)));
|
QAction *act = menu()->actionAt(menu()->mapFromGlobal(QPoint(x,y)));
|
||||||
if(act && act->isSeparator())
|
if(act && act->isSeparator())
|
||||||
act = 0;
|
act = 0;
|
||||||
return act ? new QAccessibleMenuItem(menu(), act) : 0;
|
return act ? getOrCreateMenu(menu(), act) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QAccessibleMenu::text(QAccessible::Text t) const
|
QString QAccessibleMenu::text(QAccessible::Text t) const
|
||||||
@ -98,7 +108,7 @@ QAccessible::Role QAccessibleMenu::role() const
|
|||||||
QAccessibleInterface *QAccessibleMenu::child(int index) const
|
QAccessibleInterface *QAccessibleMenu::child(int index) const
|
||||||
{
|
{
|
||||||
if (index < childCount())
|
if (index < childCount())
|
||||||
return new QAccessibleMenuItem(menu(), menu()->actions().at(index));
|
return getOrCreateMenu(menu(), menu()->actions().at(index));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +121,7 @@ QAccessibleInterface *QAccessibleMenu::parent() const
|
|||||||
foreach (QWidget *w, parentCandidates) {
|
foreach (QWidget *w, parentCandidates) {
|
||||||
if (qobject_cast<QMenu*>(w) || qobject_cast<QMenuBar*>(w)) {
|
if (qobject_cast<QMenu*>(w) || qobject_cast<QMenuBar*>(w)) {
|
||||||
if (w->actions().indexOf(menuAction) != -1)
|
if (w->actions().indexOf(menuAction) != -1)
|
||||||
return new QAccessibleMenuItem(w, menuAction);
|
return getOrCreateMenu(w, menuAction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -146,8 +156,9 @@ int QAccessibleMenuBar::childCount() const
|
|||||||
|
|
||||||
QAccessibleInterface *QAccessibleMenuBar::child(int index) const
|
QAccessibleInterface *QAccessibleMenuBar::child(int index) const
|
||||||
{
|
{
|
||||||
if (index < childCount())
|
if (index < childCount()) {
|
||||||
return new QAccessibleMenuItem(menuBar(), menuBar()->actions().at(index));
|
return getOrCreateMenu(menuBar(), menuBar()->actions().at(index));
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,7 +188,6 @@ QAccessibleInterface *QAccessibleMenuItem::childAt(int x, int y ) const
|
|||||||
if (childInterface->rect().contains(x,y)) {
|
if (childInterface->rect().contains(x,y)) {
|
||||||
return childInterface;
|
return childInterface;
|
||||||
}
|
}
|
||||||
delete childInterface;
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -207,7 +217,7 @@ QAccessibleInterface *QAccessibleMenuItem::parent() const
|
|||||||
QAccessibleInterface *QAccessibleMenuItem::child(int index) const
|
QAccessibleInterface *QAccessibleMenuItem::child(int index) const
|
||||||
{
|
{
|
||||||
if (index == 0 && action()->menu())
|
if (index == 0 && action()->menu())
|
||||||
return new QAccessibleMenu(action()->menu());
|
return QAccessible::queryAccessibleInterface(action()->menu());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -718,7 +718,6 @@ QAccessibleInterface *QAccessibleTitleBar::childAt(int x, int y) const
|
|||||||
if (childIface->rect().contains(x,y)) {
|
if (childIface->rect().contains(x,y)) {
|
||||||
return childIface;
|
return childIface;
|
||||||
}
|
}
|
||||||
delete childIface;
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -102,8 +102,5 @@ OTHER_FILES += cocoa.json
|
|||||||
# DEFINES += QT_COCOA_ENABLE_ACCESSIBILITY_INSPECTOR
|
# DEFINES += QT_COCOA_ENABLE_ACCESSIBILITY_INSPECTOR
|
||||||
# include ($$PWD/../../../../util/accessibilityinspector/accessibilityinspector.pri)
|
# include ($$PWD/../../../../util/accessibilityinspector/accessibilityinspector.pri)
|
||||||
|
|
||||||
# Accessibility is currently unstable and disabled.
|
|
||||||
DEFINES += QT_NO_COCOA_ACCESSIBILITY
|
|
||||||
|
|
||||||
# Window debug support
|
# Window debug support
|
||||||
#DEFINES += QT_COCOA_ENABLE_WINDOW_DEBUG
|
#DEFINES += QT_COCOA_ENABLE_WINDOW_DEBUG
|
||||||
|
@ -44,9 +44,6 @@
|
|||||||
#include <Cocoa/Cocoa.h>
|
#include <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
|
|
||||||
#ifndef QT_NO_COCOA_ACCESSIBILITY
|
|
||||||
|
|
||||||
#include <qpa/qplatformaccessibility.h>
|
#include <qpa/qplatformaccessibility.h>
|
||||||
|
|
||||||
class QCococaAccessibility : public QPlatformAccessibility
|
class QCococaAccessibility : public QPlatformAccessibility
|
||||||
@ -81,7 +78,7 @@ namespace QCocoaAccessible {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
NSString *macRole(QAccessibleInterface *interface);
|
NSString *macRole(QAccessibleInterface *interface);
|
||||||
bool shouldBeIgnrored(QAccessibleInterface *interface);
|
bool shouldBeIgnored(QAccessibleInterface *interface);
|
||||||
NSString *getTranslatedAction(const QString &qtAction);
|
NSString *getTranslatedAction(const QString &qtAction);
|
||||||
NSMutableArray *createTranslatedActionsList(const QStringList &qtActions);
|
NSMutableArray *createTranslatedActionsList(const QStringList &qtActions);
|
||||||
QString translateAction(NSString *nsAction);
|
QString translateAction(NSString *nsAction);
|
||||||
@ -90,6 +87,4 @@ id getValueAttribute(QAccessibleInterface *interface);
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // QT_NO_COCOA_ACCESSIBILITY
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -44,8 +44,6 @@
|
|||||||
#include <QtGui/private/qaccessible2_p.h>
|
#include <QtGui/private/qaccessible2_p.h>
|
||||||
#include <private/qcore_mac_p.h>
|
#include <private/qcore_mac_p.h>
|
||||||
|
|
||||||
#ifndef QT_NO_COCOA_ACCESSIBILITY
|
|
||||||
|
|
||||||
QCococaAccessibility::QCococaAccessibility()
|
QCococaAccessibility::QCococaAccessibility()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -62,7 +60,7 @@ void QCococaAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event)
|
|||||||
if (!object)
|
if (!object)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(object);
|
QAccessibleInterface *interface = event->accessibleInterface();
|
||||||
if (!interface)
|
if (!interface)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -71,13 +69,11 @@ void QCococaAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event)
|
|||||||
case QAccessible::TextInserted :
|
case QAccessible::TextInserted :
|
||||||
case QAccessible::TextRemoved :
|
case QAccessible::TextRemoved :
|
||||||
case QAccessible::TextUpdated : {
|
case QAccessible::TextUpdated : {
|
||||||
QCocoaAccessibleElement *element = [QCocoaAccessibleElement createElementWithInterface : interface parent : nil];
|
QCocoaAccessibleElement *element = [QCocoaAccessibleElement createElementWithId : QAccessible::uniqueId(interface) parent : nil];
|
||||||
[element autorelease];
|
[element autorelease];
|
||||||
NSAccessibilityPostNotification(element, NSAccessibilityValueChangedNotification);
|
NSAccessibilityPostNotification(element, NSAccessibilityValueChangedNotification);
|
||||||
break; }
|
break; }
|
||||||
|
default:
|
||||||
default:
|
|
||||||
delete interface;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -178,7 +174,7 @@ NSString *macRole(QAccessibleInterface *interface)
|
|||||||
the elements are still present in the accessibility tree but is
|
the elements are still present in the accessibility tree but is
|
||||||
not used by the screen reader.
|
not used by the screen reader.
|
||||||
*/
|
*/
|
||||||
bool shouldBeIgnrored(QAccessibleInterface *interface)
|
bool shouldBeIgnored(QAccessibleInterface *interface)
|
||||||
{
|
{
|
||||||
// Mac accessibility does not have an attribute that corresponds to the Invisible/Offscreen
|
// Mac accessibility does not have an attribute that corresponds to the Invisible/Offscreen
|
||||||
// state. Ignore interfaces with those flags set.
|
// state. Ignore interfaces with those flags set.
|
||||||
@ -280,6 +276,7 @@ QString translateAction(NSString *nsAction)
|
|||||||
|
|
||||||
bool hasValueAttribute(QAccessibleInterface *interface)
|
bool hasValueAttribute(QAccessibleInterface *interface)
|
||||||
{
|
{
|
||||||
|
Q_ASSERT(interface);
|
||||||
const QAccessible::Role qtrole = interface->role();
|
const QAccessible::Role qtrole = interface->role();
|
||||||
if (qtrole == QAccessible::EditableText
|
if (qtrole == QAccessible::EditableText
|
||||||
|| interface->valueInterface()) {
|
|| interface->valueInterface()) {
|
||||||
@ -318,5 +315,3 @@ id getValueAttribute(QAccessibleInterface *interface)
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace QCocoaAccessible
|
} // namespace QCocoaAccessible
|
||||||
|
|
||||||
#endif // QT_NO_COCOA_ACCESSIBILITY
|
|
||||||
|
@ -46,22 +46,20 @@
|
|||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
#import <AppKit/NSAccessibility.h>
|
#import <AppKit/NSAccessibility.h>
|
||||||
|
|
||||||
#ifndef QT_NO_COCOA_ACCESSIBILITY
|
#import <qaccessible.h>
|
||||||
|
|
||||||
@class QCocoaAccessibleElement;
|
@class QCocoaAccessibleElement;
|
||||||
|
|
||||||
@interface QCocoaAccessibleElement : NSObject {
|
@interface QCocoaAccessibleElement : NSObject {
|
||||||
NSString *role;
|
NSString *role;
|
||||||
NSObject * parent;
|
NSObject *parent;
|
||||||
void *accessibleInterface;
|
QAccessible::Id axid;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)initWithInterface:(void *)anQAccessibleInterface parent:(id)aParent;
|
- (id)initWithId:(QAccessible::Id)anId parent:(id)aParent;
|
||||||
+ (QCocoaAccessibleElement *)createElementWithInterface:(void *)anQAccessibleInterface parent:(id)aParent;
|
+ (QCocoaAccessibleElement *)createElementWithId:(QAccessible::Id)anId parent:(id)aParent;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#endif // QT_NO_COCOA_ACCESSIBILITY
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -47,48 +47,43 @@
|
|||||||
|
|
||||||
#import <AppKit/NSAccessibility.h>
|
#import <AppKit/NSAccessibility.h>
|
||||||
|
|
||||||
#ifndef QT_NO_COCOA_ACCESSIBILITY
|
|
||||||
|
|
||||||
static QAccessibleInterface *acast(void *ptr)
|
|
||||||
{
|
|
||||||
return reinterpret_cast<QAccessibleInterface *>(ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
@implementation QCocoaAccessibleElement
|
@implementation QCocoaAccessibleElement
|
||||||
|
|
||||||
- (id)initWithInterface:(void *)anQAccessibleInterface parent:(id)aParent
|
- (id)initWithId:(QAccessible::Id)anId parent:(id)aParent
|
||||||
{
|
{
|
||||||
|
Q_ASSERT((int)anId < 0);
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self) {
|
if (self) {
|
||||||
accessibleInterface = anQAccessibleInterface;
|
axid = anId;
|
||||||
role = QCocoaAccessible::macRole(acast(accessibleInterface));
|
QAccessibleInterface *iface = QAccessible::accessibleInterface(axid);
|
||||||
|
Q_ASSERT(iface);
|
||||||
|
role = QCocoaAccessible::macRole(iface);
|
||||||
parent = aParent;
|
parent = aParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (QCocoaAccessibleElement *)createElementWithInterface:(void *)anQAccessibleInterface parent:(id)aParent
|
+ (QCocoaAccessibleElement *)createElementWithId:(QAccessible::Id)anId parent:(id)aParent
|
||||||
{
|
{
|
||||||
return [[self alloc] initWithInterface:anQAccessibleInterface parent:aParent];
|
return [[self alloc] initWithId:anId parent:aParent];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
delete acast(accessibleInterface);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)isEqual:(id)object {
|
- (BOOL)isEqual:(id)object {
|
||||||
if ([object isKindOfClass:[QCocoaAccessibleElement class]]) {
|
if ([object isKindOfClass:[QCocoaAccessibleElement class]]) {
|
||||||
QCocoaAccessibleElement *other = object;
|
QCocoaAccessibleElement *other = object;
|
||||||
return acast(other->accessibleInterface)->object() == acast(accessibleInterface)->object();
|
return other->axid == axid;
|
||||||
} else {
|
} else {
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSUInteger)hash {
|
- (NSUInteger)hash {
|
||||||
return qHash(acast(accessibleInterface)->object());
|
return axid;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -99,6 +94,11 @@ static QAccessibleInterface *acast(void *ptr)
|
|||||||
|
|
||||||
- (NSArray *)accessibilityAttributeNames {
|
- (NSArray *)accessibilityAttributeNames {
|
||||||
static NSArray *defaultAttributes = nil;
|
static NSArray *defaultAttributes = nil;
|
||||||
|
|
||||||
|
QAccessibleInterface *iface = QAccessible::accessibleInterface(axid);
|
||||||
|
if (!iface)
|
||||||
|
return defaultAttributes;
|
||||||
|
|
||||||
if (defaultAttributes == nil) {
|
if (defaultAttributes == nil) {
|
||||||
defaultAttributes = [[NSArray alloc] initWithObjects:
|
defaultAttributes = [[NSArray alloc] initWithObjects:
|
||||||
NSAccessibilityRoleAttribute,
|
NSAccessibilityRoleAttribute,
|
||||||
@ -118,7 +118,7 @@ static QAccessibleInterface *acast(void *ptr)
|
|||||||
NSMutableArray *attributes = [[NSMutableArray alloc] initWithCapacity : [defaultAttributes count]];
|
NSMutableArray *attributes = [[NSMutableArray alloc] initWithCapacity : [defaultAttributes count]];
|
||||||
[attributes addObjectsFromArray : defaultAttributes];
|
[attributes addObjectsFromArray : defaultAttributes];
|
||||||
|
|
||||||
if (QCocoaAccessible::hasValueAttribute(acast(accessibleInterface))) {
|
if (QCocoaAccessible::hasValueAttribute(iface)) {
|
||||||
[attributes addObject : NSAccessibilityValueAttribute];
|
[attributes addObject : NSAccessibilityValueAttribute];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,22 +126,33 @@ static QAccessibleInterface *acast(void *ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (id)accessibilityAttributeValue:(NSString *)attribute {
|
- (id)accessibilityAttributeValue:(NSString *)attribute {
|
||||||
|
QAccessibleInterface *iface = QAccessible::accessibleInterface(axid);
|
||||||
|
if (!iface) {
|
||||||
|
qWarning() << "Called attribute on invalid object: " << axid;
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
if ([attribute isEqualToString:NSAccessibilityRoleAttribute]) {
|
if ([attribute isEqualToString:NSAccessibilityRoleAttribute]) {
|
||||||
return role;
|
return role;
|
||||||
} else if ([attribute isEqualToString:NSAccessibilityRoleDescriptionAttribute]) {
|
} else if ([attribute isEqualToString:NSAccessibilityRoleDescriptionAttribute]) {
|
||||||
return NSAccessibilityRoleDescription(role, nil);
|
return NSAccessibilityRoleDescription(role, nil);
|
||||||
} else if ([attribute isEqualToString:NSAccessibilityChildrenAttribute]) {
|
} else if ([attribute isEqualToString:NSAccessibilityChildrenAttribute]) {
|
||||||
int numKids = acast(accessibleInterface)->childCount();
|
|
||||||
|
int numKids = iface->childCount();
|
||||||
|
// qDebug() << "Children for: " << axid << iface << " are: " << numKids;
|
||||||
|
|
||||||
NSMutableArray *kids = [NSMutableArray arrayWithCapacity:numKids];
|
NSMutableArray *kids = [NSMutableArray arrayWithCapacity:numKids];
|
||||||
for (int i = 0; i < numKids; ++i) {
|
for (int i = 0; i < numKids; ++i) {
|
||||||
QAccessibleInterface *childInterface = acast(accessibleInterface)->child(i);
|
QAccessibleInterface *child = iface->child(i);
|
||||||
QCocoaAccessibleElement *element = [QCocoaAccessibleElement createElementWithInterface:(void*)childInterface parent:self];
|
Q_ASSERT(child);
|
||||||
|
QAccessible::Id childId = QAccessible::uniqueId(child);
|
||||||
|
//qDebug() << " kid: " << childId << child;
|
||||||
|
QCocoaAccessibleElement *element = [QCocoaAccessibleElement createElementWithId:childId parent:self];
|
||||||
[kids addObject: element];
|
[kids addObject: element];
|
||||||
[element release];
|
[element release];
|
||||||
}
|
}
|
||||||
|
|
||||||
return kids;
|
return kids;
|
||||||
|
|
||||||
} else if ([attribute isEqualToString:NSAccessibilityFocusedAttribute]) {
|
} else if ([attribute isEqualToString:NSAccessibilityFocusedAttribute]) {
|
||||||
// Just check if the app thinks we're focused.
|
// Just check if the app thinks we're focused.
|
||||||
id focusedElement = [NSApp accessibilityAttributeValue:NSAccessibilityFocusedUIElementAttribute];
|
id focusedElement = [NSApp accessibilityAttributeValue:NSAccessibilityFocusedUIElementAttribute];
|
||||||
@ -155,23 +166,23 @@ static QAccessibleInterface *acast(void *ptr)
|
|||||||
// We're in the same top level element as our parent.
|
// We're in the same top level element as our parent.
|
||||||
return [parent accessibilityAttributeValue:NSAccessibilityTopLevelUIElementAttribute];
|
return [parent accessibilityAttributeValue:NSAccessibilityTopLevelUIElementAttribute];
|
||||||
} else if ([attribute isEqualToString:NSAccessibilityPositionAttribute]) {
|
} else if ([attribute isEqualToString:NSAccessibilityPositionAttribute]) {
|
||||||
QPoint qtPosition = acast(accessibleInterface)->rect().topLeft();
|
QPoint qtPosition = iface->rect().topLeft();
|
||||||
QSize qtSize = acast(accessibleInterface)->rect().size();
|
QSize qtSize = iface->rect().size();
|
||||||
return [NSValue valueWithPoint: NSMakePoint(qtPosition.x(), qt_mac_flipYCoordinate(qtPosition.y() + qtSize.height()))];
|
return [NSValue valueWithPoint: NSMakePoint(qtPosition.x(), qt_mac_flipYCoordinate(qtPosition.y() + qtSize.height()))];
|
||||||
} else if ([attribute isEqualToString:NSAccessibilitySizeAttribute]) {
|
} else if ([attribute isEqualToString:NSAccessibilitySizeAttribute]) {
|
||||||
QSize qtSize = acast(accessibleInterface)->rect().size();
|
QSize qtSize = iface->rect().size();
|
||||||
return [NSValue valueWithSize: NSMakeSize(qtSize.width(), qtSize.height())];
|
return [NSValue valueWithSize: NSMakeSize(qtSize.width(), qtSize.height())];
|
||||||
} else if ([attribute isEqualToString:NSAccessibilityDescriptionAttribute]) {
|
} else if ([attribute isEqualToString:NSAccessibilityDescriptionAttribute]) {
|
||||||
return QCFString::toNSString(acast(accessibleInterface)->text(QAccessible::Name));
|
return QCFString::toNSString(iface->text(QAccessible::Name));
|
||||||
} else if ([attribute isEqualToString:NSAccessibilityEnabledAttribute]) {
|
} else if ([attribute isEqualToString:NSAccessibilityEnabledAttribute]) {
|
||||||
return [NSNumber numberWithBool:!acast(accessibleInterface)->state().disabled];
|
return [NSNumber numberWithBool:!iface->state().disabled];
|
||||||
} else if ([attribute isEqualToString:NSAccessibilityValueAttribute]) {
|
} else if ([attribute isEqualToString:NSAccessibilityValueAttribute]) {
|
||||||
// VoiceOver asks for the value attribute for all elements. Return nil
|
// VoiceOver asks for the value attribute for all elements. Return nil
|
||||||
// if we don't want the element to have a value attribute.
|
// if we don't want the element to have a value attribute.
|
||||||
if (!QCocoaAccessible::hasValueAttribute(acast(accessibleInterface)))
|
if (!QCocoaAccessible::hasValueAttribute(iface))
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
return QCocoaAccessible::getValueAttribute(acast(accessibleInterface));
|
return QCocoaAccessible::getValueAttribute(iface);
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil;
|
return nil;
|
||||||
@ -196,8 +207,11 @@ static QAccessibleInterface *acast(void *ptr)
|
|||||||
|
|
||||||
- (NSArray *)accessibilityActionNames {
|
- (NSArray *)accessibilityActionNames {
|
||||||
NSMutableArray * nsActions = [NSMutableArray new];
|
NSMutableArray * nsActions = [NSMutableArray new];
|
||||||
|
QAccessibleInterface *iface = QAccessible::accessibleInterface(axid);
|
||||||
|
if (!iface)
|
||||||
|
return nsActions;
|
||||||
|
|
||||||
QAccessibleActionInterface *actionInterface = acast(accessibleInterface)->actionInterface();
|
QAccessibleActionInterface *actionInterface = iface->actionInterface();
|
||||||
if (actionInterface) {
|
if (actionInterface) {
|
||||||
QStringList supportedActionNames = actionInterface->actionNames();
|
QStringList supportedActionNames = actionInterface->actionNames();
|
||||||
|
|
||||||
@ -212,48 +226,58 @@ static QAccessibleInterface *acast(void *ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *)accessibilityActionDescription:(NSString *)action {
|
- (NSString *)accessibilityActionDescription:(NSString *)action {
|
||||||
QAccessibleActionInterface *actionInterface = acast(accessibleInterface)->actionInterface();
|
QAccessibleInterface *iface = QAccessible::accessibleInterface(axid);
|
||||||
QString qtAction = QCocoaAccessible::translateAction(action);
|
if (!iface)
|
||||||
|
return nil; // FIXME is that the right return type??
|
||||||
|
QAccessibleActionInterface *actionInterface = iface->actionInterface();
|
||||||
|
if (actionInterface) {
|
||||||
|
QString qtAction = QCocoaAccessible::translateAction(action);
|
||||||
|
|
||||||
// Return a description from the action interface if this action is not known to the OS.
|
// Return a description from the action interface if this action is not known to the OS.
|
||||||
if (qtAction.isEmpty()) {
|
if (qtAction.isEmpty()) {
|
||||||
QString description = actionInterface->localizedActionDescription(qtAction);
|
QString description = actionInterface->localizedActionDescription(qtAction);
|
||||||
return QCFString::toNSString(description);
|
return QCFString::toNSString(description);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NSAccessibilityActionDescription(action);
|
return NSAccessibilityActionDescription(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)accessibilityPerformAction:(NSString *)action {
|
- (void)accessibilityPerformAction:(NSString *)action {
|
||||||
QAccessibleActionInterface *actionInterface = acast(accessibleInterface)->actionInterface();
|
QAccessibleInterface *iface = QAccessible::accessibleInterface(axid);
|
||||||
if (actionInterface) {
|
if (iface) {
|
||||||
actionInterface->doAction(QCocoaAccessible::translateAction(action));
|
QAccessibleActionInterface *actionInterface = iface->actionInterface();
|
||||||
|
if (actionInterface) {
|
||||||
|
actionInterface->doAction(QCocoaAccessible::translateAction(action));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// misc
|
// misc
|
||||||
|
|
||||||
- (BOOL)accessibilityIsIgnored {
|
- (BOOL)accessibilityIsIgnored {
|
||||||
return QCocoaAccessible::shouldBeIgnrored(acast(accessibleInterface));
|
return false; //QCocoaAccessible::shouldBeIgnored(QAccessible::accessibleInterface(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)accessibilityHitTest:(NSPoint)point {
|
- (id)accessibilityHitTest:(NSPoint)point {
|
||||||
|
QAccessibleInterface *iface = QAccessible::accessibleInterface(axid);
|
||||||
if (!accessibleInterface)
|
if (!iface || !iface->isValid()) {
|
||||||
return NSAccessibilityUnignoredAncestor(self);
|
// qDebug() << "Hit test: INVALID";
|
||||||
|
|
||||||
if (!acast(accessibleInterface)->isValid())
|
|
||||||
return NSAccessibilityUnignoredAncestor(self);
|
|
||||||
|
|
||||||
QAccessibleInterface *childInterface = acast(accessibleInterface)->childAt(point.x, qt_mac_flipYCoordinate(point.y));
|
|
||||||
|
|
||||||
// No child found, meaning we hit this element.
|
|
||||||
if (!childInterface) {
|
|
||||||
return NSAccessibilityUnignoredAncestor(self);
|
return NSAccessibilityUnignoredAncestor(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QAccessibleInterface *childInterface = iface->childAt(point.x, qt_mac_flipYCoordinate(point.y));
|
||||||
|
|
||||||
|
// No child found, meaning we hit this element.
|
||||||
|
if (!childInterface) {
|
||||||
|
// qDebug() << "Hit test returns: " << id << iface;
|
||||||
|
return self;
|
||||||
|
//return NSAccessibilityUnignoredAncestor(self);
|
||||||
|
}
|
||||||
|
|
||||||
|
QAccessible::Id childId = QAccessible::uniqueId(childInterface);
|
||||||
// hit a child, forward to child accessible interface.
|
// hit a child, forward to child accessible interface.
|
||||||
QCocoaAccessibleElement *accessibleElement = [QCocoaAccessibleElement createElementWithInterface:childInterface parent:self];
|
QCocoaAccessibleElement *accessibleElement = [QCocoaAccessibleElement createElementWithId:childId parent:self];
|
||||||
[accessibleElement autorelease];
|
[accessibleElement autorelease];
|
||||||
|
|
||||||
return [accessibleElement accessibilityHitTest:point];
|
return [accessibleElement accessibilityHitTest:point];
|
||||||
@ -264,6 +288,3 @@ static QAccessibleInterface *acast(void *ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#endif // QT_NO_COCOA_ACCESSIBILITY
|
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ private:
|
|||||||
QAbstractEventDispatcher *mEventDispatcher;
|
QAbstractEventDispatcher *mEventDispatcher;
|
||||||
|
|
||||||
QScopedPointer<QPlatformInputContext> mInputContext;
|
QScopedPointer<QPlatformInputContext> mInputContext;
|
||||||
#ifndef QT_NO_COCOA_ACCESSIBILITY
|
#ifndef QT_NO_ACCESSIBILITY
|
||||||
QScopedPointer<QPlatformAccessibility> mAccessibility;
|
QScopedPointer<QPlatformAccessibility> mAccessibility;
|
||||||
#endif
|
#endif
|
||||||
QScopedPointer<QPlatformTheme> mPlatformTheme;
|
QScopedPointer<QPlatformTheme> mPlatformTheme;
|
||||||
|
@ -216,7 +216,7 @@ QCocoaIntegration::QCocoaIntegration()
|
|||||||
: mFontDb(new QCoreTextFontDatabase())
|
: mFontDb(new QCoreTextFontDatabase())
|
||||||
, mEventDispatcher(new QCocoaEventDispatcher())
|
, mEventDispatcher(new QCocoaEventDispatcher())
|
||||||
, mInputContext(new QCocoaInputContext)
|
, mInputContext(new QCocoaInputContext)
|
||||||
#ifndef QT_NO_COCOA_ACCESSIBILITY
|
#ifndef QT_NO_ACCESSIBILITY
|
||||||
, mAccessibility(new QCococaAccessibility)
|
, mAccessibility(new QCococaAccessibility)
|
||||||
#endif
|
#endif
|
||||||
, mCocoaClipboard(new QCocoaClipboard)
|
, mCocoaClipboard(new QCocoaClipboard)
|
||||||
@ -395,7 +395,7 @@ QPlatformInputContext *QCocoaIntegration::inputContext() const
|
|||||||
|
|
||||||
QPlatformAccessibility *QCocoaIntegration::accessibility() const
|
QPlatformAccessibility *QCocoaIntegration::accessibility() const
|
||||||
{
|
{
|
||||||
#ifndef QT_NO_COCOA_ACCESSIBILITY
|
#ifndef QT_NO_ACCESSIBILITY
|
||||||
return mAccessibility.data();
|
return mAccessibility.data();
|
||||||
#else
|
#else
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -51,8 +51,6 @@
|
|||||||
|
|
||||||
#import <AppKit/NSAccessibility.h>
|
#import <AppKit/NSAccessibility.h>
|
||||||
|
|
||||||
#ifndef QT_NO_COCOA_ACCESSIBILITY
|
|
||||||
|
|
||||||
@implementation QNSView (QNSViewAccessibility)
|
@implementation QNSView (QNSViewAccessibility)
|
||||||
|
|
||||||
// The QNSView is a container that the user does not interact directly with:
|
// The QNSView is a container that the user does not interact directly with:
|
||||||
@ -77,7 +75,10 @@
|
|||||||
int numKids = m_accessibleRoot->childCount();
|
int numKids = m_accessibleRoot->childCount();
|
||||||
NSMutableArray *kids = [NSMutableArray arrayWithCapacity:numKids];
|
NSMutableArray *kids = [NSMutableArray arrayWithCapacity:numKids];
|
||||||
for (int i = 0; i < numKids; ++i) {
|
for (int i = 0; i < numKids; ++i) {
|
||||||
QCocoaAccessibleElement *element = [QCocoaAccessibleElement createElementWithInterface: m_accessibleRoot->child(i) parent:self ];
|
QAccessibleInterface *child = m_accessibleRoot->child(i);
|
||||||
|
Q_ASSERT(child);
|
||||||
|
QAccessible::Id childAxid = QAccessible::uniqueId(child);
|
||||||
|
QCocoaAccessibleElement *element = [QCocoaAccessibleElement createElementWithId:childAxid parent:self];
|
||||||
[kids addObject: element];
|
[kids addObject: element];
|
||||||
[element release];
|
[element release];
|
||||||
}
|
}
|
||||||
@ -99,12 +100,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Hit a child, forward to child accessible interface.
|
// Hit a child, forward to child accessible interface.
|
||||||
|
QAccessible::Id childAxid = QAccessible::uniqueId(childInterface);
|
||||||
QCocoaAccessibleElement *accessibleElement = [QCocoaAccessibleElement createElementWithInterface: childInterface parent:self ];
|
QCocoaAccessibleElement *accessibleElement = [QCocoaAccessibleElement createElementWithId:childAxid parent:self ];
|
||||||
[accessibleElement autorelease];
|
[accessibleElement autorelease];
|
||||||
return [accessibleElement accessibilityHitTest:point];
|
return [accessibleElement accessibilityHitTest:point];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#endif // QT_NO_COCOA_ACCESSIBILITY
|
|
||||||
|
@ -230,6 +230,10 @@ HRESULT STDMETHODCALLTYPE AccessibleRelation::get_targets(
|
|||||||
**************************************************************/
|
**************************************************************/
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::QueryInterface(REFIID id, LPVOID *iface)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::QueryInterface(REFIID id, LPVOID *iface)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
|
if (!accessible)
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
|
||||||
HRESULT hr = QWindowsMsaaAccessible::QueryInterface(id, iface);
|
HRESULT hr = QWindowsMsaaAccessible::QueryInterface(id, iface);
|
||||||
if (!SUCCEEDED(hr)) {
|
if (!SUCCEEDED(hr)) {
|
||||||
if (id == IID_IServiceProvider) {
|
if (id == IID_IServiceProvider) {
|
||||||
@ -301,10 +305,11 @@ ULONG STDMETHODCALLTYPE QWindowsIA2Accessible::Release()
|
|||||||
**************************************************************/
|
**************************************************************/
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_nRelations(long *nRelations)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_nRelations(long *nRelations)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!nRelations)
|
if (!nRelations)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
return getRelationsHelper(0, 0, 0, nRelations);
|
return getRelationsHelper(0, 0, 0, nRelations);
|
||||||
@ -312,10 +317,11 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_nRelations(long *nRelations
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_relation(long relationIndex, IAccessibleRelation **relation)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_relation(long relationIndex, IAccessibleRelation **relation)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!relation)
|
if (!relation)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
return getRelationsHelper(relation, relationIndex, 1);
|
return getRelationsHelper(relation, relationIndex, 1);
|
||||||
@ -330,8 +336,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_relations(long maxRelations
|
|||||||
IAccessibleRelation **relations,
|
IAccessibleRelation **relations,
|
||||||
long *nRelations)
|
long *nRelations)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
return getRelationsHelper(relations, 0, maxRelations, nRelations);
|
return getRelationsHelper(relations, 0, maxRelations, nRelations);
|
||||||
@ -340,8 +347,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_relations(long maxRelations
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::role(long *ia2role)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::role(long *ia2role)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
long r = accessible->role();
|
long r = accessible->role();
|
||||||
@ -386,8 +394,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_groupPosition(long *groupLe
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_states(AccessibleStates *states)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_states(AccessibleStates *states)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
if (!states)
|
if (!states)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
@ -462,23 +471,23 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_localizedExtendedStates(lon
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_uniqueID(long *outUniqueID)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_uniqueID(long *outUniqueID)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
// ### FIXME SERIOUSLY, NOT A STABLE SOLUTION IF NODES ARE DELETED ETC
|
|
||||||
// Return 0 if no object and no parent. This is really an error case.
|
|
||||||
uint uid = uniqueID();
|
|
||||||
accessibleDebug("uniqueID: %08x", uid);
|
|
||||||
|
|
||||||
*outUniqueID = (long)uid;
|
accessibleDebug("uniqueID: %08x", id);
|
||||||
return uid ? S_OK : S_FALSE;
|
|
||||||
|
*outUniqueID = (long)id;
|
||||||
|
return int(id) < 0 ? S_OK : S_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_windowHandle(HWND *windowHandle)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_windowHandle(HWND *windowHandle)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
return GetWindow(windowHandle);
|
return GetWindow(windowHandle);
|
||||||
}
|
}
|
||||||
@ -486,8 +495,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_windowHandle(HWND *windowHa
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_indexInParent(long *indexInParent)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_indexInParent(long *indexInParent)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
if (!indexInParent)
|
if (!indexInParent)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
@ -497,7 +507,6 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_indexInParent(long *indexIn
|
|||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
}
|
}
|
||||||
int indexOfChild = par->indexOfChild(accessible);
|
int indexOfChild = par->indexOfChild(accessible);
|
||||||
delete par;
|
|
||||||
Q_ASSERT(indexOfChild >= 0);
|
Q_ASSERT(indexOfChild >= 0);
|
||||||
*indexInParent = indexOfChild;
|
*indexInParent = indexOfChild;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
@ -505,8 +514,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_indexInParent(long *indexIn
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_locale(IA2Locale *locale)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_locale(IA2Locale *locale)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
IA2Locale res;
|
IA2Locale res;
|
||||||
QLocale l;
|
QLocale l;
|
||||||
@ -519,8 +529,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_locale(IA2Locale *locale)
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_attributes(BSTR *attributes)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_attributes(BSTR *attributes)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
*attributes = 0;//QStringToBSTR(QString());
|
*attributes = 0;//QStringToBSTR(QString());
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
@ -531,8 +542,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_attributes(BSTR *attributes
|
|||||||
**************************************************************/
|
**************************************************************/
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::nActions(long *nActions)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::nActions(long *nActions)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
*nActions = 0;
|
*nActions = 0;
|
||||||
|
|
||||||
@ -543,8 +555,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::nActions(long *nActions)
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::doAction(long actionIndex)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::doAction(long actionIndex)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
if (QAccessibleActionInterface *actionIface = actionInterface()) {
|
if (QAccessibleActionInterface *actionIface = actionInterface()) {
|
||||||
const QStringList actionNames = actionIface->actionNames();
|
const QStringList actionNames = actionIface->actionNames();
|
||||||
@ -559,8 +572,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::doAction(long actionIndex)
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_description(long actionIndex, BSTR *description)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_description(long actionIndex, BSTR *description)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
*description = 0;
|
*description = 0;
|
||||||
if (QAccessibleActionInterface *actionIface = actionInterface()) {
|
if (QAccessibleActionInterface *actionIface = actionInterface()) {
|
||||||
@ -575,8 +589,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_description(long actionInde
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_keyBinding(long actionIndex, long nMaxBindings, BSTR **keyBindings, long *nBindings)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_keyBinding(long actionIndex, long nMaxBindings, BSTR **keyBindings, long *nBindings)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
Q_UNUSED(nMaxBindings);
|
Q_UNUSED(nMaxBindings);
|
||||||
BSTR *arrayOfBindingsToReturn = 0;
|
BSTR *arrayOfBindingsToReturn = 0;
|
||||||
@ -603,8 +618,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_keyBinding(long actionIndex
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_name(long actionIndex, BSTR *name)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_name(long actionIndex, BSTR *name)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
*name = 0;
|
*name = 0;
|
||||||
if (QAccessibleActionInterface *actionIface = actionInterface()) {
|
if (QAccessibleActionInterface *actionIface = actionInterface()) {
|
||||||
@ -619,8 +635,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_name(long actionIndex, BSTR
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_localizedName(long actionIndex, BSTR *localizedName)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_localizedName(long actionIndex, BSTR *localizedName)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
*localizedName = 0;
|
*localizedName = 0;
|
||||||
if (QAccessibleActionInterface *actionIface = actionInterface()) {
|
if (QAccessibleActionInterface *actionIface = actionInterface()) {
|
||||||
@ -639,8 +656,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_localizedName(long actionIn
|
|||||||
**************************************************************/
|
**************************************************************/
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_locationInParent(long *x, long *y)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_locationInParent(long *x, long *y)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
QPoint topLeft = accessible->rect().topLeft();
|
QPoint topLeft = accessible->rect().topLeft();
|
||||||
@ -656,8 +674,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_locationInParent(long *x, l
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_foreground(IA2Color *foreground)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_foreground(IA2Color *foreground)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
// IA2Color is a typedef for long
|
// IA2Color is a typedef for long
|
||||||
@ -667,8 +686,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_foreground(IA2Color *foregr
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_background(IA2Color *background)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_background(IA2Color *background)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
// IA2Color is a typedef for long
|
// IA2Color is a typedef for long
|
||||||
@ -687,6 +707,8 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_background(IA2Color *backgr
|
|||||||
*/
|
*/
|
||||||
QString QWindowsIA2Accessible::textForRange(int startOffset, int endOffset) const
|
QString QWindowsIA2Accessible::textForRange(int startOffset, int endOffset) const
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
|
|
||||||
if (QAccessibleTextInterface *textIface = accessible->textInterface()) {
|
if (QAccessibleTextInterface *textIface = accessible->textInterface()) {
|
||||||
if (endOffset == IA2_TEXT_OFFSET_LENGTH)
|
if (endOffset == IA2_TEXT_OFFSET_LENGTH)
|
||||||
endOffset = textIface->characterCount();
|
endOffset = textIface->characterCount();
|
||||||
@ -704,6 +726,7 @@ QString QWindowsIA2Accessible::textForRange(int startOffset, int endOffset) cons
|
|||||||
*/
|
*/
|
||||||
void QWindowsIA2Accessible::replaceTextFallback(long startOffset, long endOffset, const QString &txt)
|
void QWindowsIA2Accessible::replaceTextFallback(long startOffset, long endOffset, const QString &txt)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
QString t = textForRange(0, -1);
|
QString t = textForRange(0, -1);
|
||||||
if (endOffset == IA2_TEXT_OFFSET_LENGTH)
|
if (endOffset == IA2_TEXT_OFFSET_LENGTH)
|
||||||
endOffset = t.length();
|
endOffset = t.length();
|
||||||
@ -717,6 +740,7 @@ void QWindowsIA2Accessible::replaceTextFallback(long startOffset, long endOffset
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::copyText(long startOffset, long endOffset)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::copyText(long startOffset, long endOffset)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
#ifndef QT_NO_CLIPBOARD
|
#ifndef QT_NO_CLIPBOARD
|
||||||
const QString t = textForRange(startOffset, endOffset);
|
const QString t = textForRange(startOffset, endOffset);
|
||||||
@ -729,6 +753,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::copyText(long startOffset, long
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::deleteText(long startOffset, long endOffset)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::deleteText(long startOffset, long endOffset)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (QAccessibleEditableTextInterface *editableTextIface = accessible->editableTextInterface())
|
if (QAccessibleEditableTextInterface *editableTextIface = accessible->editableTextInterface())
|
||||||
editableTextIface->deleteText(startOffset, endOffset);
|
editableTextIface->deleteText(startOffset, endOffset);
|
||||||
@ -739,6 +764,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::deleteText(long startOffset, lo
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::insertText(long offset, BSTR *text)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::insertText(long offset, BSTR *text)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
const QString txt(BSTRToQString(*text));
|
const QString txt(BSTRToQString(*text));
|
||||||
if (QAccessibleEditableTextInterface *editableTextIface = accessible->editableTextInterface())
|
if (QAccessibleEditableTextInterface *editableTextIface = accessible->editableTextInterface())
|
||||||
@ -750,6 +776,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::insertText(long offset, BSTR *t
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::cutText(long startOffset, long endOffset)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::cutText(long startOffset, long endOffset)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
#ifndef QT_NO_CLIPBOARD
|
#ifndef QT_NO_CLIPBOARD
|
||||||
const QString t = textForRange(startOffset, endOffset);
|
const QString t = textForRange(startOffset, endOffset);
|
||||||
@ -766,6 +793,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::cutText(long startOffset, long
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::pasteText(long offset)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::pasteText(long offset)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
#ifndef QT_NO_CLIPBOARD
|
#ifndef QT_NO_CLIPBOARD
|
||||||
const QString txt = QGuiApplication::clipboard()->text();
|
const QString txt = QGuiApplication::clipboard()->text();
|
||||||
@ -781,6 +809,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::pasteText(long offset)
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::replaceText(long startOffset, long endOffset, BSTR *text)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::replaceText(long startOffset, long endOffset, BSTR *text)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
const QString txt(BSTRToQString(*text));
|
const QString txt(BSTRToQString(*text));
|
||||||
if (QAccessibleEditableTextInterface *editableTextIface = accessible->editableTextInterface())
|
if (QAccessibleEditableTextInterface *editableTextIface = accessible->editableTextInterface())
|
||||||
@ -801,8 +830,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::setAttributes(long /*startOffse
|
|||||||
**************************************************************/
|
**************************************************************/
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_cellAt( long row, long column, IUnknown **cell)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_cellAt( long row, long column, IUnknown **cell)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
*cell = 0;
|
*cell = 0;
|
||||||
@ -817,8 +847,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_cellAt( long row, long colu
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_caption( IUnknown **captionInterface)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_caption( IUnknown **captionInterface)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
*captionInterface = 0;
|
*captionInterface = 0;
|
||||||
@ -831,8 +862,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_caption( IUnknown **caption
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_columnDescription( long column, BSTR *description)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_columnDescription( long column, BSTR *description)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
*description = 0;
|
*description = 0;
|
||||||
@ -846,8 +878,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_columnDescription( long col
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_nColumns( long *columnCount)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_nColumns( long *columnCount)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
if (QAccessibleTableInterface *tableIface = tableInterface()) {
|
if (QAccessibleTableInterface *tableIface = tableInterface()) {
|
||||||
@ -859,8 +892,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_nColumns( long *columnCount
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_nRows(long *rowCount)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_nRows(long *rowCount)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
if (QAccessibleTableInterface *tableIface = tableInterface()) {
|
if (QAccessibleTableInterface *tableIface = tableInterface()) {
|
||||||
@ -872,8 +906,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_nRows(long *rowCount)
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_nSelectedCells(long *cellCount)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_nSelectedCells(long *cellCount)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
if (QAccessibleTableInterface *tableIface = tableInterface()) {
|
if (QAccessibleTableInterface *tableIface = tableInterface()) {
|
||||||
@ -885,8 +920,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_nSelectedCells(long *cellCo
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_nSelectedColumns(long *columnCount)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_nSelectedColumns(long *columnCount)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
if (QAccessibleTableInterface *tableIface = tableInterface()) {
|
if (QAccessibleTableInterface *tableIface = tableInterface()) {
|
||||||
@ -898,8 +934,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_nSelectedColumns(long *colu
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_nSelectedRows(long *rowCount)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_nSelectedRows(long *rowCount)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
if (QAccessibleTableInterface *tableIface = tableInterface()) {
|
if (QAccessibleTableInterface *tableIface = tableInterface()) {
|
||||||
@ -911,8 +948,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_nSelectedRows(long *rowCoun
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_rowDescription(long row, BSTR *description)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_rowDescription(long row, BSTR *description)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
*description = 0;
|
*description = 0;
|
||||||
@ -926,10 +964,11 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_rowDescription(long row, BS
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_selectedCells(IUnknown ***cells, long *nSelectedCells)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_selectedCells(IUnknown ***cells, long *nSelectedCells)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
Q_UNUSED(cells);
|
Q_UNUSED(cells);
|
||||||
Q_UNUSED(nSelectedCells);
|
Q_UNUSED(nSelectedCells);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
QList<QAccessibleInterface*> selectedCells = tableInterface()->selectedCells();
|
QList<QAccessibleInterface*> selectedCells = tableInterface()->selectedCells();
|
||||||
@ -938,8 +977,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_selectedCells(IUnknown ***c
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_selectedColumns(long **selectedColumns, long *nColumns)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_selectedColumns(long **selectedColumns, long *nColumns)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
if (QAccessibleTableInterface *tableIface = tableInterface()) {
|
if (QAccessibleTableInterface *tableIface = tableInterface()) {
|
||||||
@ -958,8 +998,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_selectedColumns(long **sele
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_selectedRows(long **selectedRows, long *nRows)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_selectedRows(long **selectedRows, long *nRows)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
if (QAccessibleTableInterface *tableIface = tableInterface()) {
|
if (QAccessibleTableInterface *tableIface = tableInterface()) {
|
||||||
@ -978,8 +1019,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_selectedRows(long **selecte
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_summary(IUnknown **summaryInterface)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_summary(IUnknown **summaryInterface)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
*summaryInterface = 0;
|
*summaryInterface = 0;
|
||||||
@ -992,8 +1034,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_summary(IUnknown **summaryI
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_isColumnSelected(long column, boolean *isSelected)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_isColumnSelected(long column, boolean *isSelected)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
if (QAccessibleTableInterface *tableIface = tableInterface()) {
|
if (QAccessibleTableInterface *tableIface = tableInterface()) {
|
||||||
@ -1005,8 +1048,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_isColumnSelected(long colum
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_isRowSelected(long row, boolean *isSelected)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_isRowSelected(long row, boolean *isSelected)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
if (QAccessibleTableInterface *tableIface = tableInterface()) {
|
if (QAccessibleTableInterface *tableIface = tableInterface()) {
|
||||||
@ -1018,8 +1062,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_isRowSelected(long row, boo
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::selectRow(long row)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::selectRow(long row)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
if (QAccessibleTableInterface *tableIface = tableInterface()) {
|
if (QAccessibleTableInterface *tableIface = tableInterface()) {
|
||||||
@ -1031,8 +1076,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::selectRow(long row)
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::selectColumn(long column)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::selectColumn(long column)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
if (QAccessibleTableInterface *tableIface = tableInterface()) {
|
if (QAccessibleTableInterface *tableIface = tableInterface()) {
|
||||||
@ -1044,8 +1090,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::selectColumn(long column)
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::unselectRow(long row)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::unselectRow(long row)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
if (QAccessibleTableInterface *tableIface = tableInterface()) {
|
if (QAccessibleTableInterface *tableIface = tableInterface()) {
|
||||||
@ -1057,8 +1104,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::unselectRow(long row)
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::unselectColumn(long column)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::unselectColumn(long column)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
if (QAccessibleTableInterface *tableIface = tableInterface()) {
|
if (QAccessibleTableInterface *tableIface = tableInterface()) {
|
||||||
@ -1070,8 +1118,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::unselectColumn(long column)
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_modelChange( IA2TableModelChange * /*modelChange*/)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_modelChange( IA2TableModelChange * /*modelChange*/)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
@ -1081,8 +1130,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_modelChange( IA2TableModelC
|
|||||||
\**************************************************************/
|
\**************************************************************/
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_columnExtent(long *nColumnsSpanned)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_columnExtent(long *nColumnsSpanned)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
*nColumnsSpanned = tableCellInterface()->columnExtent();
|
*nColumnsSpanned = tableCellInterface()->columnExtent();
|
||||||
@ -1092,8 +1142,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_columnExtent(long *nColumns
|
|||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_columnHeaderCells(IUnknown ***cellAccessibles,
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_columnHeaderCells(IUnknown ***cellAccessibles,
|
||||||
long *nColumnHeaderCells)
|
long *nColumnHeaderCells)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
const QList<QAccessibleInterface*> headerCells = tableCellInterface()->columnHeaderCells();
|
const QList<QAccessibleInterface*> headerCells = tableCellInterface()->columnHeaderCells();
|
||||||
return wrapListOfCells(headerCells, cellAccessibles, nColumnHeaderCells);
|
return wrapListOfCells(headerCells, cellAccessibles, nColumnHeaderCells);
|
||||||
@ -1101,8 +1152,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_columnHeaderCells(IUnknown
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_columnIndex(long *columnIndex)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_columnIndex(long *columnIndex)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
*columnIndex = tableCellInterface()->columnIndex();
|
*columnIndex = tableCellInterface()->columnIndex();
|
||||||
return S_OK;
|
return S_OK;
|
||||||
@ -1110,8 +1162,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_columnIndex(long *columnInd
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_rowExtent(long *nRowsSpanned)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_rowExtent(long *nRowsSpanned)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
*nRowsSpanned = tableCellInterface()->rowExtent();
|
*nRowsSpanned = tableCellInterface()->rowExtent();
|
||||||
return S_OK;
|
return S_OK;
|
||||||
@ -1120,8 +1173,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_rowExtent(long *nRowsSpanne
|
|||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_rowHeaderCells(IUnknown ***cellAccessibles,
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_rowHeaderCells(IUnknown ***cellAccessibles,
|
||||||
long *nRowHeaderCells)
|
long *nRowHeaderCells)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
const QList<QAccessibleInterface*> headerCells = tableCellInterface()->rowHeaderCells();
|
const QList<QAccessibleInterface*> headerCells = tableCellInterface()->rowHeaderCells();
|
||||||
return wrapListOfCells(headerCells, cellAccessibles, nRowHeaderCells);
|
return wrapListOfCells(headerCells, cellAccessibles, nRowHeaderCells);
|
||||||
@ -1129,8 +1183,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_rowHeaderCells(IUnknown ***
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_rowIndex(long *rowIndex)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_rowIndex(long *rowIndex)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
*rowIndex = tableCellInterface()->rowIndex();
|
*rowIndex = tableCellInterface()->rowIndex();
|
||||||
return S_OK;
|
return S_OK;
|
||||||
@ -1138,8 +1193,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_rowIndex(long *rowIndex)
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_isSelected( boolean *isSelected)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_isSelected( boolean *isSelected)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
*isSelected = tableCellInterface()->isSelected();
|
*isSelected = tableCellInterface()->isSelected();
|
||||||
return S_OK;
|
return S_OK;
|
||||||
@ -1149,8 +1205,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_rowColumnExtents(long *row,
|
|||||||
long *rowExtents, long *columnExtents,
|
long *rowExtents, long *columnExtents,
|
||||||
boolean *isSelected)
|
boolean *isSelected)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
tableCellInterface()->rowColumnExtents((int*)row, (int*)column, (int*)rowExtents, (int*)columnExtents, (bool*)isSelected);
|
tableCellInterface()->rowColumnExtents((int*)row, (int*)column, (int*)rowExtents, (int*)columnExtents, (bool*)isSelected);
|
||||||
@ -1159,8 +1216,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_rowColumnExtents(long *row,
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_table(IUnknown **table)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_table(IUnknown **table)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
QAccessibleInterface *tableIface = tableCellInterface()->table();
|
QAccessibleInterface *tableIface = tableCellInterface()->table();
|
||||||
@ -1175,6 +1233,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_table(IUnknown **table)
|
|||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::addSelection(long startOffset,
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::addSelection(long startOffset,
|
||||||
long endOffset)
|
long endOffset)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (QAccessibleTextInterface *text = textInterface()) {
|
if (QAccessibleTextInterface *text = textInterface()) {
|
||||||
text->addSelection(startOffset, endOffset);
|
text->addSelection(startOffset, endOffset);
|
||||||
@ -1188,6 +1247,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_attributes(long offset,
|
|||||||
long *endOffset,
|
long *endOffset,
|
||||||
BSTR *textAttributes)
|
BSTR *textAttributes)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (QAccessibleTextInterface *text = textInterface()) {
|
if (QAccessibleTextInterface *text = textInterface()) {
|
||||||
const QString attrs = text->attributes(offset, (int*)startOffset, (int*)endOffset);
|
const QString attrs = text->attributes(offset, (int*)startOffset, (int*)endOffset);
|
||||||
@ -1199,6 +1259,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_attributes(long offset,
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_caretOffset(long *offset)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_caretOffset(long *offset)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (QAccessibleTextInterface *text = textInterface()) {
|
if (QAccessibleTextInterface *text = textInterface()) {
|
||||||
*offset = text->cursorPosition();
|
*offset = text->cursorPosition();
|
||||||
@ -1215,6 +1276,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_characterExtents(long offse
|
|||||||
long *width,
|
long *width,
|
||||||
long *height)
|
long *height)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (QAccessibleTextInterface *text = textInterface()) {
|
if (QAccessibleTextInterface *text = textInterface()) {
|
||||||
QRect rect = text->characterRect(offset);
|
QRect rect = text->characterRect(offset);
|
||||||
@ -1228,6 +1290,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_characterExtents(long offse
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_nSelections(long *nSelections)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_nSelections(long *nSelections)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (QAccessibleTextInterface *text = textInterface()) {
|
if (QAccessibleTextInterface *text = textInterface()) {
|
||||||
*nSelections = text->selectionCount();
|
*nSelections = text->selectionCount();
|
||||||
@ -1241,6 +1304,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_offsetAtPoint(long x,
|
|||||||
enum IA2CoordinateType coordType,
|
enum IA2CoordinateType coordType,
|
||||||
long *offset)
|
long *offset)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (QAccessibleTextInterface *text = textInterface()) {
|
if (QAccessibleTextInterface *text = textInterface()) {
|
||||||
QPoint screenPos = mapToScreenPos(coordType, x, y);
|
QPoint screenPos = mapToScreenPos(coordType, x, y);
|
||||||
@ -1255,6 +1319,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_selection(long selectionInd
|
|||||||
long *startOffset,
|
long *startOffset,
|
||||||
long *endOffset)
|
long *endOffset)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (QAccessibleTextInterface *text = textInterface()) {
|
if (QAccessibleTextInterface *text = textInterface()) {
|
||||||
text->selection(selectionIndex, (int*)startOffset, (int*)endOffset);
|
text->selection(selectionIndex, (int*)startOffset, (int*)endOffset);
|
||||||
@ -1267,6 +1332,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_text(long startOffset,
|
|||||||
long endOffset,
|
long endOffset,
|
||||||
BSTR *text)
|
BSTR *text)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (QAccessibleTextInterface *textif = textInterface()) {
|
if (QAccessibleTextInterface *textif = textInterface()) {
|
||||||
const QString t = textif->text(startOffset, endOffset);
|
const QString t = textif->text(startOffset, endOffset);
|
||||||
@ -1285,6 +1351,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_textBeforeOffset(long offse
|
|||||||
long *endOffset,
|
long *endOffset,
|
||||||
BSTR *text)
|
BSTR *text)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (QAccessibleTextInterface *textIface = textInterface()) {
|
if (QAccessibleTextInterface *textIface = textInterface()) {
|
||||||
const QString txt = textIface->textBeforeOffset(offset, (QAccessible2::BoundaryType)boundaryType, (int*)startOffset, (int*)endOffset);
|
const QString txt = textIface->textBeforeOffset(offset, (QAccessible2::BoundaryType)boundaryType, (int*)startOffset, (int*)endOffset);
|
||||||
@ -1304,6 +1371,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_textAfterOffset(
|
|||||||
long *endOffset,
|
long *endOffset,
|
||||||
BSTR *text)
|
BSTR *text)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (QAccessibleTextInterface *textIface = textInterface()) {
|
if (QAccessibleTextInterface *textIface = textInterface()) {
|
||||||
const QString txt = textIface->textAfterOffset(offset, (QAccessible2::BoundaryType)boundaryType, (int*)startOffset, (int*)endOffset);
|
const QString txt = textIface->textAfterOffset(offset, (QAccessible2::BoundaryType)boundaryType, (int*)startOffset, (int*)endOffset);
|
||||||
@ -1322,6 +1390,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_textAtOffset(long offset,
|
|||||||
long *endOffset,
|
long *endOffset,
|
||||||
BSTR *text)
|
BSTR *text)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (QAccessibleTextInterface *textIface = textInterface()) {
|
if (QAccessibleTextInterface *textIface = textInterface()) {
|
||||||
const QString txt = textIface->textAtOffset(offset, (QAccessible2::BoundaryType)boundaryType, (int*)startOffset, (int*)endOffset);
|
const QString txt = textIface->textAtOffset(offset, (QAccessible2::BoundaryType)boundaryType, (int*)startOffset, (int*)endOffset);
|
||||||
@ -1336,6 +1405,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_textAtOffset(long offset,
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::removeSelection(long selectionIndex)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::removeSelection(long selectionIndex)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (QAccessibleTextInterface *textIface = textInterface()) {
|
if (QAccessibleTextInterface *textIface = textInterface()) {
|
||||||
textIface->removeSelection(selectionIndex);
|
textIface->removeSelection(selectionIndex);
|
||||||
@ -1346,6 +1416,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::removeSelection(long selectionI
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::setCaretOffset(long offset)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::setCaretOffset(long offset)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (QAccessibleTextInterface *textIface = textInterface()) {
|
if (QAccessibleTextInterface *textIface = textInterface()) {
|
||||||
textIface->setCursorPosition(offset);
|
textIface->setCursorPosition(offset);
|
||||||
@ -1358,6 +1429,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::setSelection(long selectionInde
|
|||||||
long startOffset,
|
long startOffset,
|
||||||
long endOffset)
|
long endOffset)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (QAccessibleTextInterface *textIface = textInterface()) {
|
if (QAccessibleTextInterface *textIface = textInterface()) {
|
||||||
textIface->setSelection(selectionIndex, startOffset, endOffset);
|
textIface->setSelection(selectionIndex, startOffset, endOffset);
|
||||||
@ -1368,6 +1440,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::setSelection(long selectionInde
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_nCharacters(long *nCharacters)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_nCharacters(long *nCharacters)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (QAccessibleTextInterface *textIface = textInterface()) {
|
if (QAccessibleTextInterface *textIface = textInterface()) {
|
||||||
*nCharacters = textIface->characterCount();
|
*nCharacters = textIface->characterCount();
|
||||||
@ -1380,6 +1453,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::scrollSubstringTo(long startInd
|
|||||||
long endIndex,
|
long endIndex,
|
||||||
enum IA2ScrollType scrollType)
|
enum IA2ScrollType scrollType)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (QAccessibleTextInterface *textIface = textInterface()) {
|
if (QAccessibleTextInterface *textIface = textInterface()) {
|
||||||
Q_UNUSED(scrollType); //###
|
Q_UNUSED(scrollType); //###
|
||||||
@ -1421,8 +1495,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_oldText(IA2TextSegment *old
|
|||||||
**************************************************************/
|
**************************************************************/
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_currentValue(VARIANT *currentValue)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_currentValue(VARIANT *currentValue)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
if (QAccessibleValueInterface *valueIface = valueInterface()) {
|
if (QAccessibleValueInterface *valueIface = valueInterface()) {
|
||||||
const QVariant var = valueIface->currentValue();
|
const QVariant var = valueIface->currentValue();
|
||||||
@ -1436,8 +1511,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_currentValue(VARIANT *curre
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::setCurrentValue(VARIANT value)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::setCurrentValue(VARIANT value)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
HRESULT hr = S_FALSE;
|
HRESULT hr = S_FALSE;
|
||||||
if (QAccessibleValueInterface *valueIface = valueInterface()) {
|
if (QAccessibleValueInterface *valueIface = valueInterface()) {
|
||||||
@ -1452,8 +1528,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::setCurrentValue(VARIANT value)
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_maximumValue(VARIANT *maximumValue)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_maximumValue(VARIANT *maximumValue)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
if (QAccessibleValueInterface *valueIface = valueInterface()) {
|
if (QAccessibleValueInterface *valueIface = valueInterface()) {
|
||||||
const QVariant var = valueIface->maximumValue();
|
const QVariant var = valueIface->maximumValue();
|
||||||
@ -1466,8 +1543,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_maximumValue(VARIANT *maxim
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_minimumValue(VARIANT *minimumValue)
|
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_minimumValue(VARIANT *minimumValue)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
if (QAccessibleValueInterface *valueIface = valueInterface()) {
|
if (QAccessibleValueInterface *valueIface = valueInterface()) {
|
||||||
const QVariant var = valueIface->minimumValue();
|
const QVariant var = valueIface->minimumValue();
|
||||||
@ -1539,6 +1617,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::QueryService(REFGUID guidServic
|
|||||||
*/
|
*/
|
||||||
HRESULT QWindowsIA2Accessible::getRelationsHelper(IAccessibleRelation **relations, int startIndex, long maxRelations, long *nRelations /* = 0*/)
|
HRESULT QWindowsIA2Accessible::getRelationsHelper(IAccessibleRelation **relations, int startIndex, long maxRelations, long *nRelations /* = 0*/)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
if (nRelations)
|
if (nRelations)
|
||||||
*nRelations = 0;
|
*nRelations = 0;
|
||||||
typedef QPair<QAccessibleInterface *, QAccessible::Relation> RelationEntry;
|
typedef QPair<QAccessibleInterface *, QAccessible::Relation> RelationEntry;
|
||||||
@ -1588,37 +1667,6 @@ HRESULT QWindowsIA2Accessible::wrapListOfCells(const QList<QAccessibleInterface*
|
|||||||
return count > 0 ? S_OK : S_FALSE;
|
return count > 0 ? S_OK : S_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint QWindowsIA2Accessible::uniqueID() const
|
|
||||||
{
|
|
||||||
uint uid = 0;
|
|
||||||
if (QObject *obj = accessible->object())
|
|
||||||
uid = qHash(obj);
|
|
||||||
|
|
||||||
if (!uid) {
|
|
||||||
QAccessibleInterface *acc = accessible;
|
|
||||||
QVector<int> indexOfNodes;
|
|
||||||
while (acc && acc->isValid() && !acc->object()) {
|
|
||||||
QAccessibleInterface *par = acc->parent();
|
|
||||||
indexOfNodes.append(par->indexOfChild(acc));
|
|
||||||
if (acc != accessible)
|
|
||||||
delete acc;
|
|
||||||
acc = par;
|
|
||||||
}
|
|
||||||
if (acc) {
|
|
||||||
if (acc->object()) {
|
|
||||||
uid = qHash(acc->object());
|
|
||||||
for (int i = 0; i < indexOfNodes.count(); ++i)
|
|
||||||
uid = qHash(uid + indexOfNodes.at(i));
|
|
||||||
|
|
||||||
}
|
|
||||||
if (acc != accessible)
|
|
||||||
delete acc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return uid;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#define IF_EQUAL_RETURN_IIDSTRING(id, iid) if (id == iid) return QByteArray(#iid)
|
#define IF_EQUAL_RETURN_IIDSTRING(id, iid) if (id == iid) return QByteArray(#iid)
|
||||||
|
|
||||||
QByteArray QWindowsIA2Accessible::IIDToString(REFIID id)
|
QByteArray QWindowsIA2Accessible::IIDToString(REFIID id)
|
||||||
|
@ -132,7 +132,7 @@ public:
|
|||||||
|
|
||||||
/* IAccessibleTable2 */
|
/* IAccessibleTable2 */
|
||||||
HRESULT STDMETHODCALLTYPE get_cellAt( long row, long column, IUnknown **cell);
|
HRESULT STDMETHODCALLTYPE get_cellAt( long row, long column, IUnknown **cell);
|
||||||
HRESULT STDMETHODCALLTYPE get_caption( IUnknown **accessible);
|
HRESULT STDMETHODCALLTYPE get_caption( IUnknown **accessibleInterface);
|
||||||
HRESULT STDMETHODCALLTYPE get_columnDescription( long column, BSTR *description);
|
HRESULT STDMETHODCALLTYPE get_columnDescription( long column, BSTR *description);
|
||||||
HRESULT STDMETHODCALLTYPE get_nColumns( long *columnCount);
|
HRESULT STDMETHODCALLTYPE get_nColumns( long *columnCount);
|
||||||
HRESULT STDMETHODCALLTYPE get_nRows( long *rowCount);
|
HRESULT STDMETHODCALLTYPE get_nRows( long *rowCount);
|
||||||
@ -143,7 +143,7 @@ public:
|
|||||||
HRESULT STDMETHODCALLTYPE get_selectedCells( IUnknown ***cells, long *nSelectedCells);
|
HRESULT STDMETHODCALLTYPE get_selectedCells( IUnknown ***cells, long *nSelectedCells);
|
||||||
HRESULT STDMETHODCALLTYPE get_selectedColumns( long **selectedColumns, long *nColumns);
|
HRESULT STDMETHODCALLTYPE get_selectedColumns( long **selectedColumns, long *nColumns);
|
||||||
HRESULT STDMETHODCALLTYPE get_selectedRows( long **selectedRows, long *nRows);
|
HRESULT STDMETHODCALLTYPE get_selectedRows( long **selectedRows, long *nRows);
|
||||||
HRESULT STDMETHODCALLTYPE get_summary( IUnknown **accessible);
|
HRESULT STDMETHODCALLTYPE get_summary( IUnknown **accessibleInterface);
|
||||||
HRESULT STDMETHODCALLTYPE get_isColumnSelected( long column, boolean *isSelected);
|
HRESULT STDMETHODCALLTYPE get_isColumnSelected( long column, boolean *isSelected);
|
||||||
HRESULT STDMETHODCALLTYPE get_isRowSelected( long row, boolean *isSelected);
|
HRESULT STDMETHODCALLTYPE get_isRowSelected( long row, boolean *isSelected);
|
||||||
HRESULT STDMETHODCALLTYPE selectRow( long row);
|
HRESULT STDMETHODCALLTYPE selectRow( long row);
|
||||||
@ -206,22 +206,27 @@ public:
|
|||||||
/* private helper functions */
|
/* private helper functions */
|
||||||
private:
|
private:
|
||||||
inline QAccessibleTextInterface *textInterface() const {
|
inline QAccessibleTextInterface *textInterface() const {
|
||||||
return accessible->isValid() ? accessible->textInterface() : static_cast<QAccessibleTextInterface *>(0);
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
|
return accessible ? accessible->textInterface() : static_cast<QAccessibleTextInterface *>(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline QAccessibleActionInterface *actionInterface() const {
|
inline QAccessibleActionInterface *actionInterface() const {
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
return accessible->actionInterface();
|
return accessible->actionInterface();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline QAccessibleValueInterface *valueInterface() const {
|
inline QAccessibleValueInterface *valueInterface() const {
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
return accessible->valueInterface();
|
return accessible->valueInterface();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline QAccessibleTableInterface *tableInterface() const {
|
inline QAccessibleTableInterface *tableInterface() const {
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
return accessible->tableInterface();
|
return accessible->tableInterface();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline QAccessibleTableCellInterface *tableCellInterface() const {
|
inline QAccessibleTableCellInterface *tableCellInterface() const {
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
return accessible->tableCellInterface();
|
return accessible->tableCellInterface();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,6 +236,7 @@ private:
|
|||||||
\a x and \y (out) is in parent relative position if coordType == IA2_COORDTYPE_PARENT_RELATIVE
|
\a x and \y (out) is in parent relative position if coordType == IA2_COORDTYPE_PARENT_RELATIVE
|
||||||
*/
|
*/
|
||||||
void mapFromScreenPos(enum IA2CoordinateType coordType, const QPoint &screenPos, long *x, long *y) const {
|
void mapFromScreenPos(enum IA2CoordinateType coordType, const QPoint &screenPos, long *x, long *y) const {
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
if (coordType == IA2_COORDTYPE_PARENT_RELATIVE) {
|
if (coordType == IA2_COORDTYPE_PARENT_RELATIVE) {
|
||||||
// caller wants relative to parent
|
// caller wants relative to parent
|
||||||
if (QAccessibleInterface *parent = accessible->parent()) {
|
if (QAccessibleInterface *parent = accessible->parent()) {
|
||||||
@ -250,6 +256,7 @@ private:
|
|||||||
\return a screen relative position
|
\return a screen relative position
|
||||||
*/
|
*/
|
||||||
QPoint mapToScreenPos(enum IA2CoordinateType coordType, long x, long y) const {
|
QPoint mapToScreenPos(enum IA2CoordinateType coordType, long x, long y) const {
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
if (coordType == IA2_COORDTYPE_PARENT_RELATIVE) {
|
if (coordType == IA2_COORDTYPE_PARENT_RELATIVE) {
|
||||||
if (QAccessibleInterface *parent = accessible->parent()) {
|
if (QAccessibleInterface *parent = accessible->parent()) {
|
||||||
const QRect parentScreenRect = parent->rect();
|
const QRect parentScreenRect = parent->rect();
|
||||||
@ -261,7 +268,6 @@ private:
|
|||||||
|
|
||||||
HRESULT getRelationsHelper(IAccessibleRelation **relations, int startIndex, long maxRelations, long *nRelations = 0);
|
HRESULT getRelationsHelper(IAccessibleRelation **relations, int startIndex, long maxRelations, long *nRelations = 0);
|
||||||
HRESULT wrapListOfCells(const QList<QAccessibleInterface*> &inputCells, IUnknown ***outputAccessibles, long *nCellCount);
|
HRESULT wrapListOfCells(const QList<QAccessibleInterface*> &inputCells, IUnknown ***outputAccessibles, long *nCellCount);
|
||||||
uint uniqueID() const;
|
|
||||||
QByteArray IIDToString(REFIID id);
|
QByteArray IIDToString(REFIID id);
|
||||||
QString textForRange(int startOffset, int endOffset) const;
|
QString textForRange(int startOffset, int endOffset) const;
|
||||||
void replaceTextFallback(long startOffset, long endOffset, const QString &txt);
|
void replaceTextFallback(long startOffset, long endOffset, const QString &txt);
|
||||||
|
@ -86,14 +86,8 @@
|
|||||||
|
|
||||||
#include "../qtwindows_additional.h"
|
#include "../qtwindows_additional.h"
|
||||||
|
|
||||||
|
|
||||||
// This stuff is used for widgets/items with no window handle:
|
|
||||||
typedef QMap<int, QPair<QPointer<QObject>,int> > NotifyMap;
|
|
||||||
Q_GLOBAL_STATIC(NotifyMap, qAccessibleRecentSentEvents)
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\!internal
|
\!internal
|
||||||
\class QWindowsAccessibility
|
\class QWindowsAccessibility
|
||||||
@ -172,7 +166,6 @@ void QWindowsAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event)
|
|||||||
if (!iface) // ### This should not happen, maybe make it an assert.
|
if (!iface) // ### This should not happen, maybe make it an assert.
|
||||||
return;
|
return;
|
||||||
QWindow *window = QWindowsAccessibility::windowHelper(iface);
|
QWindow *window = QWindowsAccessibility::windowHelper(iface);
|
||||||
delete iface;
|
|
||||||
|
|
||||||
if (!window) {
|
if (!window) {
|
||||||
window = QGuiApplication::focusWindow();
|
window = QGuiApplication::focusWindow();
|
||||||
@ -185,27 +178,9 @@ void QWindowsAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event)
|
|||||||
return;
|
return;
|
||||||
HWND hWnd = (HWND)platform->nativeResourceForWindow("handle", window);
|
HWND hWnd = (HWND)platform->nativeResourceForWindow("handle", window);
|
||||||
|
|
||||||
static int eventNum = 0;
|
|
||||||
if (event->type() != QAccessible::MenuCommand && // MenuCommand is faked
|
if (event->type() != QAccessible::MenuCommand && // MenuCommand is faked
|
||||||
event->type() != QAccessible::ObjectDestroyed) {
|
event->type() != QAccessible::ObjectDestroyed) {
|
||||||
/* In some rare occasions, the server (Qt) might get a ::get_accChild call with a
|
::NotifyWinEvent(event->type(), hWnd, OBJID_CLIENT, QAccessible::uniqueId(iface));
|
||||||
childId that references an entry in the cache where there was a dangling
|
|
||||||
QObject-pointer. Previously we crashed on this.
|
|
||||||
|
|
||||||
There is no point in actually notifying the AT client that the object got destroyed,
|
|
||||||
because the AT client won't query for get_accChild if the event is ObjectDestroyed
|
|
||||||
anyway, and we have no other way of mapping the eventId argument to the actual
|
|
||||||
child/descendant object. (Firefox seems to simply completely ignore
|
|
||||||
EVENT_OBJECT_DESTROY).
|
|
||||||
|
|
||||||
We therefore guard each QObject in the cache with a QPointer, and only notify the AT
|
|
||||||
client if the type is not ObjectDestroyed.
|
|
||||||
*/
|
|
||||||
eventNum %= 50; //[0..49]
|
|
||||||
int eventId = - (eventNum - 1);
|
|
||||||
qAccessibleRecentSentEvents()->insert(eventId, qMakePair(QPointer<QObject>(event->object()), event->child()));
|
|
||||||
::NotifyWinEvent(event->type(), hWnd, OBJID_CLIENT, eventId);
|
|
||||||
++eventNum;
|
|
||||||
}
|
}
|
||||||
#endif // Q_OS_WINCE
|
#endif // Q_OS_WINCE
|
||||||
}
|
}
|
||||||
@ -218,7 +193,6 @@ QWindow *QWindowsAccessibility::windowHelper(const QAccessibleInterface *iface)
|
|||||||
while (acc && acc->isValid() && !window) {
|
while (acc && acc->isValid() && !window) {
|
||||||
window = acc->window();
|
window = acc->window();
|
||||||
QAccessibleInterface *par = acc->parent();
|
QAccessibleInterface *par = acc->parent();
|
||||||
delete acc;
|
|
||||||
acc = par;
|
acc = par;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -233,6 +207,11 @@ IAccessible *QWindowsAccessibility::wrap(QAccessibleInterface *acc)
|
|||||||
{
|
{
|
||||||
if (!acc)
|
if (!acc)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
// ### FIXME: maybe we should accept double insertions into the cache
|
||||||
|
if (!QAccessible::uniqueId(acc))
|
||||||
|
QAccessible::registerAccessibleInterface(acc);
|
||||||
|
|
||||||
#ifdef Q_CC_MINGW
|
#ifdef Q_CC_MINGW
|
||||||
QWindowsMsaaAccessible *wacc = new QWindowsMsaaAccessible(acc);
|
QWindowsMsaaAccessible *wacc = new QWindowsMsaaAccessible(acc);
|
||||||
#else
|
#else
|
||||||
@ -243,15 +222,6 @@ IAccessible *QWindowsAccessibility::wrap(QAccessibleInterface *acc)
|
|||||||
return iacc;
|
return iacc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
\internal
|
|
||||||
*/
|
|
||||||
QPair<QObject*, int> QWindowsAccessibility::getCachedObject(int entryId)
|
|
||||||
{
|
|
||||||
QPair<QPointer<QObject>, int> pair = qAccessibleRecentSentEvents()->value(entryId);
|
|
||||||
return qMakePair(pair.first.data(), pair.second);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
void QWindowsAccessibility::setRootObject(QObject *o)
|
void QWindowsAccessibility::setRootObject(QObject *o)
|
||||||
{
|
{
|
||||||
@ -304,8 +274,6 @@ bool QWindowsAccessibility::handleAccessibleObjectFromWindowRequest(HWND hwnd, W
|
|||||||
iface->Release(); // the client will release the object again, and then it will destroy itself
|
iface->Release(); // the client will release the object again, and then it will destroy itself
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
delete acc;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,8 +63,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
static IAccessible *wrap(QAccessibleInterface *acc);
|
static IAccessible *wrap(QAccessibleInterface *acc);
|
||||||
static QWindow *windowHelper(const QAccessibleInterface *iface);
|
static QWindow *windowHelper(const QAccessibleInterface *iface);
|
||||||
|
|
||||||
static QPair<QObject*, int> getCachedObject(int entryId);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -186,21 +186,6 @@ HRESULT STDMETHODCALLTYPE QWindowsEnumerate::Skip(unsigned long celt)
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool compareAccessible(QAccessibleInterface *one, QAccessibleInterface *other)
|
|
||||||
{
|
|
||||||
if (one == other) return true;
|
|
||||||
if (!one || !other) return false;
|
|
||||||
|
|
||||||
if (one->object() && other->object() && (one->object() == other->object()))
|
|
||||||
return true;
|
|
||||||
QAIPointer onePar(one->parent());
|
|
||||||
QAIPointer otherPar(other->parent());
|
|
||||||
|
|
||||||
if (compareAccessible(onePar.data(), otherPar.data()))
|
|
||||||
return onePar->indexOfChild(one) == otherPar->indexOfChild(other);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef QT_NO_DEBUG
|
#ifndef QT_NO_DEBUG
|
||||||
bool debug_accessibility()
|
bool debug_accessibility()
|
||||||
{
|
{
|
||||||
@ -232,7 +217,9 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::QueryInterface(REFIID id, LPVO
|
|||||||
|
|
||||||
QByteArray strIID = IIDToString(id);
|
QByteArray strIID = IIDToString(id);
|
||||||
if (!strIID.isEmpty()) {
|
if (!strIID.isEmpty()) {
|
||||||
QString ss; QDebug dbg(&ss); dbg << accessible;
|
QString ss;
|
||||||
|
QDebug dbg(&ss);
|
||||||
|
dbg << accessibleInterface();
|
||||||
accessibleDebug("QWindowsIA2Accessible::QI() - IID:%s, iface:%s ", strIID.constData(), qPrintable(ss));
|
accessibleDebug("QWindowsIA2Accessible::QI() - IID:%s, iface:%s ", strIID.constData(), qPrintable(ss));
|
||||||
}
|
}
|
||||||
if (id == IID_IUnknown) {
|
if (id == IID_IUnknown) {
|
||||||
@ -533,8 +520,9 @@ IAccessible::accHitTest documents the value returned in pvarID like this:
|
|||||||
*/
|
*/
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accHitTest(long xLeft, long yTop, VARIANT *pvarID)
|
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accHitTest(long xLeft, long yTop, VARIANT *pvarID)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
QAccessibleInterface *child = accessible->childAt(xLeft, yTop);
|
QAccessibleInterface *child = accessible->childAt(xLeft, yTop);
|
||||||
@ -571,14 +559,15 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accHitTest(long xLeft, long yT
|
|||||||
// moz: [important]
|
// moz: [important]
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accLocation(long *pxLeft, long *pyTop, long *pcxWidth, long *pcyHeight, VARIANT varID)
|
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accLocation(long *pxLeft, long *pyTop, long *pcxWidth, long *pcyHeight, VARIANT varID)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
QRect rect;
|
QRect rect;
|
||||||
if (varID.lVal) {
|
if (varID.lVal) {
|
||||||
QAIPointer child(childPointer(varID));
|
QAccessibleInterface *child = accessible->child(varID.lVal - 1);
|
||||||
if (!child)
|
if (!child || !child->isValid())
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
rect = child->rect();
|
rect = child->rect();
|
||||||
} else {
|
} else {
|
||||||
@ -596,8 +585,9 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accLocation(long *pxLeft, long
|
|||||||
// moz: [important, but no need to implement up/down/left/right]
|
// moz: [important, but no need to implement up/down/left/right]
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accNavigate(long navDir, VARIANT varStart, VARIANT *pvarEnd)
|
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accNavigate(long navDir, VARIANT varStart, VARIANT *pvarEnd)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
QAccessibleInterface *acc = 0;
|
QAccessibleInterface *acc = 0;
|
||||||
@ -617,7 +607,6 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accNavigate(long navDir, VARIA
|
|||||||
index += (navDir == NAVDIR_NEXT) ? 1 : -1;
|
index += (navDir == NAVDIR_NEXT) ? 1 : -1;
|
||||||
if (index >= 0 && index < parent->childCount())
|
if (index >= 0 && index < parent->childCount())
|
||||||
acc = parent->child(index);
|
acc = parent->child(index);
|
||||||
delete parent;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int index = varStart.lVal;
|
int index = varStart.lVal;
|
||||||
@ -646,7 +635,6 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accNavigate(long navDir, VARIA
|
|||||||
Q_ASSERT(sibling);
|
Q_ASSERT(sibling);
|
||||||
if (i == indexOfOurself || sibling->state().invisible) {
|
if (i == indexOfOurself || sibling->state().invisible) {
|
||||||
//ignore ourself and invisible siblings
|
//ignore ourself and invisible siblings
|
||||||
delete sibling;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -660,7 +648,6 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accNavigate(long navDir, VARIA
|
|||||||
startp = QPoint(startg.left(), startg.top() + startg.height() / 2);
|
startp = QPoint(startg.left(), startg.top() + startg.height() / 2);
|
||||||
sibp = QPoint(sibg.right(), sibg.top() + sibg.height() / 2);
|
sibp = QPoint(sibg.right(), sibg.top() + sibg.height() / 2);
|
||||||
if (QPoint(sibc - startc).x() >= 0) {
|
if (QPoint(sibc - startc).x() >= 0) {
|
||||||
delete sibling;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
distp = sibp - startp;
|
distp = sibp - startp;
|
||||||
@ -669,7 +656,6 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accNavigate(long navDir, VARIA
|
|||||||
startp = QPoint(startg.right(), startg.top() + startg.height() / 2);
|
startp = QPoint(startg.right(), startg.top() + startg.height() / 2);
|
||||||
sibp = QPoint(sibg.left(), sibg.top() + sibg.height() / 2);
|
sibp = QPoint(sibg.left(), sibg.top() + sibg.height() / 2);
|
||||||
if (QPoint(sibc - startc).x() <= 0) {
|
if (QPoint(sibc - startc).x() <= 0) {
|
||||||
delete sibling;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
distp = sibp - startp;
|
distp = sibp - startp;
|
||||||
@ -678,7 +664,6 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accNavigate(long navDir, VARIA
|
|||||||
startp = QPoint(startg.left() + startg.width() / 2, startg.top());
|
startp = QPoint(startg.left() + startg.width() / 2, startg.top());
|
||||||
sibp = QPoint(sibg.left() + sibg.width() / 2, sibg.bottom());
|
sibp = QPoint(sibg.left() + sibg.width() / 2, sibg.bottom());
|
||||||
if (QPoint(sibc - startc).y() >= 0) {
|
if (QPoint(sibc - startc).y() >= 0) {
|
||||||
delete sibling;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
distp = sibp - startp;
|
distp = sibp - startp;
|
||||||
@ -687,7 +672,6 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accNavigate(long navDir, VARIA
|
|||||||
startp = QPoint(startg.left() + startg.width() / 2, startg.bottom());
|
startp = QPoint(startg.left() + startg.width() / 2, startg.bottom());
|
||||||
sibp = QPoint(sibg.left() + sibg.width() / 2, sibg.top());
|
sibp = QPoint(sibg.left() + sibg.width() / 2, sibg.top());
|
||||||
if (QPoint(sibc - startc).y() <= 0) {
|
if (QPoint(sibc - startc).y() <= 0) {
|
||||||
delete sibling;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
distp = sibp - startp;
|
distp = sibp - startp;
|
||||||
@ -700,14 +684,10 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accNavigate(long navDir, VARIA
|
|||||||
// squared distance, (thus, no need to take the sqrt()).
|
// squared distance, (thus, no need to take the sqrt()).
|
||||||
unsigned dist = distp.x() * distp.x() + distp.y() * distp.y();
|
unsigned dist = distp.x() * distp.x() + distp.y() * distp.y();
|
||||||
if (dist < mindist) {
|
if (dist < mindist) {
|
||||||
delete candidate;
|
|
||||||
candidate = sibling;
|
candidate = sibling;
|
||||||
mindist = dist;
|
mindist = dist;
|
||||||
} else {
|
|
||||||
delete sibling;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete pIface;
|
|
||||||
acc = candidate;
|
acc = candidate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -724,9 +704,6 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accNavigate(long navDir, VARIA
|
|||||||
(*pvarEnd).vt = VT_DISPATCH;
|
(*pvarEnd).vt = VT_DISPATCH;
|
||||||
(*pvarEnd).pdispVal = iface;
|
(*pvarEnd).pdispVal = iface;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
} else {
|
|
||||||
if (acc != accessible)
|
|
||||||
delete acc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
(*pvarEnd).vt = VT_EMPTY;
|
(*pvarEnd).vt = VT_EMPTY;
|
||||||
@ -736,8 +713,9 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accNavigate(long navDir, VARIA
|
|||||||
// moz: [important]
|
// moz: [important]
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accChild(VARIANT varChildID, IDispatch** ppdispChild)
|
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accChild(VARIANT varChildID, IDispatch** ppdispChild)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
if (varChildID.vt != VT_I4)
|
if (varChildID.vt != VT_I4)
|
||||||
@ -745,38 +723,18 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accChild(VARIANT varChildI
|
|||||||
|
|
||||||
|
|
||||||
int childIndex = varChildID.lVal;
|
int childIndex = varChildID.lVal;
|
||||||
|
|
||||||
QAccessibleInterface *acc = 0;
|
QAccessibleInterface *acc = 0;
|
||||||
|
|
||||||
if (childIndex < 0) {
|
|
||||||
const int entry = childIndex;
|
if (childIndex == 0) {
|
||||||
QPair<QObject*, int> ref = QWindowsAccessibility::getCachedObject(entry);
|
// Yes, some AT clients (Active Accessibility Object Inspector)
|
||||||
if (ref.first) {
|
// actually ask for the same object. As a consequence, we need to clone ourselves:
|
||||||
acc = QAccessible::queryAccessibleInterface(ref.first);
|
acc = accessible;
|
||||||
if (acc && ref.second >= 0) {
|
} else if (childIndex < 0) {
|
||||||
QAccessibleInterface *res = acc->child(ref.second);
|
acc = QAccessible::accessibleInterface((QAccessible::Id)childIndex);
|
||||||
delete acc;
|
|
||||||
if (!res)
|
|
||||||
return E_INVALIDARG;
|
|
||||||
acc = res;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
qWarning("get_accChild got a negative varChildID (%d), but did not find it in cache", childIndex);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (childIndex) {
|
acc = accessible->child(childIndex - 1);
|
||||||
acc = accessible->child(childIndex - 1);
|
|
||||||
} else {
|
|
||||||
// Yes, some AT clients (Active Accessibility Object Inspector)
|
|
||||||
// actually ask for the same object. As a consequence, we need to clone ourselves:
|
|
||||||
if (QAccessibleInterface *par = accessible->parent()) {
|
|
||||||
const int indexOf = par->indexOfChild(accessible);
|
|
||||||
if (indexOf == -1)
|
|
||||||
qWarning() << "inconsistent hierarchy, parent:" << par << "child:" << accessible;
|
|
||||||
else
|
|
||||||
acc = par->child(indexOf);
|
|
||||||
delete par;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (acc) {
|
if (acc) {
|
||||||
@ -790,8 +748,9 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accChild(VARIANT varChildI
|
|||||||
// moz: [important]
|
// moz: [important]
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accChildCount(long* pcountChildren)
|
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accChildCount(long* pcountChildren)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
*pcountChildren = accessible->childCount();
|
*pcountChildren = accessible->childCount();
|
||||||
@ -801,8 +760,9 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accChildCount(long* pcount
|
|||||||
// moz: [important]
|
// moz: [important]
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accParent(IDispatch** ppdispParent)
|
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accParent(IDispatch** ppdispParent)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
QAccessibleInterface *acc = accessible->parent();
|
QAccessibleInterface *acc = accessible->parent();
|
||||||
@ -810,8 +770,6 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accParent(IDispatch** ppdi
|
|||||||
if (IAccessible *iface = QWindowsAccessibility::wrap(acc)) {
|
if (IAccessible *iface = QWindowsAccessibility::wrap(acc)) {
|
||||||
*ppdispParent = iface;
|
*ppdispParent = iface;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
} else {
|
|
||||||
delete acc;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -825,8 +783,9 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accParent(IDispatch** ppdi
|
|||||||
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accDoDefaultAction(VARIANT varID)
|
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accDoDefaultAction(VARIANT varID)
|
||||||
{
|
{
|
||||||
Q_UNUSED(varID);
|
Q_UNUSED(varID);
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
if (QAccessibleActionInterface *actionIface = accessible->actionInterface()) {
|
if (QAccessibleActionInterface *actionIface = accessible->actionInterface()) {
|
||||||
@ -842,8 +801,9 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accDoDefaultAction(VARIANT var
|
|||||||
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accDefaultAction(VARIANT varID, BSTR* pszDefaultAction)
|
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accDefaultAction(VARIANT varID, BSTR* pszDefaultAction)
|
||||||
{
|
{
|
||||||
Q_UNUSED(varID);
|
Q_UNUSED(varID);
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
*pszDefaultAction = 0;
|
*pszDefaultAction = 0;
|
||||||
@ -857,14 +817,15 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accDefaultAction(VARIANT v
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accDescription(VARIANT varID, BSTR* pszDescription)
|
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accDescription(VARIANT varID, BSTR* pszDescription)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
|
|
||||||
QString descr;
|
QString descr;
|
||||||
if (varID.lVal) {
|
if (varID.lVal) {
|
||||||
QAIPointer child = childPointer(varID);
|
QAccessibleInterface *child = childPointer(varID);
|
||||||
if (!child)
|
if (!child)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
descr = child->text(QAccessible::Description);
|
descr = child->text(QAccessible::Description);
|
||||||
@ -882,13 +843,14 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accDescription(VARIANT var
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accHelp(VARIANT varID, BSTR *pszHelp)
|
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accHelp(VARIANT varID, BSTR *pszHelp)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
QString help;
|
QString help;
|
||||||
if (varID.lVal) {
|
if (varID.lVal) {
|
||||||
QAIPointer child = childPointer(varID);
|
QAccessibleInterface *child = childPointer(varID);
|
||||||
if (!child)
|
if (!child)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
help = child->text(QAccessible::Help);
|
help = child->text(QAccessible::Help);
|
||||||
@ -912,8 +874,9 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accHelpTopic(BSTR *, VARIA
|
|||||||
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accKeyboardShortcut(VARIANT varID, BSTR *pszKeyboardShortcut)
|
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accKeyboardShortcut(VARIANT varID, BSTR *pszKeyboardShortcut)
|
||||||
{
|
{
|
||||||
Q_UNUSED(varID);
|
Q_UNUSED(varID);
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
*pszKeyboardShortcut = 0;
|
*pszKeyboardShortcut = 0;
|
||||||
@ -933,29 +896,26 @@ static QAccessibleInterface *relatedInterface(QAccessibleInterface *iface, QAcce
|
|||||||
typedef QPair<QAccessibleInterface *, QAccessible::Relation> RelationPair;
|
typedef QPair<QAccessibleInterface *, QAccessible::Relation> RelationPair;
|
||||||
QVector<RelationPair> rels = iface->relations(flag);
|
QVector<RelationPair> rels = iface->relations(flag);
|
||||||
|
|
||||||
for (int i = 1; i < rels.count(); ++i)
|
|
||||||
delete rels.at(i).first;
|
|
||||||
|
|
||||||
return rels.value(0).first;
|
return rels.value(0).first;
|
||||||
}
|
}
|
||||||
|
|
||||||
// moz: [important]
|
// moz: [important]
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accName(VARIANT varID, BSTR* pszName)
|
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accName(VARIANT varID, BSTR* pszName)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
QString name;
|
QString name;
|
||||||
if (varID.lVal) {
|
if (varID.lVal) {
|
||||||
QAIPointer child = childPointer(varID);
|
QAccessibleInterface *child = childPointer(varID);
|
||||||
if (!child)
|
if (!child)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
name = child->text(QAccessible::Name);
|
name = child->text(QAccessible::Name);
|
||||||
if (name.isEmpty()) {
|
if (name.isEmpty()) {
|
||||||
if (QAccessibleInterface *labelInterface = relatedInterface(child.data(), QAccessible::Label)) {
|
if (QAccessibleInterface *labelInterface = relatedInterface(child, QAccessible::Label)) {
|
||||||
name = labelInterface->text(QAccessible::Name);
|
name = labelInterface->text(QAccessible::Name);
|
||||||
delete labelInterface;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -963,7 +923,6 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accName(VARIANT varID, BST
|
|||||||
if (name.isEmpty()) {
|
if (name.isEmpty()) {
|
||||||
if (QAccessibleInterface *labelInterface = relatedInterface(accessible, QAccessible::Label)) {
|
if (QAccessibleInterface *labelInterface = relatedInterface(accessible, QAccessible::Label)) {
|
||||||
name = labelInterface->text(QAccessible::Name);
|
name = labelInterface->text(QAccessible::Name);
|
||||||
delete labelInterface;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -978,6 +937,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accName(VARIANT varID, BST
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::put_accName(VARIANT, BSTR)
|
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::put_accName(VARIANT, BSTR)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
return DISP_E_MEMBERNOTFOUND;
|
return DISP_E_MEMBERNOTFOUND;
|
||||||
}
|
}
|
||||||
@ -985,13 +945,14 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::put_accName(VARIANT, BSTR)
|
|||||||
// moz: [important]
|
// moz: [important]
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accRole(VARIANT varID, VARIANT *pvarRole)
|
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accRole(VARIANT varID, VARIANT *pvarRole)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
QAccessible::Role role;
|
QAccessible::Role role;
|
||||||
if (varID.lVal) {
|
if (varID.lVal) {
|
||||||
QAIPointer child = childPointer(varID);
|
QAccessibleInterface *child = childPointer(varID);
|
||||||
if (!child)
|
if (!child)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
role = child->role();
|
role = child->role();
|
||||||
@ -1019,14 +980,15 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accRole(VARIANT varID, VAR
|
|||||||
// moz: [important]
|
// moz: [important]
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accState(VARIANT varID, VARIANT *pvarState)
|
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accState(VARIANT varID, VARIANT *pvarState)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
QAccessible::State state;
|
QAccessible::State state;
|
||||||
if (varID.lVal) {
|
if (varID.lVal) {
|
||||||
QAIPointer child = childPointer(varID);
|
QAccessibleInterface *child = childPointer(varID);
|
||||||
if (!child.data())
|
if (!child)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
state = child->state();
|
state = child->state();
|
||||||
} else {
|
} else {
|
||||||
@ -1095,11 +1057,12 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accState(VARIANT varID, VA
|
|||||||
// moz: [important]
|
// moz: [important]
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accValue(VARIANT varID, BSTR* pszValue)
|
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accValue(VARIANT varID, BSTR* pszValue)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (varID.vt != VT_I4)
|
if (varID.vt != VT_I4)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
|
||||||
if (!accessible->isValid() || varID.lVal) {
|
if (!accessible || !accessible->isValid() || varID.lVal) {
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1121,6 +1084,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accValue(VARIANT varID, BS
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::put_accValue(VARIANT, BSTR)
|
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::put_accValue(VARIANT, BSTR)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
return DISP_E_MEMBERNOTFOUND;
|
return DISP_E_MEMBERNOTFOUND;
|
||||||
}
|
}
|
||||||
@ -1130,8 +1094,9 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accSelect(long flagsSelect, VA
|
|||||||
{
|
{
|
||||||
Q_UNUSED(flagsSelect);
|
Q_UNUSED(flagsSelect);
|
||||||
Q_UNUSED(varID);
|
Q_UNUSED(varID);
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
bool res = false;
|
bool res = false;
|
||||||
@ -1141,17 +1106,17 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accSelect(long flagsSelect, VA
|
|||||||
|
|
||||||
### and if there are no ia2 interfaces we should do nothing??
|
### and if there are no ia2 interfaces we should do nothing??
|
||||||
if (flagsSelect & SELFLAG_TAKEFOCUS)
|
if (flagsSelect & SELFLAG_TAKEFOCUS)
|
||||||
res = accessible->doAction(SetFocus, varID.lVal, QVariantList());
|
res = accessible()->doAction(SetFocus, varID.lVal, QVariantList());
|
||||||
if (flagsSelect & SELFLAG_TAKESELECTION) {
|
if (flagsSelect & SELFLAG_TAKESELECTION) {
|
||||||
accessible->doAction(ClearSelection, 0, QVariantList());
|
accessible()->doAction(ClearSelection, 0, QVariantList());
|
||||||
res = accessible->doAction(AddToSelection, varID.lVal, QVariantList());
|
res = accessible()->doAction(AddToSelection, varID.lVal, QVariantList());
|
||||||
}
|
}
|
||||||
if (flagsSelect & SELFLAG_EXTENDSELECTION)
|
if (flagsSelect & SELFLAG_EXTENDSELECTION)
|
||||||
res = accessible->doAction(ExtendSelection, varID.lVal, QVariantList());
|
res = accessible()->doAction(ExtendSelection, varID.lVal, QVariantList());
|
||||||
if (flagsSelect & SELFLAG_ADDSELECTION)
|
if (flagsSelect & SELFLAG_ADDSELECTION)
|
||||||
res = accessible->doAction(AddToSelection, varID.lVal, QVariantList());
|
res = accessible()->doAction(AddToSelection, varID.lVal, QVariantList());
|
||||||
if (flagsSelect & SELFLAG_REMOVESELECTION)
|
if (flagsSelect & SELFLAG_REMOVESELECTION)
|
||||||
res = accessible->doAction(RemoveSelection, varID.lVal, QVariantList());
|
res = accessible()->doAction(RemoveSelection, varID.lVal, QVariantList());
|
||||||
*/
|
*/
|
||||||
return res ? S_OK : S_FALSE;
|
return res ? S_OK : S_FALSE;
|
||||||
}
|
}
|
||||||
@ -1174,15 +1139,15 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accSelect(long flagsSelect, VA
|
|||||||
*/
|
*/
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accFocus(VARIANT *pvarID)
|
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accFocus(VARIANT *pvarID)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
if (QAccessibleInterface *acc = accessible->focusChild()) {
|
if (QAccessibleInterface *acc = accessible->focusChild()) {
|
||||||
if (compareAccessible(acc, accessible)) {
|
if (acc == accessible) {
|
||||||
(*pvarID).vt = VT_I4;
|
(*pvarID).vt = VT_I4;
|
||||||
(*pvarID).lVal = CHILDID_SELF;
|
(*pvarID).lVal = CHILDID_SELF;
|
||||||
delete acc;
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
} else {
|
} else {
|
||||||
if (IAccessible *iface = QWindowsAccessibility::wrap(acc)) {
|
if (IAccessible *iface = QWindowsAccessibility::wrap(acc)) {
|
||||||
@ -1191,7 +1156,6 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accFocus(VARIANT *pvarID)
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete acc;
|
|
||||||
}
|
}
|
||||||
(*pvarID).vt = VT_EMPTY;
|
(*pvarID).vt = VT_EMPTY;
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
@ -1199,8 +1163,9 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accFocus(VARIANT *pvarID)
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accSelection(VARIANT *pvarChildren)
|
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accSelection(VARIANT *pvarChildren)
|
||||||
{
|
{
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
int cc = accessible->childCount();
|
int cc = accessible->childCount();
|
||||||
@ -1211,7 +1176,6 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accSelection(VARIANT *pvar
|
|||||||
QAccessibleInterface *child = accessible->child(i);
|
QAccessibleInterface *child = accessible->child(i);
|
||||||
if (child) {
|
if (child) {
|
||||||
isSelected = child->state().selected;
|
isSelected = child->state().selected;
|
||||||
delete child;
|
|
||||||
}
|
}
|
||||||
if (isSelected)
|
if (isSelected)
|
||||||
sel[selIndex++] = i+1;
|
sel[selIndex++] = i+1;
|
||||||
@ -1241,11 +1205,10 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accSelection(VARIANT *pvar
|
|||||||
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::GetWindow(HWND *phwnd)
|
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::GetWindow(HWND *phwnd)
|
||||||
{
|
{
|
||||||
*phwnd = 0;
|
*phwnd = 0;
|
||||||
|
QAccessibleInterface *accessible = accessibleInterface();
|
||||||
accessibleDebugClientCalls(accessible);
|
accessibleDebugClientCalls(accessible);
|
||||||
if (!accessible->isValid())
|
if (!accessible)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
if (!accessible->isValid())
|
|
||||||
return E_UNEXPECTED;
|
|
||||||
|
|
||||||
QWindow *window = QWindowsAccessibility::windowHelper(accessible);
|
QWindow *window = QWindowsAccessibility::windowHelper(accessible);
|
||||||
if (!window)
|
if (!window)
|
||||||
|
@ -76,8 +76,6 @@ void accessibleDebugClientCalls_helper(const char* funcName, const QAccessibleIn
|
|||||||
# define accessibleDebugClientCalls(iface)
|
# define accessibleDebugClientCalls(iface)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef QSharedPointer<QAccessibleInterface> QAIPointer;
|
|
||||||
|
|
||||||
QWindow *window_helper(const QAccessibleInterface *iface);
|
QWindow *window_helper(const QAccessibleInterface *iface);
|
||||||
|
|
||||||
/**************************************************************\
|
/**************************************************************\
|
||||||
@ -93,14 +91,13 @@ class QWindowsMsaaAccessible : public
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QWindowsMsaaAccessible(QAccessibleInterface *a)
|
QWindowsMsaaAccessible(QAccessibleInterface *a)
|
||||||
: accessible(a)
|
: ref(0)
|
||||||
, ref(0)
|
|
||||||
{
|
{
|
||||||
|
id = QAccessible::uniqueId(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~QWindowsMsaaAccessible()
|
virtual ~QWindowsMsaaAccessible()
|
||||||
{
|
{
|
||||||
delete accessible;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* IUnknown */
|
/* IUnknown */
|
||||||
@ -146,11 +143,23 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual QByteArray IIDToString(REFIID id);
|
virtual QByteArray IIDToString(REFIID id);
|
||||||
|
|
||||||
QAccessibleInterface *accessible;
|
QAccessible::Id id;
|
||||||
|
|
||||||
QAIPointer childPointer(VARIANT varID)
|
QAccessibleInterface *accessibleInterface() const
|
||||||
{
|
{
|
||||||
return QAIPointer(accessible->child(varID.lVal - 1));
|
QAccessibleInterface *iface = QAccessible::accessibleInterface(id);
|
||||||
|
if (iface && iface->isValid())
|
||||||
|
return iface;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
QAccessibleInterface *childPointer(VARIANT varID)
|
||||||
|
{
|
||||||
|
// -1 since windows API always uses 1 for the first child
|
||||||
|
QAccessibleInterface *iface = accessibleInterface();
|
||||||
|
if (iface)
|
||||||
|
return accessibleInterface()->child(varID.lVal - 1);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -229,7 +229,7 @@ public:
|
|||||||
{ viewItems[item].height = 0; }
|
{ viewItems[item].height = 0; }
|
||||||
|
|
||||||
inline int accessibleTable2Index(const QModelIndex &index) const {
|
inline int accessibleTable2Index(const QModelIndex &index) const {
|
||||||
return (viewIndex(index) + (header ? 1 : 0)) * model->columnCount()+index.column() + 1;
|
return (viewIndex(index) + (header ? 1 : 0)) * model->columnCount()+index.column();
|
||||||
}
|
}
|
||||||
|
|
||||||
// used for spanning rows
|
// used for spanning rows
|
||||||
|
@ -92,7 +92,6 @@ bool isInstanceOf(QObject *obj, QAccessible::Role role)
|
|||||||
bool match = false;
|
bool match = false;
|
||||||
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(obj);
|
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(obj);
|
||||||
match = iface && iface->role() == role;
|
match = iface && iface->role() == role;
|
||||||
delete iface;
|
|
||||||
return match;
|
return match;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,6 @@ public:
|
|||||||
void WidgetNavigator::printAll(QWidget *widget)
|
void WidgetNavigator::printAll(QWidget *widget)
|
||||||
{
|
{
|
||||||
QAccessibleInterface * const iface = QAccessible::queryAccessibleInterface(widget);
|
QAccessibleInterface * const iface = QAccessible::queryAccessibleInterface(widget);
|
||||||
deleteInDestructor(iface);
|
|
||||||
printAll(iface);
|
printAll(iface);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,7 +96,6 @@ void WidgetNavigator::printAll(QAccessibleInterface *interface)
|
|||||||
QAccessibleInterface *WidgetNavigator::find(QAccessible::Text textType, const QString &text, QWidget *start)
|
QAccessibleInterface *WidgetNavigator::find(QAccessible::Text textType, const QString &text, QWidget *start)
|
||||||
{
|
{
|
||||||
QAccessibleInterface *const iface = QAccessible::queryAccessibleInterface(start);
|
QAccessibleInterface *const iface = QAccessible::queryAccessibleInterface(start);
|
||||||
deleteInDestructor(iface);
|
|
||||||
return find(textType, text, iface);
|
return find(textType, text, iface);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,18 +125,12 @@ QAccessibleInterface *WidgetNavigator::recursiveSearch(TestBase *test, QAccessib
|
|||||||
QAccessibleInterface *childInterface = testInterface->child(i);
|
QAccessibleInterface *childInterface = testInterface->child(i);
|
||||||
if (childInterface) {
|
if (childInterface) {
|
||||||
todoInterfaces.push(childInterface);
|
todoInterfaces.push(childInterface);
|
||||||
deleteInDestructor(childInterface);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WidgetNavigator::deleteInDestructor(QAccessibleInterface *interface)
|
|
||||||
{
|
|
||||||
interfaces.insert(interface);
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget *WidgetNavigator::getWidget(QAccessibleInterface *interface)
|
QWidget *WidgetNavigator::getWidget(QAccessibleInterface *interface)
|
||||||
{
|
{
|
||||||
return qobject_cast<QWidget *>(interface->object());
|
return qobject_cast<QWidget *>(interface->object());
|
||||||
@ -146,9 +138,6 @@ QWidget *WidgetNavigator::getWidget(QAccessibleInterface *interface)
|
|||||||
|
|
||||||
WidgetNavigator::~WidgetNavigator()
|
WidgetNavigator::~WidgetNavigator()
|
||||||
{
|
{
|
||||||
foreach(QAccessibleInterface *interface, interfaces) {
|
|
||||||
delete interface;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -76,7 +76,6 @@ public:
|
|||||||
|
|
||||||
QAccessibleInterface *recursiveSearch(TestBase *test, QAccessibleInterface *iface);
|
QAccessibleInterface *recursiveSearch(TestBase *test, QAccessibleInterface *iface);
|
||||||
|
|
||||||
void deleteInDestructor(QAccessibleInterface * interface);
|
|
||||||
static QWidget *getWidget(QAccessibleInterface *interface);
|
static QWidget *getWidget(QAccessibleInterface *interface);
|
||||||
private:
|
private:
|
||||||
QSet<QAccessibleInterface *> interfaces;
|
QSet<QAccessibleInterface *> interfaces;
|
||||||
|
@ -68,7 +68,8 @@
|
|||||||
# undef interface
|
# undef interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <QtGui/private/qaccessible2_p.h>
|
||||||
|
#include <QtWidgets/private/qaccessiblewidget_p.h>
|
||||||
#include "QtTest/qtestaccessible.h"
|
#include "QtTest/qtestaccessible.h"
|
||||||
|
|
||||||
// Make a widget frameless to prevent size constraints of title bars
|
// Make a widget frameless to prevent size constraints of title bars
|
||||||
@ -95,8 +96,6 @@ inline bool IsValidCEPlatform() {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef QSharedPointer<QAccessibleInterface> QAIPtr;
|
|
||||||
|
|
||||||
static inline bool verifyChild(QWidget *child, QAccessibleInterface *interface,
|
static inline bool verifyChild(QWidget *child, QAccessibleInterface *interface,
|
||||||
int index, const QRect &domain)
|
int index, const QRect &domain)
|
||||||
{
|
{
|
||||||
@ -111,7 +110,7 @@ static inline bool verifyChild(QWidget *child, QAccessibleInterface *interface,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Verify that we get a valid QAccessibleInterface for the child.
|
// Verify that we get a valid QAccessibleInterface for the child.
|
||||||
QAIPtr childInterface(QAccessible::queryAccessibleInterface(child));
|
QAccessibleInterface *childInterface(QAccessible::queryAccessibleInterface(child));
|
||||||
if (!childInterface) {
|
if (!childInterface) {
|
||||||
qWarning("tst_QAccessibility::verifyChild: Failed to retrieve interface for child.");
|
qWarning("tst_QAccessibility::verifyChild: Failed to retrieve interface for child.");
|
||||||
return false;
|
return false;
|
||||||
@ -119,7 +118,7 @@ static inline bool verifyChild(QWidget *child, QAccessibleInterface *interface,
|
|||||||
|
|
||||||
// QAccessibleInterface::indexOfChild():
|
// QAccessibleInterface::indexOfChild():
|
||||||
// Verify that indexOfChild() returns an index equal to the index passed in
|
// Verify that indexOfChild() returns an index equal to the index passed in
|
||||||
int indexFromIndexOfChild = interface->indexOfChild(childInterface.data());
|
int indexFromIndexOfChild = interface->indexOfChild(childInterface);
|
||||||
if (indexFromIndexOfChild != index) {
|
if (indexFromIndexOfChild != index) {
|
||||||
qWarning("tst_QAccessibility::verifyChild (indexOfChild()):");
|
qWarning("tst_QAccessibility::verifyChild (indexOfChild()):");
|
||||||
qWarning() << "Expected:" << index;
|
qWarning() << "Expected:" << index;
|
||||||
@ -128,7 +127,7 @@ static inline bool verifyChild(QWidget *child, QAccessibleInterface *interface,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Navigate to child, compare its object and role with the interface from queryAccessibleInterface(child).
|
// Navigate to child, compare its object and role with the interface from queryAccessibleInterface(child).
|
||||||
QAIPtr navigatedChildInterface(interface->child(index));
|
QAccessibleInterface *navigatedChildInterface(interface->child(index));
|
||||||
if (!navigatedChildInterface)
|
if (!navigatedChildInterface)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -138,7 +137,7 @@ static inline bool verifyChild(QWidget *child, QAccessibleInterface *interface,
|
|||||||
// Calculate global child position and check that the interface
|
// Calculate global child position and check that the interface
|
||||||
// returns the correct index for that position.
|
// returns the correct index for that position.
|
||||||
QPoint globalChildPos = child->mapToGlobal(QPoint(0, 0));
|
QPoint globalChildPos = child->mapToGlobal(QPoint(0, 0));
|
||||||
QAIPtr childAtInterface(interface->childAt(globalChildPos.x(), globalChildPos.y()));
|
QAccessibleInterface *childAtInterface(interface->childAt(globalChildPos.x(), globalChildPos.y()));
|
||||||
if (!childAtInterface) {
|
if (!childAtInterface) {
|
||||||
qWarning("tst_QAccessibility::verifyChild (childAt()):");
|
qWarning("tst_QAccessibility::verifyChild (childAt()):");
|
||||||
qWarning() << "Expected:" << childInterface;
|
qWarning() << "Expected:" << childInterface;
|
||||||
@ -176,10 +175,10 @@ static inline int indexOfChild(QAccessibleInterface *parentInterface, QWidget *c
|
|||||||
{
|
{
|
||||||
if (!parentInterface || !childWidget)
|
if (!parentInterface || !childWidget)
|
||||||
return -1;
|
return -1;
|
||||||
QAIPtr childInterface(QAccessible::queryAccessibleInterface(childWidget));
|
QAccessibleInterface *childInterface(QAccessible::queryAccessibleInterface(childWidget));
|
||||||
if (!childInterface)
|
if (!childInterface)
|
||||||
return -1;
|
return -1;
|
||||||
return parentInterface->indexOfChild(childInterface.data());
|
return parentInterface->indexOfChild(childInterface);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define EXPECT(cond) \
|
#define EXPECT(cond) \
|
||||||
@ -195,20 +194,20 @@ static int verifyHierarchy(QAccessibleInterface *iface)
|
|||||||
{
|
{
|
||||||
int errorAt = 0;
|
int errorAt = 0;
|
||||||
static int treelevel = 0; // for error diagnostics
|
static int treelevel = 0; // for error diagnostics
|
||||||
QAIPtr middleChild;
|
QAccessibleInterface *if2 = 0;
|
||||||
QAIPtr if2;
|
|
||||||
++treelevel;
|
++treelevel;
|
||||||
for (int i = 0; i < iface->childCount() && !errorAt; ++i) {
|
for (int i = 0; i < iface->childCount() && !errorAt; ++i) {
|
||||||
if2 = QAIPtr(iface->child(i));
|
if2 = iface->child(i);
|
||||||
EXPECT(if2 != 0);
|
EXPECT(if2 != 0);
|
||||||
EXPECT(iface->indexOfChild(if2.data()) == i);
|
EXPECT(iface->indexOfChild(if2) == i);
|
||||||
// navigate Ancestor
|
// navigate Ancestor
|
||||||
QAIPtr parent(if2->parent());
|
QAccessibleInterface *parent = if2->parent();
|
||||||
EXPECT(iface->object() == parent->object());
|
EXPECT(iface->object() == parent->object());
|
||||||
|
EXPECT(iface == parent);
|
||||||
|
|
||||||
// verify children
|
// verify children
|
||||||
if (!errorAt)
|
if (!errorAt)
|
||||||
errorAt = verifyHierarchy(if2.data());
|
errorAt = verifyHierarchy(if2);
|
||||||
}
|
}
|
||||||
|
|
||||||
--treelevel;
|
--treelevel;
|
||||||
@ -217,7 +216,7 @@ static int verifyHierarchy(QAccessibleInterface *iface)
|
|||||||
|
|
||||||
QRect childRect(QAccessibleInterface *iface, int index = 0)
|
QRect childRect(QAccessibleInterface *iface, int index = 0)
|
||||||
{
|
{
|
||||||
return QAIPtr(iface->child(index))->rect();
|
return iface->child(index)->rect();
|
||||||
}
|
}
|
||||||
|
|
||||||
class tst_QAccessibility : public QObject
|
class tst_QAccessibility : public QObject
|
||||||
@ -287,7 +286,7 @@ private:
|
|||||||
|
|
||||||
QAccessible::State state(QWidget * const widget)
|
QAccessible::State state(QWidget * const widget)
|
||||||
{
|
{
|
||||||
QAIPtr iface(QAccessible::queryAccessibleInterface(widget));
|
QAccessibleInterface *iface(QAccessible::queryAccessibleInterface(widget));
|
||||||
if (!iface) {
|
if (!iface) {
|
||||||
qWarning() << "Cannot get QAccessibleInterface for widget";
|
qWarning() << "Cannot get QAccessibleInterface for widget";
|
||||||
return QAccessible::State();
|
return QAccessible::State();
|
||||||
@ -340,6 +339,7 @@ void tst_QAccessibility::cleanup()
|
|||||||
void tst_QAccessibility::eventTest()
|
void tst_QAccessibility::eventTest()
|
||||||
{
|
{
|
||||||
QPushButton* button = new QPushButton(0);
|
QPushButton* button = new QPushButton(0);
|
||||||
|
QAccessible::queryAccessibleInterface(button);
|
||||||
button->setObjectName(QString("Olaf"));
|
button->setObjectName(QString("Olaf"));
|
||||||
setFrameless(button);
|
setFrameless(button);
|
||||||
|
|
||||||
@ -436,7 +436,6 @@ void tst_QAccessibility::customWidget()
|
|||||||
QCOMPARE(iface->rect().height(), widget->height());
|
QCOMPARE(iface->rect().height(), widget->height());
|
||||||
QCOMPARE(iface->text(QAccessible::Help), QString());
|
QCOMPARE(iface->text(QAccessible::Help), QString());
|
||||||
QCOMPARE(iface->rect().height(), widget->height());
|
QCOMPARE(iface->rect().height(), widget->height());
|
||||||
delete iface;
|
|
||||||
delete widget;
|
delete widget;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -452,7 +451,6 @@ void tst_QAccessibility::customWidget()
|
|||||||
QCOMPARE(iface->rect().height(), widget->height());
|
QCOMPARE(iface->rect().height(), widget->height());
|
||||||
// The help text is only set if our factory works
|
// The help text is only set if our factory works
|
||||||
QCOMPARE(iface->text(QAccessible::Help), QString("Help yourself"));
|
QCOMPARE(iface->text(QAccessible::Help), QString("Help yourself"));
|
||||||
delete iface;
|
|
||||||
delete widget;
|
delete widget;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -463,7 +461,6 @@ void tst_QAccessibility::customWidget()
|
|||||||
QVERIFY(subIface->isValid());
|
QVERIFY(subIface->isValid());
|
||||||
QCOMPARE(subIface->object(), (QObject*)subclassedWidget);
|
QCOMPARE(subIface->object(), (QObject*)subclassedWidget);
|
||||||
QCOMPARE(subIface->text(QAccessible::Help), QString("Help yourself"));
|
QCOMPARE(subIface->text(QAccessible::Help), QString("Help yourself"));
|
||||||
delete subIface;
|
|
||||||
delete subclassedWidget;
|
delete subclassedWidget;
|
||||||
}
|
}
|
||||||
QTestAccessibility::clearEvents();
|
QTestAccessibility::clearEvents();
|
||||||
@ -480,8 +477,7 @@ void tst_QAccessibility::deletedWidget()
|
|||||||
|
|
||||||
delete widget;
|
delete widget;
|
||||||
widget = 0;
|
widget = 0;
|
||||||
QVERIFY(!iface->isValid());
|
// fixme: QVERIFY(!iface->isValid());
|
||||||
delete iface;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class KFooButton: public QPushButton
|
class KFooButton: public QPushButton
|
||||||
@ -499,7 +495,6 @@ void tst_QAccessibility::subclassedWidget()
|
|||||||
QVERIFY(iface);
|
QVERIFY(iface);
|
||||||
QCOMPARE(iface->object(), (QObject*)&button);
|
QCOMPARE(iface->object(), (QObject*)&button);
|
||||||
QCOMPARE(iface->text(QAccessible::Name), button.text());
|
QCOMPARE(iface->text(QAccessible::Name), button.text());
|
||||||
delete iface;
|
|
||||||
QTestAccessibility::clearEvents();
|
QTestAccessibility::clearEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -530,7 +525,7 @@ void tst_QAccessibility::sliderTest()
|
|||||||
setFrameless(slider);
|
setFrameless(slider);
|
||||||
slider->setObjectName(QString("Slidy"));
|
slider->setObjectName(QString("Slidy"));
|
||||||
slider->show();
|
slider->show();
|
||||||
QAIPtr iface(QAccessible::queryAccessibleInterface(slider));
|
QAccessibleInterface *iface(QAccessible::queryAccessibleInterface(slider));
|
||||||
QVERIFY(iface);
|
QVERIFY(iface);
|
||||||
QVERIFY(iface->isValid());
|
QVERIFY(iface->isValid());
|
||||||
|
|
||||||
@ -577,16 +572,16 @@ void tst_QAccessibility::navigateHierarchy()
|
|||||||
w31->setObjectName(QString("31"));
|
w31->setObjectName(QString("31"));
|
||||||
w31->show();
|
w31->show();
|
||||||
|
|
||||||
QAIPtr ifaceW(QAccessible::queryAccessibleInterface(w));
|
QAccessibleInterface *ifaceW(QAccessible::queryAccessibleInterface(w));
|
||||||
QVERIFY(ifaceW != 0);
|
QVERIFY(ifaceW != 0);
|
||||||
QVERIFY(ifaceW->isValid());
|
QVERIFY(ifaceW->isValid());
|
||||||
|
|
||||||
QAIPtr target = QAIPtr(ifaceW->child(14));
|
QAccessibleInterface *target = ifaceW->child(14);
|
||||||
QVERIFY(target == 0);
|
QVERIFY(target == 0);
|
||||||
target = QAIPtr(ifaceW->child(-1));
|
target = ifaceW->child(-1);
|
||||||
QVERIFY(target == 0);
|
QVERIFY(target == 0);
|
||||||
target = QAIPtr(ifaceW->child(0));
|
target = ifaceW->child(0);
|
||||||
QAIPtr interfaceW1(ifaceW->child(0));
|
QAccessibleInterface *interfaceW1(ifaceW->child(0));
|
||||||
QVERIFY(target);
|
QVERIFY(target);
|
||||||
QVERIFY(target->isValid());
|
QVERIFY(target->isValid());
|
||||||
QCOMPARE(target->object(), (QObject*)w1);
|
QCOMPARE(target->object(), (QObject*)w1);
|
||||||
@ -594,24 +589,24 @@ void tst_QAccessibility::navigateHierarchy()
|
|||||||
QVERIFY(interfaceW1->isValid());
|
QVERIFY(interfaceW1->isValid());
|
||||||
QCOMPARE(interfaceW1->object(), (QObject*)w1);
|
QCOMPARE(interfaceW1->object(), (QObject*)w1);
|
||||||
|
|
||||||
target = QAIPtr(ifaceW->child(2));
|
target = ifaceW->child(2);
|
||||||
QVERIFY(target != 0);
|
QVERIFY(target != 0);
|
||||||
QVERIFY(target->isValid());
|
QVERIFY(target->isValid());
|
||||||
QCOMPARE(target->object(), (QObject*)w3);
|
QCOMPARE(target->object(), (QObject*)w3);
|
||||||
|
|
||||||
QAIPtr child = QAIPtr(target->child(1));
|
QAccessibleInterface *child = target->child(1);
|
||||||
QVERIFY(child == 0);
|
QVERIFY(child == 0);
|
||||||
child = QAIPtr(target->child(0));
|
child = target->child(0);
|
||||||
QVERIFY(child != 0);
|
QVERIFY(child != 0);
|
||||||
QVERIFY(child->isValid());
|
QVERIFY(child->isValid());
|
||||||
QCOMPARE(child->object(), (QObject*)w31);
|
QCOMPARE(child->object(), (QObject*)w31);
|
||||||
|
|
||||||
ifaceW = QAIPtr(QAccessible::queryAccessibleInterface(w));
|
ifaceW = QAccessible::queryAccessibleInterface(w);
|
||||||
QAIPtr acc3(ifaceW->child(2));
|
QAccessibleInterface *acc3(ifaceW->child(2));
|
||||||
target = QAIPtr(acc3->child(0));
|
target = acc3->child(0);
|
||||||
QCOMPARE(target->object(), (QObject*)w31);
|
QCOMPARE(target->object(), (QObject*)w31);
|
||||||
|
|
||||||
QAIPtr parent = QAIPtr(target->parent());
|
QAccessibleInterface *parent = target->parent();
|
||||||
QVERIFY(parent != 0);
|
QVERIFY(parent != 0);
|
||||||
QVERIFY(parent->isValid());
|
QVERIFY(parent->isValid());
|
||||||
QCOMPARE(parent->object(), (QObject*)w3);
|
QCOMPARE(parent->object(), (QObject*)w3);
|
||||||
@ -807,7 +802,6 @@ void tst_QAccessibility::actionTest()
|
|||||||
widget->setFocusPolicy(Qt::StrongFocus);
|
widget->setFocusPolicy(Qt::StrongFocus);
|
||||||
QCOMPARE(actions->actionNames(), QStringList(QAccessibleActionInterface::setFocusAction()));
|
QCOMPARE(actions->actionNames(), QStringList(QAccessibleActionInterface::setFocusAction()));
|
||||||
|
|
||||||
delete interface;
|
|
||||||
delete widget;
|
delete widget;
|
||||||
}
|
}
|
||||||
QTestAccessibility::clearEvents();
|
QTestAccessibility::clearEvents();
|
||||||
@ -836,7 +830,6 @@ void tst_QAccessibility::actionTest()
|
|||||||
QTest::qWait(500);
|
QTest::qWait(500);
|
||||||
QCOMPARE(click_count, 1);
|
QCOMPARE(click_count, 1);
|
||||||
|
|
||||||
delete interface;
|
|
||||||
delete button;
|
delete button;
|
||||||
}
|
}
|
||||||
QTestAccessibility::clearEvents();
|
QTestAccessibility::clearEvents();
|
||||||
@ -847,7 +840,7 @@ void tst_QAccessibility::applicationTest()
|
|||||||
{
|
{
|
||||||
QLatin1String name = QLatin1String("My Name");
|
QLatin1String name = QLatin1String("My Name");
|
||||||
qApp->setApplicationName(name);
|
qApp->setApplicationName(name);
|
||||||
QAIPtr interface(QAccessible::queryAccessibleInterface(qApp));
|
QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(qApp);
|
||||||
QCOMPARE(interface->text(QAccessible::Name), name);
|
QCOMPARE(interface->text(QAccessible::Name), name);
|
||||||
QCOMPARE(interface->text(QAccessible::Description), qApp->applicationFilePath());
|
QCOMPARE(interface->text(QAccessible::Description), qApp->applicationFilePath());
|
||||||
QCOMPARE(interface->text(QAccessible::Value), QString());
|
QCOMPARE(interface->text(QAccessible::Value), QString());
|
||||||
@ -866,13 +859,13 @@ void tst_QAccessibility::applicationTest()
|
|||||||
qApp->setActiveWindow(&widget);
|
qApp->setActiveWindow(&widget);
|
||||||
QVERIFY(QTest::qWaitForWindowActive(&widget));
|
QVERIFY(QTest::qWaitForWindowActive(&widget));
|
||||||
|
|
||||||
QAIPtr widgetIface(QAccessible::queryAccessibleInterface(&widget));
|
QAccessibleInterface *widgetIface = QAccessible::queryAccessibleInterface(&widget);
|
||||||
QCOMPARE(interface->childCount(), 1);
|
QCOMPARE(interface->childCount(), 1);
|
||||||
QAIPtr focus(interface->focusChild());
|
QAccessibleInterface *focus = interface->focusChild();
|
||||||
QCOMPARE(focus->object(), &widget);
|
QCOMPARE(focus->object(), &widget);
|
||||||
QCOMPARE(interface->indexOfChild(0), -1);
|
QCOMPARE(interface->indexOfChild(0), -1);
|
||||||
QCOMPARE(interface->indexOfChild(widgetIface.data()), 0);
|
QCOMPARE(interface->indexOfChild(widgetIface), 0);
|
||||||
QAIPtr child(interface->child(0));
|
QAccessibleInterface *child = interface->child(0);
|
||||||
QCOMPARE(child->object(), &widget);
|
QCOMPARE(child->object(), &widget);
|
||||||
QCOMPARE(interface->child(-1), static_cast<QAccessibleInterface*>(0));
|
QCOMPARE(interface->child(-1), static_cast<QAccessibleInterface*>(0));
|
||||||
QCOMPARE(interface->child(1), static_cast<QAccessibleInterface*>(0));
|
QCOMPARE(interface->child(1), static_cast<QAccessibleInterface*>(0));
|
||||||
@ -906,7 +899,6 @@ void tst_QAccessibility::mainWindowTest()
|
|||||||
QVERIFY(iface->state().active);
|
QVERIFY(iface->state().active);
|
||||||
|
|
||||||
|
|
||||||
delete iface;
|
|
||||||
delete mw;
|
delete mw;
|
||||||
}
|
}
|
||||||
QTestAccessibility::clearEvents();
|
QTestAccessibility::clearEvents();
|
||||||
@ -919,7 +911,7 @@ void tst_QAccessibility::mainWindowTest()
|
|||||||
|
|
||||||
// We currently don't have an accessible interface for QWindow
|
// We currently don't have an accessible interface for QWindow
|
||||||
// the active state is either in the QMainWindow or QQuickView
|
// the active state is either in the QMainWindow or QQuickView
|
||||||
// QAIPtr windowIface(QAccessible::queryAccessibleInterface(&window));
|
// QAccessibleInterface *windowIface(QAccessible::queryAccessibleInterface(&window));
|
||||||
// QVERIFY(windowIface->state().active);
|
// QVERIFY(windowIface->state().active);
|
||||||
|
|
||||||
QAccessible::State activeState;
|
QAccessible::State activeState;
|
||||||
@ -1004,7 +996,6 @@ void tst_QAccessibility::buttonTest()
|
|||||||
actionInterface->doAction(QAccessibleActionInterface::pressAction());
|
actionInterface->doAction(QAccessibleActionInterface::pressAction());
|
||||||
QTest::qWait(500);
|
QTest::qWait(500);
|
||||||
QCOMPARE(pushButton.clickCount, 1);
|
QCOMPARE(pushButton.clickCount, 1);
|
||||||
delete interface;
|
|
||||||
|
|
||||||
// test toggle button
|
// test toggle button
|
||||||
interface = QAccessible::queryAccessibleInterface(&toggleButton);
|
interface = QAccessible::queryAccessibleInterface(&toggleButton);
|
||||||
@ -1019,7 +1010,6 @@ void tst_QAccessibility::buttonTest()
|
|||||||
QVERIFY(toggleButton.isChecked());
|
QVERIFY(toggleButton.isChecked());
|
||||||
QCOMPARE(actionInterface->actionNames().at(0), QAccessibleActionInterface::toggleAction());
|
QCOMPARE(actionInterface->actionNames().at(0), QAccessibleActionInterface::toggleAction());
|
||||||
QVERIFY(interface->state().checked);
|
QVERIFY(interface->state().checked);
|
||||||
delete interface;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
// test menu push button
|
// test menu push button
|
||||||
@ -1038,7 +1028,6 @@ void tst_QAccessibility::buttonTest()
|
|||||||
// showing the menu enters a new event loop...
|
// showing the menu enters a new event loop...
|
||||||
// interface->actionInterface()->doAction(QAccessibleActionInterface::showMenuAction());
|
// interface->actionInterface()->doAction(QAccessibleActionInterface::showMenuAction());
|
||||||
// QTest::qWait(500);
|
// QTest::qWait(500);
|
||||||
delete interface;
|
|
||||||
delete menu;
|
delete menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1063,7 +1052,6 @@ void tst_QAccessibility::buttonTest()
|
|||||||
QVERIFY_EVENT(&ev);
|
QVERIFY_EVENT(&ev);
|
||||||
checkBox.setChecked(false);
|
checkBox.setChecked(false);
|
||||||
QVERIFY_EVENT(&ev);
|
QVERIFY_EVENT(&ev);
|
||||||
delete interface;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -1082,7 +1070,6 @@ void tst_QAccessibility::buttonTest()
|
|||||||
st.checked = true;
|
st.checked = true;
|
||||||
QAccessibleStateChangeEvent ev(&radio, st);
|
QAccessibleStateChangeEvent ev(&radio, st);
|
||||||
QVERIFY_EVENT(&ev);
|
QVERIFY_EVENT(&ev);
|
||||||
delete interface;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// // test standard toolbutton
|
// // test standard toolbutton
|
||||||
@ -1175,7 +1162,6 @@ void tst_QAccessibility::scrollBarTest()
|
|||||||
const QRect scrollBarRect = scrollBarInterface->rect();
|
const QRect scrollBarRect = scrollBarInterface->rect();
|
||||||
QVERIFY(scrollBarRect.isValid());
|
QVERIFY(scrollBarRect.isValid());
|
||||||
|
|
||||||
delete scrollBarInterface;
|
|
||||||
delete scrollBar;
|
delete scrollBar;
|
||||||
|
|
||||||
QTestAccessibility::clearEvents();
|
QTestAccessibility::clearEvents();
|
||||||
@ -1196,7 +1182,6 @@ void tst_QAccessibility::tabTest()
|
|||||||
QAccessibleInterface *leftButton = interface->child(0);
|
QAccessibleInterface *leftButton = interface->child(0);
|
||||||
QCOMPARE(leftButton->role(), QAccessible::PushButton);
|
QCOMPARE(leftButton->role(), QAccessible::PushButton);
|
||||||
QVERIFY(leftButton->state().invisible);
|
QVERIFY(leftButton->state().invisible);
|
||||||
delete leftButton;
|
|
||||||
|
|
||||||
const int lots = 5;
|
const int lots = 5;
|
||||||
for (int i = 0; i < lots; ++i)
|
for (int i = 0; i < lots; ++i)
|
||||||
@ -1232,9 +1217,6 @@ void tst_QAccessibility::tabTest()
|
|||||||
QCOMPARE(tabBar->currentIndex(), 1);
|
QCOMPARE(tabBar->currentIndex(), 1);
|
||||||
|
|
||||||
delete tabBar;
|
delete tabBar;
|
||||||
delete interface;
|
|
||||||
delete child1;
|
|
||||||
delete child2;
|
|
||||||
QTestAccessibility::clearEvents();
|
QTestAccessibility::clearEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1283,10 +1265,6 @@ void tst_QAccessibility::tabWidgetTest()
|
|||||||
QVERIFY(tabButtonRight);
|
QVERIFY(tabButtonRight);
|
||||||
QCOMPARE(tabButtonRight->role(), QAccessible::PushButton);
|
QCOMPARE(tabButtonRight->role(), QAccessible::PushButton);
|
||||||
QCOMPARE(tabButtonRight->text(QAccessible::Name), QLatin1String("Scroll Right"));
|
QCOMPARE(tabButtonRight->text(QAccessible::Name), QLatin1String("Scroll Right"));
|
||||||
delete tabButton1Interface;
|
|
||||||
delete tabButton2Interface;
|
|
||||||
delete tabButtonLeft;
|
|
||||||
delete tabButtonRight;
|
|
||||||
|
|
||||||
QAccessibleInterface* stackWidgetInterface = interface->child(0);
|
QAccessibleInterface* stackWidgetInterface = interface->child(0);
|
||||||
QVERIFY(stackWidgetInterface);
|
QVERIFY(stackWidgetInterface);
|
||||||
@ -1309,7 +1287,6 @@ void tst_QAccessibility::tabWidgetTest()
|
|||||||
QCOMPARE(parent->childCount(), 2);
|
QCOMPARE(parent->childCount(), 2);
|
||||||
#endif
|
#endif
|
||||||
QCOMPARE(parent->role(), QAccessible::LayeredPane);
|
QCOMPARE(parent->role(), QAccessible::LayeredPane);
|
||||||
delete parent;
|
|
||||||
|
|
||||||
QAccessibleInterface* stackChild2Interface = stackWidgetInterface->child(1);
|
QAccessibleInterface* stackChild2Interface = stackWidgetInterface->child(1);
|
||||||
QVERIFY(stackChild2Interface);
|
QVERIFY(stackChild2Interface);
|
||||||
@ -1324,13 +1301,7 @@ void tst_QAccessibility::tabWidgetTest()
|
|||||||
QCOMPARE(parent->childCount(), 2);
|
QCOMPARE(parent->childCount(), 2);
|
||||||
#endif
|
#endif
|
||||||
QCOMPARE(parent->role(), QAccessible::LayeredPane);
|
QCOMPARE(parent->role(), QAccessible::LayeredPane);
|
||||||
delete parent;
|
|
||||||
|
|
||||||
delete tabBarInterface;
|
|
||||||
delete stackChild1Interface;
|
|
||||||
delete stackChild2Interface;
|
|
||||||
delete stackWidgetInterface;
|
|
||||||
delete interface;
|
|
||||||
delete tabWidget;
|
delete tabWidget;
|
||||||
QTestAccessibility::clearEvents();
|
QTestAccessibility::clearEvents();
|
||||||
}
|
}
|
||||||
@ -1378,7 +1349,6 @@ void tst_QAccessibility::menuTest()
|
|||||||
|
|
||||||
QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(&mw);
|
QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(&mw);
|
||||||
QCOMPARE(verifyHierarchy(interface), 0);
|
QCOMPARE(verifyHierarchy(interface), 0);
|
||||||
delete interface;
|
|
||||||
|
|
||||||
interface = QAccessible::queryAccessibleInterface(mw.menuBar());
|
interface = QAccessible::queryAccessibleInterface(mw.menuBar());
|
||||||
|
|
||||||
@ -1455,7 +1425,6 @@ void tst_QAccessibility::menuTest()
|
|||||||
|
|
||||||
QVERIFY(interface->actionInterface());
|
QVERIFY(interface->actionInterface());
|
||||||
QCOMPARE(interface->actionInterface()->actionNames(), QStringList());
|
QCOMPARE(interface->actionInterface()->actionNames(), QStringList());
|
||||||
delete interface;
|
|
||||||
interface = QAccessible::queryAccessibleInterface(file);
|
interface = QAccessible::queryAccessibleInterface(file);
|
||||||
QCOMPARE(interface->childCount(), 5);
|
QCOMPARE(interface->childCount(), 5);
|
||||||
QCOMPARE(interface->role(), QAccessible::PopupMenu);
|
QCOMPARE(interface->role(), QAccessible::PopupMenu);
|
||||||
@ -1496,9 +1465,7 @@ void tst_QAccessibility::menuTest()
|
|||||||
iface2 = interface->child(child);
|
iface2 = interface->child(child);
|
||||||
QVERIFY(iface2);
|
QVERIFY(iface2);
|
||||||
QCOMPARE(iface2->role(), fileRoles[child]);
|
QCOMPARE(iface2->role(), fileRoles[child]);
|
||||||
delete iface2;
|
|
||||||
}
|
}
|
||||||
delete iface;
|
|
||||||
|
|
||||||
// "New" item
|
// "New" item
|
||||||
iface = interface->child(0);
|
iface = interface->child(0);
|
||||||
@ -1507,20 +1474,16 @@ void tst_QAccessibility::menuTest()
|
|||||||
|
|
||||||
// "New" menu
|
// "New" menu
|
||||||
iface2 = iface->child(0);
|
iface2 = iface->child(0);
|
||||||
delete iface;
|
|
||||||
iface = iface2;
|
iface = iface2;
|
||||||
QVERIFY(iface);
|
QVERIFY(iface);
|
||||||
QCOMPARE(iface->role(), QAccessible::PopupMenu);
|
QCOMPARE(iface->role(), QAccessible::PopupMenu);
|
||||||
|
|
||||||
// "Text file" menu item
|
// "Text file" menu item
|
||||||
iface2 = iface->child(0);
|
iface2 = iface->child(0);
|
||||||
delete iface;
|
|
||||||
iface = iface2;
|
iface = iface2;
|
||||||
QVERIFY(iface);
|
QVERIFY(iface);
|
||||||
QCOMPARE(iface->role(), QAccessible::MenuItem);
|
QCOMPARE(iface->role(), QAccessible::MenuItem);
|
||||||
|
|
||||||
delete iface;
|
|
||||||
|
|
||||||
// move mouse pointer away, since that might influence the
|
// move mouse pointer away, since that might influence the
|
||||||
// subsequent tests
|
// subsequent tests
|
||||||
QTest::mouseMove(&mw, QPoint(-1, -1));
|
QTest::mouseMove(&mw, QPoint(-1, -1));
|
||||||
@ -1539,13 +1502,6 @@ void tst_QAccessibility::menuTest()
|
|||||||
QTestAccessibility::clearEvents();
|
QTestAccessibility::clearEvents();
|
||||||
mw.hide();
|
mw.hide();
|
||||||
|
|
||||||
delete iFile;
|
|
||||||
delete iFileNew;
|
|
||||||
delete iFileOpen;
|
|
||||||
delete iFileSave;
|
|
||||||
delete iFileSeparator;
|
|
||||||
delete iFileExit;
|
|
||||||
|
|
||||||
// Do not crash if the menu don't have a parent
|
// Do not crash if the menu don't have a parent
|
||||||
QMenu *menu = new QMenu;
|
QMenu *menu = new QMenu;
|
||||||
menu->addAction(QLatin1String("one"));
|
menu->addAction(QLatin1String("one"));
|
||||||
@ -1557,8 +1513,6 @@ void tst_QAccessibility::menuTest()
|
|||||||
QCOMPARE(iface2->role(), QAccessible::Application);
|
QCOMPARE(iface2->role(), QAccessible::Application);
|
||||||
// caused a *crash*
|
// caused a *crash*
|
||||||
iface2->state();
|
iface2->state();
|
||||||
delete iface2;
|
|
||||||
delete iface;
|
|
||||||
delete menu;
|
delete menu;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1590,7 +1544,6 @@ void tst_QAccessibility::spinBoxTest()
|
|||||||
|
|
||||||
QCOMPARE(lineEdit->role(), QAccessible::EditableText);
|
QCOMPARE(lineEdit->role(), QAccessible::EditableText);
|
||||||
QCOMPARE(lineEdit->text(QAccessible::Value), QLatin1String("3"));
|
QCOMPARE(lineEdit->text(QAccessible::Value), QLatin1String("3"));
|
||||||
delete lineEdit;
|
|
||||||
|
|
||||||
QVERIFY(interface->valueInterface());
|
QVERIFY(interface->valueInterface());
|
||||||
QCOMPARE(interface->valueInterface()->currentValue().toInt(), 3);
|
QCOMPARE(interface->valueInterface()->currentValue().toInt(), 3);
|
||||||
@ -1629,7 +1582,6 @@ void tst_QAccessibility::doubleSpinBoxTest()
|
|||||||
QAccessibleInterface *childIface = interface->child(i);
|
QAccessibleInterface *childIface = interface->child(i);
|
||||||
const QRect childRect = childIface->rect();
|
const QRect childRect = childIface->rect();
|
||||||
QVERIFY(childRect.isValid());
|
QVERIFY(childRect.isValid());
|
||||||
delete childIface;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delete doubleSpinBox;
|
delete doubleSpinBox;
|
||||||
@ -1887,7 +1839,6 @@ void tst_QAccessibility::mdiSubWindowTest()
|
|||||||
QAccessibleInterface *child = interface->childAt(globalWidgetPos.x(), globalWidgetPos.y());
|
QAccessibleInterface *child = interface->childAt(globalWidgetPos.x(), globalWidgetPos.y());
|
||||||
QCOMPARE(child->role(), QAccessible::PushButton);
|
QCOMPARE(child->role(), QAccessible::PushButton);
|
||||||
QCOMPARE(child->text(QAccessible::Name), QString("QAccessibilityTest"));
|
QCOMPARE(child->text(QAccessible::Name), QString("QAccessibilityTest"));
|
||||||
delete child;
|
|
||||||
testWindow->widget()->hide();
|
testWindow->widget()->hide();
|
||||||
QCOMPARE(interface->childAt(globalWidgetPos.x(), globalWidgetPos.y()), static_cast<QAccessibleInterface*>(0));
|
QCOMPARE(interface->childAt(globalWidgetPos.x(), globalWidgetPos.y()), static_cast<QAccessibleInterface*>(0));
|
||||||
|
|
||||||
@ -1900,7 +1851,7 @@ void tst_QAccessibility::lineEditTest()
|
|||||||
QWidget *toplevel = new QWidget;
|
QWidget *toplevel = new QWidget;
|
||||||
{
|
{
|
||||||
QLineEdit *le = new QLineEdit;
|
QLineEdit *le = new QLineEdit;
|
||||||
QAIPtr iface(QAccessible::queryAccessibleInterface(le));
|
QAccessibleInterface *iface(QAccessible::queryAccessibleInterface(le));
|
||||||
QVERIFY(iface);
|
QVERIFY(iface);
|
||||||
le->show();
|
le->show();
|
||||||
|
|
||||||
@ -1966,7 +1917,7 @@ void tst_QAccessibility::lineEditTest()
|
|||||||
QString cite = "I always pass on good advice. It is the only thing to do with it. It is never of any use to oneself. --Oscar Wilde";
|
QString cite = "I always pass on good advice. It is the only thing to do with it. It is never of any use to oneself. --Oscar Wilde";
|
||||||
QLineEdit *le3 = new QLineEdit(cite, toplevel);
|
QLineEdit *le3 = new QLineEdit(cite, toplevel);
|
||||||
le3->show();
|
le3->show();
|
||||||
QAIPtr iface(QAccessible::queryAccessibleInterface(le3));
|
QAccessibleInterface *iface(QAccessible::queryAccessibleInterface(le3));
|
||||||
QAccessibleTextInterface* textIface = iface->textInterface();
|
QAccessibleTextInterface* textIface = iface->textInterface();
|
||||||
le3->deselect();
|
le3->deselect();
|
||||||
QTestAccessibility::clearEvents();
|
QTestAccessibility::clearEvents();
|
||||||
@ -2028,7 +1979,7 @@ void tst_QAccessibility::lineEditTest()
|
|||||||
// characterRect()
|
// characterRect()
|
||||||
le.show();
|
le.show();
|
||||||
QTest::qWaitForWindowShown(&le);
|
QTest::qWaitForWindowShown(&le);
|
||||||
QAIPtr iface(QAccessible::queryAccessibleInterface(&le));
|
QAccessibleInterface *iface(QAccessible::queryAccessibleInterface(&le));
|
||||||
QAccessibleTextInterface* textIface = iface->textInterface();
|
QAccessibleTextInterface* textIface = iface->textInterface();
|
||||||
QVERIFY(textIface);
|
QVERIFY(textIface);
|
||||||
const QRect lineEditRect = iface->rect();
|
const QRect lineEditRect = iface->rect();
|
||||||
@ -2166,10 +2117,6 @@ void tst_QAccessibility::groupBoxTest()
|
|||||||
QCOMPARE(relation.first->object(), groupBox);
|
QCOMPARE(relation.first->object(), groupBox);
|
||||||
QCOMPARE(relation.second, QAccessible::Label);
|
QCOMPARE(relation.second, QAccessible::Label);
|
||||||
|
|
||||||
delete relation.first;
|
|
||||||
|
|
||||||
delete rButtonIface;
|
|
||||||
delete iface;
|
|
||||||
delete groupBox;
|
delete groupBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2199,7 +2146,6 @@ void tst_QAccessibility::groupBoxTest()
|
|||||||
QAccessibleStateChangeEvent ev2(groupBox, st);
|
QAccessibleStateChangeEvent ev2(groupBox, st);
|
||||||
QVERIFY_EVENT(&ev2);
|
QVERIFY_EVENT(&ev2);
|
||||||
|
|
||||||
delete iface;
|
|
||||||
delete groupBox;
|
delete groupBox;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2265,7 +2211,6 @@ void tst_QAccessibility::dialogButtonBoxTest()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
QCOMPARE(actualOrder, expectedOrder);
|
QCOMPARE(actualOrder, expectedOrder);
|
||||||
delete iface;
|
|
||||||
QApplication::processEvents();
|
QApplication::processEvents();
|
||||||
QTestAccessibility::clearEvents();
|
QTestAccessibility::clearEvents();
|
||||||
}
|
}
|
||||||
@ -2305,7 +2250,6 @@ void tst_QAccessibility::dialogButtonBoxTest()
|
|||||||
<< QDialogButtonBox::tr("Help");
|
<< QDialogButtonBox::tr("Help");
|
||||||
|
|
||||||
QCOMPARE(actualOrder, expectedOrder);
|
QCOMPARE(actualOrder, expectedOrder);
|
||||||
delete iface;
|
|
||||||
QApplication::processEvents();
|
QApplication::processEvents();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2355,7 +2299,6 @@ void tst_QAccessibility::rubberBandTest()
|
|||||||
QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(&rubberBand);
|
QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(&rubberBand);
|
||||||
QVERIFY(interface);
|
QVERIFY(interface);
|
||||||
QCOMPARE(interface->role(), QAccessible::Border);
|
QCOMPARE(interface->role(), QAccessible::Border);
|
||||||
delete interface;
|
|
||||||
QTestAccessibility::clearEvents();
|
QTestAccessibility::clearEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2440,7 +2383,6 @@ void tst_QAccessibility::abstractScrollAreaTest()
|
|||||||
|
|
||||||
QCOMPARE(verifyHierarchy(interface), 0);
|
QCOMPARE(verifyHierarchy(interface), 0);
|
||||||
|
|
||||||
delete interface;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QTestAccessibility::clearEvents();
|
QTestAccessibility::clearEvents();
|
||||||
@ -2458,7 +2400,6 @@ void tst_QAccessibility::scrollAreaTest()
|
|||||||
QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(&scrollArea);
|
QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(&scrollArea);
|
||||||
QVERIFY(interface);
|
QVERIFY(interface);
|
||||||
QCOMPARE(interface->childCount(), 1); // The viewport.
|
QCOMPARE(interface->childCount(), 1); // The viewport.
|
||||||
delete interface;
|
|
||||||
}
|
}
|
||||||
QTestAccessibility::clearEvents();
|
QTestAccessibility::clearEvents();
|
||||||
}
|
}
|
||||||
@ -2476,27 +2417,27 @@ void tst_QAccessibility::listTest()
|
|||||||
QCoreApplication::processEvents();
|
QCoreApplication::processEvents();
|
||||||
QTest::qWait(100);
|
QTest::qWait(100);
|
||||||
|
|
||||||
QAIPtr iface = QAIPtr(QAccessible::queryAccessibleInterface(listView));
|
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(listView);
|
||||||
QCOMPARE(verifyHierarchy(iface.data()), 0);
|
QCOMPARE(verifyHierarchy(iface), 0);
|
||||||
|
|
||||||
QCOMPARE((int)iface->role(), (int)QAccessible::List);
|
QCOMPARE((int)iface->role(), (int)QAccessible::List);
|
||||||
QCOMPARE(iface->childCount(), 3);
|
QCOMPARE(iface->childCount(), 3);
|
||||||
|
|
||||||
{
|
{
|
||||||
QAIPtr child1 = QAIPtr(iface->child(0));
|
QAccessibleInterface *child1 = iface->child(0);
|
||||||
QVERIFY(child1);
|
QVERIFY(child1);
|
||||||
QCOMPARE(iface->indexOfChild(child1.data()), 0);
|
QCOMPARE(iface->indexOfChild(child1), 0);
|
||||||
QCOMPARE(child1->text(QAccessible::Name), QString("Oslo"));
|
QCOMPARE(child1->text(QAccessible::Name), QString("Oslo"));
|
||||||
QCOMPARE(child1->role(), QAccessible::ListItem);
|
QCOMPARE(child1->role(), QAccessible::ListItem);
|
||||||
|
|
||||||
QAIPtr child2 = QAIPtr(iface->child(1));
|
QAccessibleInterface *child2 = iface->child(1);
|
||||||
QVERIFY(child2);
|
QVERIFY(child2);
|
||||||
QCOMPARE(iface->indexOfChild(child2.data()), 1);
|
QCOMPARE(iface->indexOfChild(child2), 1);
|
||||||
QCOMPARE(child2->text(QAccessible::Name), QString("Berlin"));
|
QCOMPARE(child2->text(QAccessible::Name), QString("Berlin"));
|
||||||
|
|
||||||
QAIPtr child3 = QAIPtr(iface->child(2));
|
QAccessibleInterface *child3 = iface->child(2);
|
||||||
QVERIFY(child3);
|
QVERIFY(child3);
|
||||||
QCOMPARE(iface->indexOfChild(child3.data()), 2);
|
QCOMPARE(iface->indexOfChild(child3), 2);
|
||||||
QCOMPARE(child3->text(QAccessible::Name), QString("Brisbane"));
|
QCOMPARE(child3->text(QAccessible::Name), QString("Brisbane"));
|
||||||
}
|
}
|
||||||
QTestAccessibility::clearEvents();
|
QTestAccessibility::clearEvents();
|
||||||
@ -2526,11 +2467,11 @@ void tst_QAccessibility::listTest()
|
|||||||
QVERIFY(table2);
|
QVERIFY(table2);
|
||||||
QCOMPARE(table2->columnCount(), 1);
|
QCOMPARE(table2->columnCount(), 1);
|
||||||
QCOMPARE(table2->rowCount(), 4);
|
QCOMPARE(table2->rowCount(), 4);
|
||||||
QAIPtr cell1 = QAIPtr(table2->cellAt(0,0));
|
QAccessibleInterface *cell1 = table2->cellAt(0,0);
|
||||||
QVERIFY(cell1);
|
QVERIFY(cell1);
|
||||||
QCOMPARE(cell1->text(QAccessible::Name), QString("Oslo"));
|
QCOMPARE(cell1->text(QAccessible::Name), QString("Oslo"));
|
||||||
|
|
||||||
QAIPtr cell4 = QAIPtr(table2->cellAt(3,0));
|
QAccessibleInterface *cell4 = table2->cellAt(3,0);
|
||||||
QVERIFY(cell4);
|
QVERIFY(cell4);
|
||||||
QCOMPARE(cell4->text(QAccessible::Name), QString("Munich"));
|
QCOMPARE(cell4->text(QAccessible::Name), QString("Munich"));
|
||||||
QCOMPARE(cell4->role(), QAccessible::ListItem);
|
QCOMPARE(cell4->role(), QAccessible::ListItem);
|
||||||
@ -2544,7 +2485,7 @@ void tst_QAccessibility::listTest()
|
|||||||
QCOMPARE(cellInterface->rowHeaderCells(), QList<QAccessibleInterface*>());
|
QCOMPARE(cellInterface->rowHeaderCells(), QList<QAccessibleInterface*>());
|
||||||
QCOMPARE(cellInterface->columnHeaderCells(), QList<QAccessibleInterface*>());
|
QCOMPARE(cellInterface->columnHeaderCells(), QList<QAccessibleInterface*>());
|
||||||
|
|
||||||
QCOMPARE(QAIPtr(cellInterface->table())->object(), listView);
|
QCOMPARE(cellInterface->table()->object(), listView);
|
||||||
|
|
||||||
listView->clearSelection();
|
listView->clearSelection();
|
||||||
QVERIFY(!(cell4->state().expandable));
|
QVERIFY(!(cell4->state().expandable));
|
||||||
@ -2561,6 +2502,25 @@ void tst_QAccessibility::listTest()
|
|||||||
QVERIFY(table2->cellAt(0, 1) == 0);
|
QVERIFY(table2->cellAt(0, 1) == 0);
|
||||||
QVERIFY(table2->cellAt(4, 0) == 0);
|
QVERIFY(table2->cellAt(4, 0) == 0);
|
||||||
|
|
||||||
|
// verify that unique id stays the same
|
||||||
|
QAccessible::Id axidMunich = QAccessible::uniqueId(cell4);
|
||||||
|
// insertion and deletion of items
|
||||||
|
listView->insertItem(1, "Helsinki");
|
||||||
|
// list: Oslo, Helsinki, Berlin, Brisbane, Munich
|
||||||
|
|
||||||
|
QAccessibleInterface *cellMunich2 = table2->cellAt(4,0);
|
||||||
|
QCOMPARE(cell4, cellMunich2);
|
||||||
|
QCOMPARE(axidMunich, QAccessible::uniqueId(cellMunich2));
|
||||||
|
|
||||||
|
delete listView->takeItem(2);
|
||||||
|
delete listView->takeItem(2);
|
||||||
|
// list: Oslo, Helsinki, Munich
|
||||||
|
|
||||||
|
QAccessibleInterface *cellMunich3 = table2->cellAt(2,0);
|
||||||
|
QCOMPARE(cell4, cellMunich3);
|
||||||
|
QCOMPARE(axidMunich, QAccessible::uniqueId(cellMunich3));
|
||||||
|
|
||||||
|
|
||||||
delete listView;
|
delete listView;
|
||||||
}
|
}
|
||||||
QTestAccessibility::clearEvents();
|
QTestAccessibility::clearEvents();
|
||||||
@ -2616,29 +2576,24 @@ void tst_QAccessibility::treeTest()
|
|||||||
// header and 2 rows (the others are not expanded, thus not visible)
|
// header and 2 rows (the others are not expanded, thus not visible)
|
||||||
QCOMPARE(iface->childCount(), 6);
|
QCOMPARE(iface->childCount(), 6);
|
||||||
|
|
||||||
QAccessibleInterface *header1 = 0;
|
QAccessibleInterface *header1 = iface->child(0);
|
||||||
header1 = iface->child(0);
|
|
||||||
QVERIFY(header1);
|
QVERIFY(header1);
|
||||||
QCOMPARE(iface->indexOfChild(header1), 0);
|
QCOMPARE(iface->indexOfChild(header1), 0);
|
||||||
QCOMPARE(header1->text(QAccessible::Name), QString("Artist"));
|
QCOMPARE(header1->text(QAccessible::Name), QString("Artist"));
|
||||||
QCOMPARE(header1->role(), QAccessible::ColumnHeader);
|
QCOMPARE(header1->role(), QAccessible::ColumnHeader);
|
||||||
delete header1;
|
|
||||||
|
|
||||||
QAccessibleInterface *child1 = 0;
|
QAccessibleInterface *child1 = iface->child(2);
|
||||||
child1 = iface->child(2);
|
|
||||||
QVERIFY(child1);
|
QVERIFY(child1);
|
||||||
QCOMPARE(iface->indexOfChild(child1), 2);
|
QCOMPARE(iface->indexOfChild(child1), 2);
|
||||||
QCOMPARE(child1->text(QAccessible::Name), QString("Spain"));
|
QCOMPARE(child1->text(QAccessible::Name), QString("Spain"));
|
||||||
QCOMPARE(child1->role(), QAccessible::TreeItem);
|
QCOMPARE(child1->role(), QAccessible::TreeItem);
|
||||||
QVERIFY(!(child1->state().expanded));
|
QVERIFY(!(child1->state().expanded));
|
||||||
delete child1;
|
|
||||||
|
|
||||||
QAccessibleInterface *child2 = 0;
|
QAccessibleInterface *child2 = 0;
|
||||||
child2 = iface->child(4);
|
child2 = iface->child(4);
|
||||||
QVERIFY(child2);
|
QVERIFY(child2);
|
||||||
QCOMPARE(iface->indexOfChild(child2), 4);
|
QCOMPARE(iface->indexOfChild(child2), 4);
|
||||||
QCOMPARE(child2->text(QAccessible::Name), QString("Austria"));
|
QCOMPARE(child2->text(QAccessible::Name), QString("Austria"));
|
||||||
delete child2;
|
|
||||||
|
|
||||||
QTestAccessibility::clearEvents();
|
QTestAccessibility::clearEvents();
|
||||||
|
|
||||||
@ -2660,8 +2615,6 @@ void tst_QAccessibility::treeTest()
|
|||||||
QCOMPARE(iface->indexOfChild(cell2), 4);
|
QCOMPARE(iface->indexOfChild(cell2), 4);
|
||||||
QVERIFY(!(cell2->state().expanded));
|
QVERIFY(!(cell2->state().expanded));
|
||||||
QCOMPARE(table2->columnDescription(1), QString("Work"));
|
QCOMPARE(table2->columnDescription(1), QString("Work"));
|
||||||
delete cell2;
|
|
||||||
delete cell1;
|
|
||||||
|
|
||||||
treeView->expandAll();
|
treeView->expandAll();
|
||||||
|
|
||||||
@ -2687,14 +2640,13 @@ void tst_QAccessibility::treeTest()
|
|||||||
QModelIndex index = treeView->model()->index(0, 0, treeView->model()->index(1, 0));
|
QModelIndex index = treeView->model()->index(0, 0, treeView->model()->index(1, 0));
|
||||||
pos += treeView->visualRect(index).center();
|
pos += treeView->visualRect(index).center();
|
||||||
pos += QPoint(0, treeView->header()->height());
|
pos += QPoint(0, treeView->header()->height());
|
||||||
QAIPtr childAt2(iface->childAt(pos.x(), pos.y()));
|
QAccessibleInterface *childAt2(iface->childAt(pos.x(), pos.y()));
|
||||||
QVERIFY(childAt2);
|
QVERIFY(childAt2);
|
||||||
QCOMPARE(childAt2->text(QAccessible::Name), QString("Klimt"));
|
QCOMPARE(childAt2->text(QAccessible::Name), QString("Klimt"));
|
||||||
|
|
||||||
QCOMPARE(table2->columnDescription(0), QString("Artist"));
|
QCOMPARE(table2->columnDescription(0), QString("Artist"));
|
||||||
QCOMPARE(table2->columnDescription(1), QString("Work"));
|
QCOMPARE(table2->columnDescription(1), QString("Work"));
|
||||||
|
|
||||||
delete iface;
|
|
||||||
delete treeView;
|
delete treeView;
|
||||||
QTestAccessibility::clearEvents();
|
QTestAccessibility::clearEvents();
|
||||||
}
|
}
|
||||||
@ -2726,36 +2678,36 @@ void tst_QAccessibility::tableTest()
|
|||||||
tableView->show();
|
tableView->show();
|
||||||
QTest::qWaitForWindowExposed(tableView);
|
QTest::qWaitForWindowExposed(tableView);
|
||||||
|
|
||||||
QAIPtr iface = QAIPtr(QAccessible::queryAccessibleInterface(tableView));
|
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(tableView);
|
||||||
QCOMPARE(verifyHierarchy(iface.data()), 0);
|
QCOMPARE(verifyHierarchy(iface), 0);
|
||||||
|
|
||||||
QCOMPARE(iface->role(), QAccessible::Table);
|
QCOMPARE(iface->role(), QAccessible::Table);
|
||||||
// header and 2 rows (the others are not expanded, thus not visible)
|
// header and 2 rows (the others are not expanded, thus not visible)
|
||||||
QCOMPARE(iface->childCount(), 9+3+3+1); // cell+headers+topleft button
|
QCOMPARE(iface->childCount(), 9+3+3+1); // cell+headers+topleft button
|
||||||
|
|
||||||
QAIPtr cornerButton(iface->child(0));
|
QAccessibleInterface *cornerButton(iface->child(0));
|
||||||
QVERIFY(cornerButton);
|
QVERIFY(cornerButton);
|
||||||
QCOMPARE(iface->indexOfChild(cornerButton.data()), 0);
|
QCOMPARE(iface->indexOfChild(cornerButton), 0);
|
||||||
QCOMPARE(cornerButton->role(), QAccessible::Pane);
|
QCOMPARE(cornerButton->role(), QAccessible::Pane);
|
||||||
|
|
||||||
QAIPtr h2(iface->child(2));
|
QAccessibleInterface *h2(iface->child(2));
|
||||||
QVERIFY(h2);
|
QVERIFY(h2);
|
||||||
QCOMPARE(iface->indexOfChild(h2.data()), 2);
|
QCOMPARE(iface->indexOfChild(h2), 2);
|
||||||
QCOMPARE(h2->text(QAccessible::Name), QString("h2"));
|
QCOMPARE(h2->text(QAccessible::Name), QString("h2"));
|
||||||
QCOMPARE(h2->role(), QAccessible::ColumnHeader);
|
QCOMPARE(h2->role(), QAccessible::ColumnHeader);
|
||||||
QVERIFY(!(h2->state().expanded));
|
QVERIFY(!(h2->state().expanded));
|
||||||
|
|
||||||
QAIPtr v3(iface->child(12));
|
QAccessibleInterface *v3(iface->child(12));
|
||||||
QVERIFY(v3);
|
QVERIFY(v3);
|
||||||
QCOMPARE(iface->indexOfChild(v3.data()), 12);
|
QCOMPARE(iface->indexOfChild(v3), 12);
|
||||||
QCOMPARE(v3->text(QAccessible::Name), QString("v3"));
|
QCOMPARE(v3->text(QAccessible::Name), QString("v3"));
|
||||||
QCOMPARE(v3->role(), QAccessible::RowHeader);
|
QCOMPARE(v3->role(), QAccessible::RowHeader);
|
||||||
QVERIFY(!(v3->state().expanded));
|
QVERIFY(!(v3->state().expanded));
|
||||||
|
|
||||||
|
|
||||||
QAIPtr child10(iface->child(10));
|
QAccessibleInterface *child10(iface->child(10));
|
||||||
QVERIFY(child10);
|
QVERIFY(child10);
|
||||||
QCOMPARE(iface->indexOfChild(child10.data()), 10);
|
QCOMPARE(iface->indexOfChild(child10), 10);
|
||||||
QCOMPARE(child10->text(QAccessible::Name), QString("1.1"));
|
QCOMPARE(child10->text(QAccessible::Name), QString("1.1"));
|
||||||
QAccessibleTableCellInterface *cell10Iface = child10->tableCellInterface();
|
QAccessibleTableCellInterface *cell10Iface = child10->tableCellInterface();
|
||||||
QCOMPARE(cell10Iface->rowIndex(), 1);
|
QCOMPARE(cell10Iface->rowIndex(), 1);
|
||||||
@ -2763,11 +2715,11 @@ void tst_QAccessibility::tableTest()
|
|||||||
QPoint pos = tableView->mapToGlobal(QPoint(0,0));
|
QPoint pos = tableView->mapToGlobal(QPoint(0,0));
|
||||||
pos += tableView->visualRect(tableView->model()->index(1, 1)).center();
|
pos += tableView->visualRect(tableView->model()->index(1, 1)).center();
|
||||||
pos += QPoint(tableView->verticalHeader()->width(), tableView->horizontalHeader()->height());
|
pos += QPoint(tableView->verticalHeader()->width(), tableView->horizontalHeader()->height());
|
||||||
QAIPtr childAt10(iface->childAt(pos.x(), pos.y()));
|
QAccessibleInterface *childAt10(iface->childAt(pos.x(), pos.y()));
|
||||||
QCOMPARE(childAt10->text(QAccessible::Name), QString("1.1"));
|
QCOMPARE(childAt10->text(QAccessible::Name), QString("1.1"));
|
||||||
|
|
||||||
QAIPtr child11(iface->child(11));
|
QAccessibleInterface *child11(iface->child(11));
|
||||||
QCOMPARE(iface->indexOfChild(child11.data()), 11);
|
QCOMPARE(iface->indexOfChild(child11), 11);
|
||||||
QCOMPARE(child11->text(QAccessible::Name), QString("1.2"));
|
QCOMPARE(child11->text(QAccessible::Name), QString("1.2"));
|
||||||
|
|
||||||
|
|
||||||
@ -2783,21 +2735,21 @@ void tst_QAccessibility::tableTest()
|
|||||||
QCOMPARE(cell1->text(QAccessible::Name), QString("0.0"));
|
QCOMPARE(cell1->text(QAccessible::Name), QString("0.0"));
|
||||||
QCOMPARE(iface->indexOfChild(cell1), 5);
|
QCOMPARE(iface->indexOfChild(cell1), 5);
|
||||||
|
|
||||||
QAIPtr cell2(table2->cellAt(0,1));
|
QAccessibleInterface *cell2(table2->cellAt(0,1));
|
||||||
QVERIFY(cell2);
|
QVERIFY(cell2);
|
||||||
QCOMPARE(cell2->text(QAccessible::Name), QString("0.1"));
|
QCOMPARE(cell2->text(QAccessible::Name), QString("0.1"));
|
||||||
QCOMPARE(cell2->role(), QAccessible::Cell);
|
QCOMPARE(cell2->role(), QAccessible::Cell);
|
||||||
QCOMPARE(cell2->tableCellInterface()->rowIndex(), 0);
|
QCOMPARE(cell2->tableCellInterface()->rowIndex(), 0);
|
||||||
QCOMPARE(cell2->tableCellInterface()->columnIndex(), 1);
|
QCOMPARE(cell2->tableCellInterface()->columnIndex(), 1);
|
||||||
QCOMPARE(iface->indexOfChild(cell2.data()), 6);
|
QCOMPARE(iface->indexOfChild(cell2), 6);
|
||||||
|
|
||||||
QAIPtr cell3(table2->cellAt(1,2));
|
QAccessibleInterface *cell3(table2->cellAt(1,2));
|
||||||
QVERIFY(cell3);
|
QVERIFY(cell3);
|
||||||
QCOMPARE(cell3->text(QAccessible::Name), QString("1.2"));
|
QCOMPARE(cell3->text(QAccessible::Name), QString("1.2"));
|
||||||
QCOMPARE(cell3->role(), QAccessible::Cell);
|
QCOMPARE(cell3->role(), QAccessible::Cell);
|
||||||
QCOMPARE(cell3->tableCellInterface()->rowIndex(), 1);
|
QCOMPARE(cell3->tableCellInterface()->rowIndex(), 1);
|
||||||
QCOMPARE(cell3->tableCellInterface()->columnIndex(), 2);
|
QCOMPARE(cell3->tableCellInterface()->columnIndex(), 2);
|
||||||
QCOMPARE(iface->indexOfChild(cell3.data()), 11);
|
QCOMPARE(iface->indexOfChild(cell3), 11);
|
||||||
|
|
||||||
QCOMPARE(table2->columnDescription(0), QString("h1"));
|
QCOMPARE(table2->columnDescription(0), QString("h1"));
|
||||||
QCOMPARE(table2->columnDescription(1), QString("h2"));
|
QCOMPARE(table2->columnDescription(1), QString("h2"));
|
||||||
@ -2841,7 +2793,7 @@ void tst_QAccessibility::tableTest()
|
|||||||
QVERIFY(table2->isColumnSelected(1));
|
QVERIFY(table2->isColumnSelected(1));
|
||||||
QVERIFY(table2->isRowSelected(1));
|
QVERIFY(table2->isRowSelected(1));
|
||||||
|
|
||||||
QAIPtr cell4(table2->cellAt(2,2));
|
QAccessibleInterface *cell4 = table2->cellAt(2,2);
|
||||||
QVERIFY(cell1->actionInterface());
|
QVERIFY(cell1->actionInterface());
|
||||||
QVERIFY(cell1->tableCellInterface());
|
QVERIFY(cell1->tableCellInterface());
|
||||||
|
|
||||||
@ -2876,8 +2828,101 @@ void tst_QAccessibility::tableTest()
|
|||||||
QVERIFY(cell1->tableCellInterface()->isSelected());
|
QVERIFY(cell1->tableCellInterface()->isSelected());
|
||||||
QVERIFY(!cell2->tableCellInterface()->isSelected());
|
QVERIFY(!cell2->tableCellInterface()->isSelected());
|
||||||
|
|
||||||
|
QAccessibleInterface *cell00 = table2->cellAt(0, 0);
|
||||||
|
QAccessible::Id id00 = QAccessible::uniqueId(cell00);
|
||||||
|
QVERIFY(id00);
|
||||||
|
QCOMPARE(cell00->tableCellInterface()->rowIndex(), 0);
|
||||||
|
QCOMPARE(cell00->tableCellInterface()->columnIndex(), 0);
|
||||||
|
|
||||||
|
QAccessibleInterface *cell01 = table2->cellAt(0, 1);
|
||||||
|
|
||||||
|
QAccessibleInterface *cell02 = table2->cellAt(0, 2);
|
||||||
|
QAccessible::Id id02 = QAccessible::uniqueId(cell02);
|
||||||
|
QVERIFY(id02);
|
||||||
|
QCOMPARE(cell02->tableCellInterface()->rowIndex(), 0);
|
||||||
|
QCOMPARE(cell02->tableCellInterface()->columnIndex(), 2);
|
||||||
|
|
||||||
|
QAccessibleInterface *cell20 = table2->cellAt(2, 0);
|
||||||
|
QAccessible::Id id20 = QAccessible::uniqueId(cell20);
|
||||||
|
QVERIFY(id20);
|
||||||
|
QCOMPARE(cell20->tableCellInterface()->rowIndex(), 2);
|
||||||
|
QCOMPARE(cell20->tableCellInterface()->columnIndex(), 0);
|
||||||
|
|
||||||
|
QAccessibleInterface *cell22 = table2->cellAt(2, 2);
|
||||||
|
QAccessible::Id id22 = QAccessible::uniqueId(cell22);
|
||||||
|
QVERIFY(id22);
|
||||||
|
QCOMPARE(cell22->tableCellInterface()->rowIndex(), 2);
|
||||||
|
QCOMPARE(cell22->tableCellInterface()->columnIndex(), 2);
|
||||||
|
|
||||||
|
// modification: inserting and removing rows/columns
|
||||||
|
tableView->insertRow(2);
|
||||||
|
// Button (0) | h1 (1) | h2 (2) | h3 (3)
|
||||||
|
// v1 (4) | 0.0 (5) | 1.0 (6) | 2.0 (7)
|
||||||
|
// v2 (8) | 0.1 (9) | 1.1 (10) | 2.1 (11)
|
||||||
|
// new (12) | (13) | (14) | (15)
|
||||||
|
// v3 (16) | 0.2 (17) | 1.2 (18) | 2.2 (19)
|
||||||
|
|
||||||
|
QAccessibleInterface *cell00_new = table2->cellAt(0, 0);
|
||||||
|
QCOMPARE(cell00, cell00_new);
|
||||||
|
QCOMPARE(cell00->tableCellInterface()->rowIndex(), 0);
|
||||||
|
QCOMPARE(cell00->tableCellInterface()->columnIndex(), 0);
|
||||||
|
|
||||||
|
QAccessibleInterface *cell02_new = table2->cellAt(0, 2);
|
||||||
|
QCOMPARE(cell02, cell02_new);
|
||||||
|
QCOMPARE(cell02_new->tableCellInterface()->rowIndex(), 0);
|
||||||
|
QCOMPARE(cell02_new->tableCellInterface()->columnIndex(), 2);
|
||||||
|
|
||||||
|
QAccessibleInterface *cell20_new = table2->cellAt(2, 0);
|
||||||
|
QAccessibleInterface *cell30_new = table2->cellAt(3, 0);
|
||||||
|
QAccessible::Id id20_new = QAccessible::uniqueId(cell20_new);
|
||||||
|
QVERIFY(id20_new != id20);
|
||||||
|
QAccessible::Id id30_new = QAccessible::uniqueId(cell30_new);
|
||||||
|
QCOMPARE(id20, id30_new);
|
||||||
|
QCOMPARE(cell20->tableCellInterface()->rowIndex(), 3);
|
||||||
|
QCOMPARE(cell20->tableCellInterface()->columnIndex(), 0);
|
||||||
|
|
||||||
|
QAccessibleInterface *cell22_new = table2->cellAt(2, 2);
|
||||||
|
QAccessibleInterface *cell32_new = table2->cellAt(3, 2);
|
||||||
|
QAccessible::Id id22_new = QAccessible::uniqueId(cell22_new);
|
||||||
|
QVERIFY(id22_new != id22);
|
||||||
|
QAccessible::Id id32_new = QAccessible::uniqueId(cell32_new);
|
||||||
|
QCOMPARE(id22, id32_new);
|
||||||
|
QCOMPARE(cell32_new->tableCellInterface()->rowIndex(), 3);
|
||||||
|
QCOMPARE(cell32_new->tableCellInterface()->columnIndex(), 2);
|
||||||
|
|
||||||
|
|
||||||
|
QVERIFY(table2->cellAt(0, 0) == cell1);
|
||||||
|
|
||||||
|
tableView->insertColumn(2);
|
||||||
|
// Button (0) | h1 (1) | h2 (2) | (3) | h3 (4)
|
||||||
|
// v1 (5) | 0.0 (6) | 1.0 (7) | (8) | 2.0 (9)
|
||||||
|
// v2 (10) | 0.1 (11) | 1.1 (12) | (13) | 2.1 (14)
|
||||||
|
// new (15) | (16) | (17) | (18) | (19)
|
||||||
|
// v3 (20) | 0.2 (21) | 1.2 (22) | (23) | 2.2 (24)
|
||||||
|
|
||||||
|
cell00_new = table2->cellAt(0, 0);
|
||||||
|
QCOMPARE(cell00, cell00_new);
|
||||||
|
QCOMPARE(cell00->tableCellInterface()->rowIndex(), 0);
|
||||||
|
QCOMPARE(cell00->tableCellInterface()->columnIndex(), 0);
|
||||||
|
|
||||||
|
QAccessibleInterface *cell01_new = table2->cellAt(0, 1);
|
||||||
|
QCOMPARE(cell01, cell01_new);
|
||||||
|
QCOMPARE(cell01_new->tableCellInterface()->rowIndex(), 0);
|
||||||
|
QCOMPARE(cell01_new->tableCellInterface()->columnIndex(), 1);
|
||||||
|
|
||||||
|
QAccessibleInterface *cell03_new = table2->cellAt(0, 3);
|
||||||
|
QVERIFY(cell03_new);
|
||||||
|
QCOMPARE(cell03_new->tableCellInterface()->rowIndex(), 0);
|
||||||
|
QCOMPARE(cell03_new->tableCellInterface()->columnIndex(), 3);
|
||||||
|
QCOMPARE(iface->indexOfChild(cell03_new), 9);
|
||||||
|
QCOMPARE(cell03_new, cell02);
|
||||||
|
|
||||||
|
cell30_new = table2->cellAt(3, 0);
|
||||||
|
QCOMPARE(cell30_new, cell20);
|
||||||
|
QCOMPARE(iface->indexOfChild(cell30_new), 21);
|
||||||
delete tableView;
|
delete tableView;
|
||||||
|
|
||||||
|
QVERIFY(!QAccessible::accessibleInterface(id00));
|
||||||
QTestAccessibility::clearEvents();
|
QTestAccessibility::clearEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2954,9 +2999,7 @@ void tst_QAccessibility::calendarWidgetTest()
|
|||||||
// In order for geometric navigation to work they must share the same parent
|
// In order for geometric navigation to work they must share the same parent
|
||||||
QCOMPARE(navigationBarInterface->parent()->object(), calendarViewInterface->parent()->object());
|
QCOMPARE(navigationBarInterface->parent()->object(), calendarViewInterface->parent()->object());
|
||||||
QVERIFY(navigationBarInterface->rect().bottom() < calendarViewInterface->rect().top());
|
QVERIFY(navigationBarInterface->rect().bottom() < calendarViewInterface->rect().top());
|
||||||
delete calendarViewInterface;
|
|
||||||
calendarViewInterface = 0;
|
calendarViewInterface = 0;
|
||||||
delete navigationBarInterface;
|
|
||||||
navigationBarInterface = 0;
|
navigationBarInterface = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -3001,8 +3044,6 @@ void tst_QAccessibility::dockWidgetTest()
|
|||||||
if (accMainWindow->role() == QAccessible::Window) {
|
if (accMainWindow->role() == QAccessible::Window) {
|
||||||
if (accDock1 && qobject_cast<QDockWidget*>(accDock1->object()) == dock1) {
|
if (accDock1 && qobject_cast<QDockWidget*>(accDock1->object()) == dock1) {
|
||||||
break;
|
break;
|
||||||
} else {
|
|
||||||
delete accDock1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3012,7 +3053,6 @@ void tst_QAccessibility::dockWidgetTest()
|
|||||||
QAccessibleInterface *dock1TitleBar = accDock1->child(0);
|
QAccessibleInterface *dock1TitleBar = accDock1->child(0);
|
||||||
QCOMPARE(dock1TitleBar->role(), QAccessible::TitleBar);
|
QCOMPARE(dock1TitleBar->role(), QAccessible::TitleBar);
|
||||||
QVERIFY(accDock1->rect().contains(dock1TitleBar->rect()));
|
QVERIFY(accDock1->rect().contains(dock1TitleBar->rect()));
|
||||||
delete dock1TitleBar;
|
|
||||||
|
|
||||||
QPoint globalPos = dock1->mapToGlobal(QPoint(0,0));
|
QPoint globalPos = dock1->mapToGlobal(QPoint(0,0));
|
||||||
globalPos.rx()+=5; //### query style
|
globalPos.rx()+=5; //### query style
|
||||||
@ -3020,7 +3060,6 @@ void tst_QAccessibility::dockWidgetTest()
|
|||||||
QAccessibleInterface *childAt = accDock1->childAt(globalPos.x(), globalPos.y()); //###
|
QAccessibleInterface *childAt = accDock1->childAt(globalPos.x(), globalPos.y()); //###
|
||||||
QCOMPARE(childAt->role(), QAccessible::TitleBar);
|
QCOMPARE(childAt->role(), QAccessible::TitleBar);
|
||||||
int index = accDock1->indexOfChild(childAt);
|
int index = accDock1->indexOfChild(childAt);
|
||||||
delete childAt;
|
|
||||||
QAccessibleInterface *accTitleBar = accDock1->child(index);
|
QAccessibleInterface *accTitleBar = accDock1->child(index);
|
||||||
|
|
||||||
QCOMPARE(accTitleBar->role(), QAccessible::TitleBar);
|
QCOMPARE(accTitleBar->role(), QAccessible::TitleBar);
|
||||||
@ -3030,9 +3069,6 @@ void tst_QAccessibility::dockWidgetTest()
|
|||||||
QVERIFY(acc);
|
QVERIFY(acc);
|
||||||
QCOMPARE(acc->role(), QAccessible::Window);
|
QCOMPARE(acc->role(), QAccessible::Window);
|
||||||
|
|
||||||
|
|
||||||
delete accTitleBar;
|
|
||||||
delete accDock1;
|
|
||||||
delete pb1;
|
delete pb1;
|
||||||
delete pb2;
|
delete pb2;
|
||||||
delete dock1;
|
delete dock1;
|
||||||
@ -3082,7 +3118,6 @@ void tst_QAccessibility::comboBoxTest()
|
|||||||
iface->actionInterface()->doAction(QAccessibleActionInterface::showMenuAction());
|
iface->actionInterface()->doAction(QAccessibleActionInterface::showMenuAction());
|
||||||
QTRY_VERIFY(combo.view()->isVisible());
|
QTRY_VERIFY(combo.view()->isVisible());
|
||||||
|
|
||||||
delete iface;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // editable combobox
|
{ // editable combobox
|
||||||
@ -3102,10 +3137,6 @@ void tst_QAccessibility::comboBoxTest()
|
|||||||
QCOMPARE(listIface->role(), QAccessible::List);
|
QCOMPARE(listIface->role(), QAccessible::List);
|
||||||
QAccessibleInterface *editIface = iface->child(1);
|
QAccessibleInterface *editIface = iface->child(1);
|
||||||
QCOMPARE(editIface->role(), QAccessible::EditableText);
|
QCOMPARE(editIface->role(), QAccessible::EditableText);
|
||||||
|
|
||||||
delete listIface;
|
|
||||||
delete editIface;
|
|
||||||
delete iface;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QTestAccessibility::clearEvents();
|
QTestAccessibility::clearEvents();
|
||||||
@ -3128,7 +3159,6 @@ void tst_QAccessibility::labelTest()
|
|||||||
|
|
||||||
QCOMPARE(acc_label->text(QAccessible::Name), text);
|
QCOMPARE(acc_label->text(QAccessible::Name), text);
|
||||||
|
|
||||||
delete acc_label;
|
|
||||||
delete label;
|
delete label;
|
||||||
QTestAccessibility::clearEvents();
|
QTestAccessibility::clearEvents();
|
||||||
|
|
||||||
@ -3150,8 +3180,6 @@ void tst_QAccessibility::labelTest()
|
|||||||
const QPoint labelPos = imageLabel.mapToGlobal(QPoint(0,0));
|
const QPoint labelPos = imageLabel.mapToGlobal(QPoint(0,0));
|
||||||
QCOMPARE(imageInterface->imagePosition().topLeft(), labelPos);
|
QCOMPARE(imageInterface->imagePosition().topLeft(), labelPos);
|
||||||
|
|
||||||
delete acc_label;
|
|
||||||
|
|
||||||
QTestAccessibility::clearEvents();
|
QTestAccessibility::clearEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3421,8 +3449,9 @@ void tst_QAccessibility::bridgeTest()
|
|||||||
|
|
||||||
IAccessible *accTableCell = 0;
|
IAccessible *accTableCell = 0;
|
||||||
hr = ia2Table->get_cellAt(1, 2, (IUnknown**)&accTableCell);
|
hr = ia2Table->get_cellAt(1, 2, (IUnknown**)&accTableCell);
|
||||||
IAccessibleTableCell *ia2TableCell = (IAccessibleTableCell *)queryIA2(accTableCell, IID_IAccessibleTableCell);
|
|
||||||
QVERIFY(SUCCEEDED(hr));
|
QVERIFY(SUCCEEDED(hr));
|
||||||
|
QVERIFY(accTableCell);
|
||||||
|
IAccessibleTableCell *ia2TableCell = (IAccessibleTableCell *)queryIA2(accTableCell, IID_IAccessibleTableCell);
|
||||||
QVERIFY(ia2TableCell);
|
QVERIFY(ia2TableCell);
|
||||||
LONG index;
|
LONG index;
|
||||||
ia2TableCell->get_rowIndex(&index);
|
ia2TableCell->get_rowIndex(&index);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user