source: trunk/doc/src/porting/qt4-accessibility.qdoc

Last change on this file was 846, checked in by Dmitry A. Kuminov, 14 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

  • Property svn:eol-style set to native
File size: 5.4 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4** All rights reserved.
5** Contact: Nokia Corporation (qt-info@nokia.com)
6**
7** This file is part of the documentation of the Qt Toolkit.
8**
9** $QT_BEGIN_LICENSE:FDL$
10** Commercial Usage
11** Licensees holding valid Qt Commercial licenses may use this file in
12** accordance with the Qt Commercial License Agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in a
14** written agreement between you and Nokia.
15**
16** GNU Free Documentation License
17** Alternatively, this file may be used under the terms of the GNU Free
18** Documentation License version 1.3 as published by the Free Software
19** Foundation and appearing in the file included in the packaging of this
20** file.
21**
22** If you have questions regarding the use of this file, please contact
23** Nokia at qt-info@nokia.com.
24** $QT_END_LICENSE$
25**
26****************************************************************************/
27
28/*!
29 \page qt4-accessibility.html
30 \title Cross-Platform Accessibility Support in Qt 4
31
32 \contentspage {What's New in Qt 4}{Home}
33 \previouspage The New Qt Designer
34 \nextpage The Qt 4 Database GUI Layer
35
36 Qt 4 allows developers to write cross-platform applications that
37 are usable by visually impaired users as well as by users with
38 other disabilities. Qt accessibility will make applications
39 accessible to more users and opens the governmental market, where
40 accessibility is often a requirement.
41
42 \section1 General Overview
43
44 The accessibility classes have been extended in
45 various ways since Qt 3. We added new functions and new enum
46 values, and revised the API to make it more consistent with the
47 rest of Qt. We also added two properties to QWidget,
48 \l{QWidget::accessibleName}{accessibleName} and
49 \l{QWidget::accessibleDescription}{accessibleDescription}, that
50 can be set in \e{Qt Designer} to provide basic help texts without
51 having to write any code.
52
53 Qt's accessibility architecture is as follows. Qt offers one
54 generic interface, QAccessibleInterface, that can be used to
55 wrap all widgets and objects (e.g., QPushButton). This single
56 interface provides all the metadata necessary for the assistive
57 technologies. Qt provides implementations of this interface for
58 its built-in widgets as plugins.
59
60 A more detailed overview of the accessibility support in Qt can
61 be found on the \l Accessibility page.
62
63 \section1 Enabling Accessibility Support
64
65 By default, Qt applications are run with accessibility support
66 enabled on Windows and Mac OS X. On Unix/X11 platforms, applications
67 must be launched in an environment with the \c QT_ACCESSIBILITY
68 variable set to 1. For example, this is set in the following way with
69 the bash shell:
70
71 \snippet doc/src/snippets/code/doc_src_qt4-accessibility.qdoc environment
72
73 Accessibility features are built into Qt by default when the libraries
74 are configured and built.
75
76 \section1 Creating New Accessible Interfaces
77
78 When you develop custom widgets, you can create custom subclasses
79 of QAccessibleInterface and distribute them as plugins (using
80 QAccessiblePlugin) or compile them into the application.
81 Likewise, Qt's predefined accessibility support can be built as
82 plugin (the default) or directly into the Qt library. The main
83 advantage of using plugins is that the accessibility classes are
84 only loaded into memory if they are actually used; they don't
85 slow down the common case where no assistive technology is being
86 used.
87
88 In addition to QAccessibleInterface, Qt includes two convenience
89 classes, QAccessibleObject and QAccessibleWidget, that
90 provide the lowest common denominator of metadata (e.g., widget
91 geometry, window title, basic help text). You can use them as
92 base classes when wrapping your custom QObject or QWidget
93 subclasses.
94
95 Another new feature in Qt 4 is that Qt can now support other
96 backends in addition to the predefined ones. This is done by
97 subclassing QAccessibleBridge.
98
99 \omit
100 \section1 Software Layering
101
102 Qt Application
103 | links to
104 Qt Accessibility Module
105 | Plugin (in-process)
106 Qt ATK Bridge
107 | links to
108 ATK
109 | Plugin (in-process)
110 at-spi
111 | CORBA
112 assistive technologies
113
114 Windows:
115
116 Qt Application
117 | links to
118 Qt Accessibility Module
119 | COM (?)
120 MSAA
121 | ?
122 assistive technologies
123
124 Mac:
125
126 ?
127 \endomit
128
129 \section1 Example Code
130
131 The first example illustrates how to provide accessibility
132 information for a custom widget. We can use QAccessibleWidget as
133 a base class and reimplement various functions:
134
135 \snippet doc/src/snippets/code/doc_src_qt4-accessibility.qdoc 0
136
137 Here's how we would implement the
138 \l{QAccessibleInterface::doAction()}{doAction()} function to call
139 a function named click() on the wrapped MyWidget object when the
140 user invokes the object's default action or "presses" it.
141
142 \snippet doc/src/snippets/code/doc_src_qt4-accessibility.qdoc 1
143
144 To export the widget interface as a plugin, we must subclass
145 QAccessibleFactory:
146
147 \snippet doc/src/snippets/code/doc_src_qt4-accessibility.qdoc 2
148*/
Note: See TracBrowser for help on using the repository browser.