The Qt accessibility module
Design goals
Qt 4 Accessibility
Advantages:
Qt 4 Accessible Interface
// properties and state
virtual QString text(Text t, int child) const = 0;
virtual QRect rect(int child) const = 0;
virtual Role role(int child) const = 0;
virtual int state(int child) const = 0;
// hierarchy
virtual int childCount() const = 0;
virtual int indexOfChild(const QAccessibleInterface *) const = 0;
virtual int childAt(int x, int y) const = 0;
// relations
virtual int relationTo(int child, const QAccessibleInterface *other, int otherChild) const = 0;
// navigation
virtual int navigate(Relation relation, int index, QAccessibleInterface **iface) const = 0;
// action
virtual int userActionCount(int child) const = 0;
virtual QString actionText(int action, Text t, int child) const = 0;
virtual bool doAction(int action, int child, const QVariantList &ms = QVariantList()) = 0;
Qt 4 Accessible Interface
Advantages:
Qt 4 Accessible Interface
Accessible Plugins
class AccessibleFactory : public QAccessiblePlugin
{
public:
AccessibleFactory() {}
QStringList keys() const;
QAccessibleInterface *create(const QString &classname, QObject *object);
};
Accessible Plugins
QStringList AccessibleFactory::keys() const
{
QStringList list;
list << "MyWidget1" << "MyWidget2";
return list;
}
QAccessibleInterface *AccessibleFactory::create(const QString &classname, QObject *object)
{
if (classname == "MyWidget1")
return new MyWidget1Iface(object);
if (classname == "MyWidget2")
return new MyWidget2Iface(object);
return 0;
}
Q_EXPORT_PLUGIN(AccessibleFactory)
at-spi Integration
Qt Application
|
| links to
|
Qt Accessibility Module
|
| Plugin (in-process)
|
Qt ATK Bridge
|
| links to
|
ATK
|
| Plugin (in-process)
|
at-spi
|
| CORBA
|
assistive technologies
Qt 4.x accessibility
D-BUS: sending a signal
QDBusConnection con;
QDBusMessage message = QDBusMessage::signal(
"/org/harald/AccessibleRoot",
"org.harald.accessibility", "Ping");
message << QString("Give me a ping") << 42;
con.send(message);
D-BUS: receiving a signal
class AccessibleRoot: public QObject
{
public slots:
void pingReceived();
};
{
QDBusConnection con;
con.connect("/org/harald/AccessibleRoot",
"org.harald.accessibility", "Ping",
&o, SLOT(pingReceived()));
}
D-BUS: invoking a method
QDBusConnection con;
QDBusMessage message = QDBusMessage::methodCall(
":1.15", "/org/harald/AccessibleRoot",
"org.harald.accessibility", "Pong");
QDBusMessage reply = con.sendWithReply(message);
qDebug() << reply;
D-BUS: receiving method calls
class AccessibleRoot: public QObject
{
public:
Q_SCRIPTABLE void doSomething(int i, QString s, double d);
};
{
AccessibleRoot root;
QDBusConnection con;
con.registerObject("/com/harald/AccessibleRoot",
"com.harald.accessibility", &root)
}
Qt D-BUS bridge
Qt Application
|
| links to
|
Qt Accessibility Module
|
| Plugin (in-process)
|
Qt D-BUS bridge
|
| talks to
|
assistive technologies