Редактирование: Qt:Документация 4.3.2/accessible

Материал из Wiki.crossplatform.ru

Перейти к: навигация, поиск
Внимание: Вы не представились системе. Ваш IP-адрес будет записан в историю изменений этой страницы.
Правка может быть отменена. Пожалуйста, просмотрите сравнение версий, чтобы убедиться, что это именно те изменения, которые вас интересуют, и нажмите «Записать страницу», чтобы изменения вступили в силу.
Текущая версия Ваш текст
Строка 2: Строка 2:
=Accessibility<br />=
=Accessibility<br />=
-
*[[#introduction | Introduction]]
 
-
*[[#architecture | Architecture]]
 
-
**[[#accessibility-in-qt | Accessibility in Qt]]
 
-
**[[#the-accessible-object-tree | The Accessible Object Tree]]
 
-
**[[#the-static-qaccessible-functions | The Static QAccessible Functions]]
 
-
 
-
*[[#implementing-accessibility | Implementing Accessibility]]
 
-
**[[#the-qaccessibleobject-and-qaccessiblewidget-convenience-classes | The QAccessibleObject and QAccessibleWidget Convenience Classes]]
 
-
**[[#qaccessiblewidget-example | QAccessibleWidget Example]]
 
-
**[[#handling-action-requests-from-clients | Handling Action Requests from Clients]]
 
-
**[[#implementing-accessible-plugins | Implementing Accessible Plugins]]
 
-
**[[#implementing-interface-factories | Implementing Interface Factories]]
 
-
 
-
<div id="introduction"></div>
 
==Introduction==
==Introduction==
Accessibility in computer software is making applications usable for people with disabilities. This could be achieved by providing keyboard shortcuts, a high-contrast user interface that uses specially selected colors and fonts, or support for assistive tools such as screen readers and braille displays.
Accessibility in computer software is making applications usable for people with disabilities. This could be achieved by providing keyboard shortcuts, a high-contrast user interface that uses specially selected colors and fonts, or support for assistive tools such as screen readers and braille displays.
Строка 22: Строка 8:
In this overview document, we will examine the overall Qt accessibility architecture, and how to implement accessibility for custom widgets and elements.
In this overview document, we will examine the overall Qt accessibility architecture, and how to implement accessibility for custom widgets and elements.
-
<div id="architecture"></div>
+
 
==Architecture==
==Architecture==
Providing accessibility is a collaboration between accessibility compliant applications, the assistive technology, and the assistive tools.
Providing accessibility is a collaboration between accessibility compliant applications, the assistive technology, and the assistive tools.
Строка 31: Строка 17:
We will from now on focus on the Qt accessibility interface and how it is implemented to create Qt applications that support accessibility.
We will from now on focus on the Qt accessibility interface and how it is implemented to create Qt applications that support accessibility.
-
<div id="accessibility-in-qt"></div>
+
 
===Accessibility in Qt===
===Accessibility in Qt===
When we communicate with the assistive technologies, we need to describe Qt's user interface in a way that they can understand. Qt applications use [[Qt:Документация 4.3.2/qaccessibleinterface | QAccessibleInterface]] to expose information about the individual UI elements. Currently, Qt provides support for its widgets and widget parts, e.g&#x2e;, slider handles, but the interface could also be implemented for any [[Qt:Документация 4.3.2/qobject | QObject]] if necessary. [[Qt:Документация 4.3.2/qaccessible | QAccessible]] contains enums that describe the UI. The description is mainly based on MSAA and is independent of Qt. We will examine the enums in the course of this document.
When we communicate with the assistive technologies, we need to describe Qt's user interface in a way that they can understand. Qt applications use [[Qt:Документация 4.3.2/qaccessibleinterface | QAccessibleInterface]] to expose information about the individual UI elements. Currently, Qt provides support for its widgets and widget parts, e.g&#x2e;, slider handles, but the interface could also be implemented for any [[Qt:Документация 4.3.2/qobject | QObject]] if necessary. [[Qt:Документация 4.3.2/qaccessible | QAccessible]] contains enums that describe the UI. The description is mainly based on MSAA and is independent of Qt. We will examine the enums in the course of this document.
Строка 48: Строка 34:
The objects can be in a number of different states as defined by the [[Qt:Документация 4.3.2/qaccessible#StateFlag-enum | State]] enum. Examples of states are whether the object is disabled, if it has focus, or if it provides a popup menu.
The objects can be in a number of different states as defined by the [[Qt:Документация 4.3.2/qaccessible#StateFlag-enum | State]] enum. Examples of states are whether the object is disabled, if it has focus, or if it provides a popup menu.
-
<div id="the-accessible-object-tree"></div>
+
 
===The Accessible Object Tree===
===The Accessible Object Tree===
As mentioned, a tree structure is built from the accessible objects of an application. By navigating through the tree, the clients can access all elements in the UI. Object relations give clients information about the UI. For instance, a slider handle is a child of the slider to which it belongs. [[Qt:Документация 4.3.2/qaccessible#RelationFlag-enum | QAccessible::Relation]] describes the various relationships the clients can ask objects for.
As mentioned, a tree structure is built from the accessible objects of an application. By navigating through the tree, the clients can access all elements in the UI. Object relations give clients information about the UI. For instance, a slider handle is a child of the slider to which it belongs. [[Qt:Документация 4.3.2/qaccessible#RelationFlag-enum | QAccessible::Relation]] describes the various relationships the clients can ask objects for.
Строка 91: Строка 77:
|Sibling
|Sibling
|}
|}
-
<div id="the-static-qaccessible-functions"></div>
+
 
===The Static QAccessible Functions===
===The Static QAccessible Functions===
The accessibility is managed by [[Qt:Документация 4.3.2/qaccessible | QAccessible]]'s static functions, which we will examine shortly. They produce [[Qt:Документация 4.3.2/qaccessible | QAccessible]] interfaces, build the object tree, and initiate the connection with MSAA or the other platform specific technologies. If you are only interested in learning how to make your application accessible, you can safely skip over this section to [[#implementing-accessibility | Implementing Accessibility]].
The accessibility is managed by [[Qt:Документация 4.3.2/qaccessible | QAccessible]]'s static functions, which we will examine shortly. They produce [[Qt:Документация 4.3.2/qaccessible | QAccessible]] interfaces, build the object tree, and initiate the connection with MSAA or the other platform specific technologies. If you are only interested in learning how to make your application accessible, you can safely skip over this section to [[#implementing-accessibility | Implementing Accessibility]].
Строка 102: Строка 88:
The factory that produces accessibility interfaces for QObjects is a function of type [[Qt:Документация 4.3.2/qaccessible#InterfaceFactory-typedef | QAccessible::InterfaceFactory]]. It is possible to have several factories installed. The last factory installed will be the first to be asked for interfaces. [[Qt:Документация 4.3.2/qaccessible#queryAccessibleInterface | queryAccessibleInterface()]] uses the factories to create interfaces for [[Qt:Документация 4.3.2/qobject | QObject]]s. Normally, you need not be concerned about factories because you can implement plugins that produce interfaces. We will give examples of both approaches later.
The factory that produces accessibility interfaces for QObjects is a function of type [[Qt:Документация 4.3.2/qaccessible#InterfaceFactory-typedef | QAccessible::InterfaceFactory]]. It is possible to have several factories installed. The last factory installed will be the first to be asked for interfaces. [[Qt:Документация 4.3.2/qaccessible#queryAccessibleInterface | queryAccessibleInterface()]] uses the factories to create interfaces for [[Qt:Документация 4.3.2/qobject | QObject]]s. Normally, you need not be concerned about factories because you can implement plugins that produce interfaces. We will give examples of both approaches later.
-
<div id="implementing-accessibility"></div>
+
 
==Implementing Accessibility==
==Implementing Accessibility==
To provide accessibility support for a widget or other user interface element, you need to implement the [[Qt:Документация 4.3.2/qaccessibleinterface | QAccessibleInterface]] and distribute it in a [[Qt:Документация 4.3.2/qaccessibleplugin | QAccessiblePlugin]]. It is also possible to compile the interface into the application and provide a [[Qt:Документация 4.3.2/qaccessible#InterfaceFactory-typedef | QAccessible::InterfaceFactory]] for it. The factory can be used if you link statically or do not want the added complexity of plugins. This can be an advantage if you, for instance, are delivering a 3-rd party library.
To provide accessibility support for a widget or other user interface element, you need to implement the [[Qt:Документация 4.3.2/qaccessibleinterface | QAccessibleInterface]] and distribute it in a [[Qt:Документация 4.3.2/qaccessibleplugin | QAccessiblePlugin]]. It is also possible to compile the interface into the application and provide a [[Qt:Документация 4.3.2/qaccessible#InterfaceFactory-typedef | QAccessible::InterfaceFactory]] for it. The factory can be used if you link statically or do not want the added complexity of plugins. This can be an advantage if you, for instance, are delivering a 3-rd party library.
Строка 117: Строка 103:
It is possible to implement interfaces by inheriting [[Qt:Документация 4.3.2/qaccessibleinterface | QAccessibleInterface]] and implementing its pure virtual functions. In practice, however, it is usually preferable to inherit [[Qt:Документация 4.3.2/qaccessibleobject | QAccessibleObject]] or [[Qt:Документация 4.3.2/qaccessiblewidget | QAccessibleWidget]], which implement part of the functionality for you. In the next section, we will see an example of implementing accessibility for a widget by inheriting the [[Qt:Документация 4.3.2/qaccessiblewidget | QAccessibleWidget]] class.
It is possible to implement interfaces by inheriting [[Qt:Документация 4.3.2/qaccessibleinterface | QAccessibleInterface]] and implementing its pure virtual functions. In practice, however, it is usually preferable to inherit [[Qt:Документация 4.3.2/qaccessibleobject | QAccessibleObject]] or [[Qt:Документация 4.3.2/qaccessiblewidget | QAccessibleWidget]], which implement part of the functionality for you. In the next section, we will see an example of implementing accessibility for a widget by inheriting the [[Qt:Документация 4.3.2/qaccessiblewidget | QAccessibleWidget]] class.
-
<div id="the-qaccessibleobject-and-qaccessiblewidget-convenience-classes"></div>
+
 
===The QAccessibleObject and QAccessibleWidget Convenience Classes===
===The QAccessibleObject and QAccessibleWidget Convenience Classes===
When implementing an accessibility interface for widgets, one would as a rule inherit [[Qt:Документация 4.3.2/qaccessiblewidget | QAccessibleWidget]], which is a convenience class for widgets. Another available convenience class, which is inherited by [[Qt:Документация 4.3.2/qaccessiblewidget | QAccessibleWidget]], is the [[Qt:Документация 4.3.2/qaccessibleobject | QAccessibleObject]], which implements part of the interface for QObjects.
When implementing an accessibility interface for widgets, one would as a rule inherit [[Qt:Документация 4.3.2/qaccessiblewidget | QAccessibleWidget]], which is a convenience class for widgets. Another available convenience class, which is inherited by [[Qt:Документация 4.3.2/qaccessiblewidget | QAccessibleWidget]], is the [[Qt:Документация 4.3.2/qaccessibleobject | QAccessibleObject]], which implements part of the interface for QObjects.
Строка 129: Строка 115:
*It gives [[Qt:Документация 4.3.2/qaccessibleinterface#text | text()]] strings that are appropriate for a generic widget.
*It gives [[Qt:Документация 4.3.2/qaccessibleinterface#text | text()]] strings that are appropriate for a generic widget.
*It sets the [[Qt:Документация 4.3.2/qaccessible#StateFlag-enum | states]] that are common for all widgets.
*It sets the [[Qt:Документация 4.3.2/qaccessible#StateFlag-enum | states]] that are common for all widgets.
-
<div id="qaccessiblewidget-example"></div>
+
 
===QAccessibleWidget Example===
===QAccessibleWidget Example===
Instead of creating a custom widget and implementing an interface for it, we will show how accessibility can be implemented for one of Qt's standard widgets: [[Qt:Документация 4.3.2/qslider | QSlider]]. Making this widget accessible demonstrates many of the issues that need to be faced when making a custom widget accessible.
Instead of creating a custom widget and implementing an interface for it, we will show how accessibility can be implemented for one of Qt's standard widgets: [[Qt:Документация 4.3.2/qslider | QSlider]]. Making this widget accessible demonstrates many of the issues that need to be faced when making a custom widget accessible.
Строка 250: Строка 236:
We have now exposed the information we have about the slider to the clients. For the clients to be able to alter the slider - for example, to change its value - we must provide information about the actions that can be performed and perform them upon request. We discuss this in the next section.
We have now exposed the information we have about the slider to the clients. For the clients to be able to alter the slider - for example, to change its value - we must provide information about the actions that can be performed and perform them upon request. We discuss this in the next section.
-
<div id="handling-action-requests-from-clients"></div>
+
 
===Handling Action Requests from Clients===
===Handling Action Requests from Clients===
[[Qt:Документация 4.3.2/qaccessible | QAccessible]] provides a number of [[Qt:Документация 4.3.2/qaccessible#Action-enum | Action]]s that can be performed on request from clients. If an accessible object supports actions, it should reimplement the following functions from [[Qt:Документация 4.3.2/qaccessibleinterface | QAccessibleInterface]]:
[[Qt:Документация 4.3.2/qaccessible | QAccessible]] provides a number of [[Qt:Документация 4.3.2/qaccessible#Action-enum | Action]]s that can be performed on request from clients. If an accessible object supports actions, it should reimplement the following functions from [[Qt:Документация 4.3.2/qaccessibleinterface | QAccessibleInterface]]:
Строка 269: Строка 255:
To see examples on how to implement actions and methods, you could examine the [[Qt:Документация 4.3.2/qaccessibleobject | QAccessibleObject]] and [[Qt:Документация 4.3.2/qaccessiblewidget | QAccessibleWidget]] implementations. You might also want to take a look at the MSAA documentation.
To see examples on how to implement actions and methods, you could examine the [[Qt:Документация 4.3.2/qaccessibleobject | QAccessibleObject]] and [[Qt:Документация 4.3.2/qaccessiblewidget | QAccessibleWidget]] implementations. You might also want to take a look at the MSAA documentation.
-
<div id="implementing-accessible-plugins"></div>
+
 
===Implementing Accessible Plugins===
===Implementing Accessible Plugins===
In this section we will explain the procedure of implementing accessible plugins for your interfaces. A plugin is a class stored in a shared library that can be loaded at run-time. It is convenient to distribute interfaces as plugins since they will only be loaded when required.
In this section we will explain the procedure of implementing accessible plugins for your interfaces. A plugin is a class stored in a shared library that can be loaded at run-time. It is convenient to distribute interfaces as plugins since they will only be loaded when required.
Строка 298: Строка 284:
You can omit the the first macro unless you want the plugin to be statically linked with the application.
You can omit the the first macro unless you want the plugin to be statically linked with the application.
-
<div id="implementing-interface-factories"></div>
+
 
===Implementing Interface Factories===
===Implementing Interface Factories===
If you do not want to provide plugins for your accessibility interfaces, you can use an interface factory ([[Qt:Документация 4.3.2/qaccessible#InterfaceFactory-typedef | QAccessible::InterfaceFactory]]), which is the recommended way to provide accessible interfaces in a statically-linked application.
If you do not want to provide plugins for your accessibility interfaces, you can use an interface factory ([[Qt:Документация 4.3.2/qaccessible#InterfaceFactory-typedef | QAccessible::InterfaceFactory]]), which is the recommended way to provide accessible interfaces in a statically-linked application.

Пожалуйста, обратите внимание, что все ваши добавления могут быть отредактированы или удалены другими участниками. Если вы не хотите, чтобы кто-либо изменял ваши тексты, не помещайте их сюда.
Вы также подтверждаете, что являетесь автором вносимых дополнений, или скопировали их из источника, допускающего свободное распространение и изменение своего содержимого (см. Wiki.crossplatform.ru:Авторское право). НЕ РАЗМЕЩАЙТЕ БЕЗ РАЗРЕШЕНИЯ ОХРАНЯЕМЫЕ АВТОРСКИМ ПРАВОМ МАТЕРИАЛЫ!


Шаблоны, использованные на текущей версии страницы: