summaryrefslogtreecommitdiffstats
path: root/src/gui/accessible
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/accessible')
-rw-r--r--src/gui/accessible/qaccessible.cpp24
-rw-r--r--src/gui/accessible/qaccessible.h4
-rw-r--r--src/gui/accessible/qaccessible2.h8
-rw-r--r--src/gui/accessible/qaccessiblebridge.h4
-rw-r--r--src/gui/accessible/qaccessibleobject.cpp33
-rw-r--r--src/gui/accessible/qaccessibleobject.h4
-rw-r--r--src/gui/accessible/qaccessibleplugin.h4
-rw-r--r--src/gui/accessible/qplatformaccessibility.h4
8 files changed, 26 insertions, 59 deletions
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp
index 9b8e44f003..1d1b64117e 100644
--- a/src/gui/accessible/qaccessible.cpp
+++ b/src/gui/accessible/qaccessible.cpp
@@ -51,6 +51,7 @@
#include <QtCore/qdebug.h>
#include <QtCore/qmetaobject.h>
+#include <QtCore/qhash.h>
#include <private/qfactoryloader_p.h>
QT_BEGIN_NAMESPACE
@@ -430,6 +431,8 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
#endif
Q_GLOBAL_STATIC(QList<QAccessible::InterfaceFactory>, qAccessibleFactories)
+typedef QHash<QString, QAccessiblePlugin*> QAccessiblePluginsHash;
+Q_GLOBAL_STATIC(QAccessiblePluginsHash, qAccessiblePlugins);
QAccessible::UpdateHandler QAccessible::updateHandler = 0;
QAccessible::RootObjectHandler QAccessible::rootObjectHandler = 0;
@@ -580,9 +583,13 @@ QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object)
if (!object)
return 0;
+ // Create a QAccessibleInterface for the object class. Start by the most
+ // derived class and walk up the class hierarchy.
const QMetaObject *mo = object->metaObject();
while (mo) {
const QString cn = QLatin1String(mo->className());
+
+ // Check if the class has a InterfaceFactory installed.
for (int i = qAccessibleFactories()->count(); i > 0; --i) {
InterfaceFactory factory = qAccessibleFactories()->at(i - 1);
if (QAccessibleInterface *iface = factory(cn, object))
@@ -590,8 +597,21 @@ QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object)
}
#ifndef QT_NO_ACCESSIBILITY
#ifndef QT_NO_LIBRARY
- if (QAccessibleInterface * iface = qLoadPlugin1<QAccessibleInterface, QAccessiblePlugin>(loader(), cn, object))
- return iface;
+ // Find a QAccessiblePlugin (factory) for the class name. If there's
+ // no entry in the cache try to create it using the plugin loader.
+ if (!qAccessiblePlugins()->contains(cn)) {
+ QAccessiblePlugin *factory = 0; // 0 means "no plugin found". This is cached as well.
+ const int index = loader()->indexOf(cn);
+ if (index != -1)
+ factory = qobject_cast<QAccessiblePlugin *>(loader()->instance(index));
+ qAccessiblePlugins()->insert(cn, factory);
+ }
+
+ // At this point the cache should contain a valid factory pointer or 0:
+ Q_ASSERT(qAccessiblePlugins()->contains(cn));
+ QAccessiblePlugin *factory = qAccessiblePlugins()->value(cn);
+ if (factory)
+ return factory->create(cn, object);
#endif
#endif
mo = mo->superClass();
diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h
index d316ec4f10..016e9b6d07 100644
--- a/src/gui/accessible/qaccessible.h
+++ b/src/gui/accessible/qaccessible.h
@@ -53,8 +53,6 @@
#include <stdlib.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -678,6 +676,4 @@ inline void QAccessible::updateAccessibility(QObject *object, int child, Event r
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QACCESSIBLE_H
diff --git a/src/gui/accessible/qaccessible2.h b/src/gui/accessible/qaccessible2.h
index 2f95094584..169ca2b5e5 100644
--- a/src/gui/accessible/qaccessible2.h
+++ b/src/gui/accessible/qaccessible2.h
@@ -45,8 +45,6 @@
#include <QtGui/qaccessible.h>
#include <QtCore/qcoreapplication.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -186,9 +184,9 @@ public:
virtual bool isColumnSelected(int column) const = 0;
// Returns a boolean value indicating whether the specified row is completely selected.
virtual bool isRowSelected(int row) const = 0;
- // Selects a row and unselects all previously selected rows.
+ // Selects a row and it might unselect all previously selected rows.
virtual bool selectRow(int row) = 0;
- // Selects a column and unselects all previously selected columns.
+ // Selects a column it might unselect all previously selected columns.
virtual bool selectColumn(int column) = 0;
// Unselects one row, leaving other selected rows selected (if any).
virtual bool unselectRow(int row) = 0;
@@ -234,6 +232,4 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/gui/accessible/qaccessiblebridge.h b/src/gui/accessible/qaccessiblebridge.h
index 077996900b..0a0002af2c 100644
--- a/src/gui/accessible/qaccessiblebridge.h
+++ b/src/gui/accessible/qaccessiblebridge.h
@@ -45,8 +45,6 @@
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -79,6 +77,4 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QACCESSIBLEBRIDGE_H
diff --git a/src/gui/accessible/qaccessibleobject.cpp b/src/gui/accessible/qaccessibleobject.cpp
index af8787ae80..c1ef71e1fa 100644
--- a/src/gui/accessible/qaccessibleobject.cpp
+++ b/src/gui/accessible/qaccessibleobject.cpp
@@ -55,39 +55,8 @@ class QAccessibleObjectPrivate
{
public:
QPointer<QObject> object;
-
- QList<QByteArray> actionList() const;
};
-QList<QByteArray> QAccessibleObjectPrivate::actionList() const
-{
- QList<QByteArray> actionList;
-
- if (!object)
- return actionList;
-
- const QMetaObject *mo = object->metaObject();
- Q_ASSERT(mo);
-
- QByteArray defaultAction = QMetaObject::normalizedSignature(
- mo->classInfo(mo->indexOfClassInfo("DefaultSlot")).value());
-
- for (int i = 0; i < mo->methodCount(); ++i) {
- const QMetaMethod member = mo->method(i);
- if (member.methodType() != QMetaMethod::Slot && member.access() != QMetaMethod::Public)
- continue;
-
- if (!qstrcmp(member.tag(), "QACCESSIBLE_SLOT")) {
- if (member.methodSignature() == defaultAction)
- actionList.prepend(defaultAction);
- else
- actionList << member.methodSignature();
- }
- }
-
- return actionList;
-}
-
/*!
\class QAccessibleObject
\brief The QAccessibleObject class implements parts of the
@@ -224,6 +193,8 @@ int QAccessibleApplication::childCount() const
/*! \reimp */
int QAccessibleApplication::indexOfChild(const QAccessibleInterface *child) const
{
+ if (!child)
+ return -1;
const QObjectList tlw(topLevelObjects());
return tlw.indexOf(child->object());
}
diff --git a/src/gui/accessible/qaccessibleobject.h b/src/gui/accessible/qaccessibleobject.h
index abe55f38c6..fcbaa59dc9 100644
--- a/src/gui/accessible/qaccessibleobject.h
+++ b/src/gui/accessible/qaccessibleobject.h
@@ -45,8 +45,6 @@
#include <QtGui/qaccessible.h>
#include <QtGui/qaccessible2.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -101,6 +99,4 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QACCESSIBLEOBJECT_H
diff --git a/src/gui/accessible/qaccessibleplugin.h b/src/gui/accessible/qaccessibleplugin.h
index 6f7915d025..ac56c83f98 100644
--- a/src/gui/accessible/qaccessibleplugin.h
+++ b/src/gui/accessible/qaccessibleplugin.h
@@ -45,8 +45,6 @@
#include <QtGui/qaccessible.h>
#include <QtCore/qfactoryinterface.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -73,6 +71,4 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QACCESSIBLEPLUGIN_H
diff --git a/src/gui/accessible/qplatformaccessibility.h b/src/gui/accessible/qplatformaccessibility.h
index f10e8a7f12..26a22e492d 100644
--- a/src/gui/accessible/qplatformaccessibility.h
+++ b/src/gui/accessible/qplatformaccessibility.h
@@ -55,8 +55,6 @@
#include <QtGui/qaccessible.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -75,8 +73,6 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QT_NO_ACCESSIBILITY
#endif // QPLATFORMACCESSIBILITY_H