Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qaccessible.cpp
Go to the documentation of this file.
1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:critical reason:data-parser
4
5#include "qaccessible.h"
6
11#include <QtCore/qtextboundaryfinder.h>
12#include <QtGui/qclipboard.h>
13#include <QtGui/qguiapplication.h>
14#include <QtGui/qtextcursor.h>
15#include <private/qguiapplication_p.h>
16#include <qpa/qplatformaccessibility.h>
17#include <qpa/qplatformintegration.h>
18
19#include <QtCore/qdebug.h>
20#include <QtCore/qloggingcategory.h>
21#include <QtCore/qmetaobject.h>
22#include <QtCore/private/qmetaobject_p.h>
23#include <QtCore/qhash.h>
24#include <private/qfactoryloader_p.h>
25
26QT_BEGIN_NAMESPACE
27
28using namespace Qt::StringLiterals;
29
30Q_STATIC_LOGGING_CATEGORY(lcAccessibilityCore, "qt.accessibility.core");
31
32/*!
33 \class QAccessible
34 \brief The QAccessible class provides enums and static functions
35 related to accessibility.
36
37 \ingroup accessibility
38 \inmodule QtGui
39
40 This class is part of \l {Accessibility for QWidget Applications}.
41
42 Accessible applications can be used by people who are not able to
43 use applications by conventional means.
44
45 The functions in this class are used for communication between
46 accessible applications (also called AT Servers) and
47 accessibility tools (AT Clients), such as screen readers and
48 braille displays. Clients and servers communicate in the following way:
49
50 \list
51 \li \e{AT Servers} notify the clients about events through calls to the
52 updateAccessibility() function.
53
54 \li \e{AT Clients} request information about the objects in the server.
55 The QAccessibleInterface class is the core interface, and encapsulates
56 this information in a pure virtual API. Implementations of the interface
57 are provided by Qt through the queryAccessibleInterface() API.
58 \endlist
59
60 The communication between servers and clients is initialized by
61 the setRootObject() function. Function pointers can be installed
62 to replace or extend the default behavior of the static functions
63 in QAccessible.
64
65 Qt supports Microsoft Active Accessibility (MSAA), \macos
66 Accessibility, and the Unix/X11 AT-SPI standard. Other backends
67 can be supported using QAccessibleBridge.
68
69 In the Unix/X11 AT-SPI implementation, applications become accessible
70 when two conditions are met:
71 \list
72 \li org.a11y.Status.IsEnabled DBus property is true
73 \li org.a11y.Status.ScreenReaderEnabled DBus property is true
74 \endlist
75 An alternative to setting the DBus AT-SPI properties is to set
76 the QT_LINUX_ACCESSIBILITY_ALWAYS_ON environment variable.
77
78 In addition to QAccessible's static functions, Qt offers one
79 generic interface, QAccessibleInterface, that can be used to wrap
80 all widgets and objects (e.g., QPushButton). This single
81 interface provides all the metadata necessary for the assistive
82 technologies. Qt provides implementations of this interface for
83 its built-in widgets as plugins.
84
85 When you develop custom widgets, you can create custom subclasses
86 of QAccessibleInterface and distribute them as plugins (using
87 QAccessiblePlugin) or compile them into the application.
88 Likewise, Qt's predefined accessibility support can be built as
89 plugin (the default) or directly into the Qt library. The main
90 advantage of using plugins is that the accessibility classes are
91 only loaded into memory if they are actually used; they don't
92 slow down the common case where no assistive technology is being
93 used.
94
95 Qt also includes two convenience classes, QAccessibleObject and
96 QAccessibleWidget, that inherit from QAccessibleInterface and
97 provide the lowest common denominator of metadata (e.g., widget
98 geometry, window title, basic help text). You can use them as
99 base classes when wrapping your custom QObject or QWidget
100 subclasses.
101
102 \sa QAccessibleInterface
103*/
104
105
106/*!
107 \class QAccessible::State
108
109 \inmodule QtGui
110
111 This structure defines bit flags that indicate
112 the state of an accessible object. The values are:
113
114 \value active The object is the active window or the active sub-element in a container (that would get focus when focusing the container).
115 \value adjustable The object represents an adjustable value, e.g. sliders.
116 \value animated The object's appearance changes frequently.
117 \value busy The object cannot accept input at the moment.
118 \value checkable The object is checkable.
119 \value checked The object's check box is checked.
120 \value checkStateMixed The third state of checkboxes (half checked in tri-state check boxes).
121 \value collapsed The object is collapsed, e.g. a closed listview item, or an iconified window.
122 \value defaultButton The object represents the default button in a dialog.
123 \value defunct The object no longer exists.
124 \value editable The object has a text carret (and often implements the text interface).
125 \value expandable The object is expandable, mostly used for cells in a tree view.
126 \value expanded The object is expanded, currently its children are visible.
127 \value extSelectable The object supports extended selection.
128 \value focusable The object can receive focus. Only objects in the active window can receive focus.
129 \value focused The object has keyboard focus.
130 \value hasPopup The object opens a popup.
131 \value hotTracked The object's appearance is sensitive to the mouse cursor position.
132 \value invalid The object is no longer valid (because it has been deleted).
133 \value invisible The object is not visible to the user.
134 \value linked The object is linked to another object, e.g. a hyperlink.
135 \value marqueed The object displays scrolling contents, e.g. a log view.
136 \value modal The object blocks input from other objects.
137 \value movable The object can be moved.
138 \value multiLine The object has multiple lines of text (word wrap), as opposed to a single line.
139 \value multiSelectable The object supports multiple selected items.
140 \value offscreen The object is clipped by the visible area. Objects that are off screen are also invisible.
141 \value passwordEdit The object is a password field, e.g. a line edit for entering a Password.
142 \value playsSound The object produces sound when interacted with.
143 \value pressed The object is pressed.
144 \value readOnly The object can usually be edited, but is explicitly set to read-only.
145 \value searchEdit The object is a line edit that is the input for search queries.
146 \value selectable The object is selectable.
147 \value selectableText The object has text which can be selected. This is different from selectable which refers to the object's children.
148 \value selected The object is selected, this is independent of text selection.
149 \value selfVoicing The object describes itself through speech or sound.
150 \value sizeable The object can be resized, e.g. top-level windows.
151 \value summaryElement The object summarizes the state of the window and should be treated with priority.
152 \value supportsAutoCompletion The object has auto-completion, for example in line edits or combo boxes.
153 \value traversed The object is linked and has been visited.
154 \value updatesFrequently The object changes frequently and needs to be refreshed when accessing it.
155 \value disabled The object is unavailable to the user, e.g. a disabled widget.
156
157 Implementations of QAccessibleInterface::state() return a combination
158 of these flags.
159*/
160
161/*!
162 \fn QAccessible::State::State()
163
164 Constructs a new QAccessible::State with all states set to false.
165*/
166
167/*!
168 \enum QAccessible::Event
169
170 This enum type defines accessible event types.
171
172 \omitvalue InvalidEvent \omit Internal: Used when creating subclasses of QAccessibleEvent. \endomit
173 \value AcceleratorChanged The keyboard accelerator for an action has been changed.
174 \value ActionChanged An action has been changed.
175 \value ActiveDescendantChanged
176 \value Alert A system alert (e.g., a message from a QMessageBox)
177 \value [since 6.8] Announcement The announcement of a message is requested.
178 \value AttributeChanged
179 \value ContextHelpEnd Context help (QWhatsThis) for an object is finished.
180 \value ContextHelpStart Context help (QWhatsThis) for an object is initiated.
181 \value DefaultActionChanged The default QAccessible::Action for the accessible
182 object has changed.
183 \value DescriptionChanged The object's QAccessible::Description changed.
184 \value DialogEnd A dialog (QDialog) has been hidden
185 \value DialogStart A dialog (QDialog) has been set visible.
186 \value DocumentContentChanged The contents of a text document have changed.
187 \value DocumentLoadComplete A document has been loaded.
188 \value DocumentLoadStopped A document load has been stopped.
189 \value DocumentReload A document reload has been initiated.
190 \value DragDropEnd A drag and drop operation is about to finished.
191 \value DragDropStart A drag and drop operation is about to be initiated.
192 \value Focus An object has gained keyboard focus.
193 \value ForegroundChanged A window has been activated (i.e., a new window has
194 gained focus on the desktop).
195 \value HelpChanged The QAccessible::Help text property of an object has
196 changed.
197 \value HyperlinkEndIndexChanged The end position of the display text for a hypertext
198 link has changed.
199 \value HyperlinkNumberOfAnchorsChanged The number of anchors in a hypertext link has changed,
200 perhaps because the display text has been split to
201 provide more than one link.
202 \value HyperlinkSelectedLinkChanged The link for the selected hypertext link has changed.
203 \value HyperlinkStartIndexChanged The start position of the display text for a hypertext
204 link has changed.
205 \value HypertextChanged The display text for a hypertext link has changed.
206 \value HypertextLinkActivated A hypertext link has been activated, perhaps by being
207 clicked or via a key press.
208 \value HypertextLinkSelected A hypertext link has been selected.
209 \value HypertextNLinksChanged
210 \value [since 6.8] IdentifierChanged The identifier of an object has changed.
211 \value LocationChanged An object's location on the screen has changed.
212 \value MenuCommand A menu item is triggered.
213 \value MenuEnd A menu has been closed (Qt uses PopupMenuEnd for all
214 menus).
215 \value MenuStart A menu has been opened on the menubar (Qt uses
216 PopupMenuStart for all menus).
217 \value NameChanged The QAccessible::Name property of an object has changed.
218 \value ObjectAttributeChanged
219 \value ObjectCreated A new object is created.
220 \value ObjectDestroyed An object is deleted.
221 \value ObjectHide An object is hidden; for example, with QWidget::hide().
222 Any children the object that is hidden has do not send
223 this event. It is not sent when an object is hidden as
224 it is being obscured by others.
225 \value ObjectReorder A layout or item view has added, removed, or moved an
226 object (Qt does not use this event).
227 \value ObjectShow An object is displayed; for example, with
228 QWidget::show().
229 \value PageChanged
230 \value ParentChanged An object's parent object changed.
231 \value PopupMenuEnd A pop-up menu has closed.
232 \value PopupMenuStart A pop-up menu has opened.
233 \value [since 6.11] RoleChanged The role of an object has changed.
234 \value ScrollingEnd A scrollbar scroll operation has ended (the mouse has
235 released the slider handle).
236 \value ScrollingStart A scrollbar scroll operation is about to start; this may
237 be caused by a mouse press on the slider handle, for
238 example.
239 \value SectionChanged
240 \value SelectionAdd An item has been added to the selection in an item view.
241 \value SelectionRemove An item has been removed from an item view selection.
242 \value Selection The selection has changed in a menu or item view.
243 \value SelectionWithin Several changes to a selection has occurred in an item
244 view.
245 \value SoundPlayed A sound has been played by an object
246 \omitvalue StateChanged \omit The QAccessible::State of an object has changed.
247 This value is used internally for the QAccessibleStateChangeEvent. \endomit
248 \value TableCaptionChanged A table caption has been changed.
249 \value TableColumnDescriptionChanged The description of a table column, typically found in
250 the column's header, has been changed.
251 \value TableColumnHeaderChanged A table column header has been changed.
252 \omitvalue TableModelChanged \omit The model providing data for a table has been changed. \endomit
253 \value TableRowDescriptionChanged The description of a table row, typically found in the
254 row's header, has been changed.
255 \value TableRowHeaderChanged A table row header has been changed.
256 \value TableSummaryChanged The summary of a table has been changed.
257 \omitvalue TextAttributeChanged
258 \omitvalue TextCaretMoved \omit The caret has moved in an editable widget.
259 The caret represents the cursor position in an editable
260 widget with the input focus. \endomit
261 \value TextColumnChanged A text column has been changed.
262 \omitvalue TextInserted \omit Text has been inserted into an editable widget. \endomit
263 \omitvalue TextRemoved \omit Text has been removed from an editable widget. \endomit
264 \omitvalue TextSelectionChanged \omit The selected text has changed in an editable widget. \endomit
265 \omitvalue TextUpdated \omit The text has been update in an editable widget. \endomit
266 \omitvalue ValueChanged \omit The QAccessible::Value of an object has changed. \endomit
267 \value VisibleDataChanged
268
269 The values for this enum are defined to be the same as those defined in the
270 \l{AccessibleEventID.idl File Reference}{IAccessible2} and
271 \l{Microsoft Active Accessibility Event Constants}{MSAA} specifications.
272*/
273
274/*!
275 \enum QAccessible::Role
276
277 This enum defines the role of an accessible object. The roles are:
278
279 \value AlertMessage An object that is used to alert the user.
280 \value Animation An object that displays an animation.
281 \value Application The application's main window.
282 \value Assistant An object that provides interactive help.
283 \value [since 6.9] BlockQuote A section of content that is quoted from another source.
284 \value Border An object that represents a border.
285 \value ButtonDropDown A button that drops down a list of items.
286 \value ButtonDropGrid A button that drops down a grid.
287 \value ButtonMenu A button that drops down a menu.
288 \value Canvas An object that displays graphics that the user can interact with.
289 \value Caret An object that represents the system caret (text cursor).
290 \value Cell A cell in a table.
291 \value Chart An object that displays a graphical representation of data.
292 \value CheckBox An object that represents an option that can be checked or unchecked. Some options provide a "mixed" state, e.g. neither checked nor unchecked.
293 \value Client The client area in a window.
294 \value Clock A clock displaying time.
295 \value ColorChooser A dialog that lets the user choose a color.
296 \value Column A column of cells, usually within a table.
297 \value ColumnHeader A header for a column of data.
298 \value ComboBox A list of choices that the user can select from.
299 \value ComplementaryContent A part of the document or web page that is complementary to the main content, usually a landmark (see WAI-ARIA).
300 \value Cursor An object that represents the mouse cursor.
301 \value Desktop The object represents the desktop or workspace.
302 \value Dial An object that represents a dial or knob.
303 \value Dialog A dialog box.
304 \value Document A document, for example in an office application.
305 \value EditableText Editable text such as a line or text edit.
306 \value Equation An object that represents a mathematical equation.
307 \value Footer A footer in a page (usually in documents).
308 \value Form A web form containing controls.
309 \value Graphic A graphic or picture, e.g. an icon.
310 \value Grip A grip that the user can drag to change the size of widgets.
311 \value Grouping An object that represents a logical grouping of other objects.
312 \value Heading A heading in a document.
313 \value HelpBalloon An object that displays help in a separate, short lived window.
314 \value HotkeyField A hotkey field that allows the user to enter a key sequence.
315 \value Indicator An indicator that represents a current value or item.
316 \value LayeredPane An object that can contain layered children, e.g. in a stack.
317 \value Link A link to something else.
318 \value List A list of items, from which the user can select one or more items.
319 \value ListItem An item in a list of items.
320 \value MenuBar A menu bar from which menus are opened by the user.
321 \value MenuItem An item in a menu or menu bar.
322 \value NoRole The object has no role. This usually indicates an invalid object.
323 \value Note A section whose content is parenthetic or ancillary to the main content of the resource.
324 \value Notification An object that represents a notification (e.g. in the system tray). This role only has an effect on Linux.
325 \value PageTab A page tab that the user can select to switch to a different page in a dialog.
326 \value PageTabList A list of page tabs.
327 \value Paragraph A paragraph of text (usually found in documents).
328 \value Pane A generic container.
329 \value PopupMenu A menu which lists options that the user can select to perform an action.
330 \value ProgressBar The object displays the progress of an operation in progress.
331 \value PropertyPage A property page where the user can change options and settings.
332 \value Button A button.
333 \value RadioButton An object that represents an option that is mutually exclusive with other options.
334 \value Row A row of cells, usually within a table.
335 \value RowHeader A header for a row of data.
336 \value ScrollBar A scroll bar, which allows the user to scroll the visible area.
337 \value Section A section (in a document).
338 \value Separator A separator that divides space into logical areas.
339 \value Slider A slider that allows the user to select a value within a given range.
340 \value Sound An object that represents a sound.
341 \value SpinBox A spin box widget that allows the user to enter a value within a given range.
342 \value Splitter A splitter distributing available space between its child widgets.
343 \value StaticText Static text, such as labels for other widgets.
344 \value StatusBar A status bar.
345 \value [since 6.11] Switch A switch that can be toggled on or off.
346 \value Table A table representing data in a grid of rows and columns.
347 \value Terminal A terminal or command line interface.
348 \value TitleBar The title bar caption of a window.
349 \value ToolBar A tool bar, which groups widgets that the user accesses frequently.
350 \value ToolTip A tool tip which provides information about other objects.
351 \value Tree A list of items in a tree structure.
352 \value TreeItem An item in a tree structure.
353 \value UserRole The first value to be used for user defined roles.
354 \value WebDocument HTML document, usually in a browser.
355 \value Whitespace Blank space between other objects.
356 \value Window A top level window.
357*/
358
359/*!
360 \enum QAccessible::RelationFlag
361
362 This enum type defines bit flags that can be combined to indicate
363 the relationship between two accessible objects. It is used by
364 the relations() function, which returns a list of all the related
365 interfaces of the calling object, together with the relations
366 for each object.
367
368 Each entry in the list is a std::pair where the \c second member stores
369 the relation type(s) between the \c returned object represented by the
370 \c first member and the \c origin (the caller) interface/object.
371
372 In the table below, the \c returned object refers to the object in
373 the returned list, and the \c origin object is the one represented
374 by the calling interface.
375
376 \value Label The \c returned object is the label for the \c origin object.
377 \value Labelled The \c returned object is labelled by the \c origin object.
378 \value Controller The \c returned object controls the \c origin object.
379 \value Controlled The \c returned object is controlled by the \c origin object.
380 \value [since 6.6] DescriptionFor The \c returned object provides a description for the \c origin object.
381 \value [since 6.6] Described The \c returned object is described by the \c origin object.
382 \value [since 6.6] FlowsFrom Content logically flows from the \c returned object to the \c origin object.
383 \value [since 6.6] FlowsTo Content logically flows to the \c returned object from the \c origin object.
384 \value AllRelations Used as a mask to specify that we are interesting in information
385 about all relations
386
387 Implementations of relations() return a combination of these flags.
388 Some values are mutually exclusive.
389*/
390
391/*!
392 \enum QAccessible::Text
393
394 This enum specifies string information that an accessible object
395 returns.
396
397 \value Name The name of the object. This can be used both
398 as an identifier or a short description by
399 accessible clients.
400 \value Description A short text describing the object.
401 \value Value The value of the object.
402 \value Help A longer text giving information about how to use the object.
403 \value Accelerator The keyboard shortcut that executes the object's default action.
404 \value UserText The first value to be used for user defined text.
405 \value [since 6.8] Identifier An identifier for the object for e.g. UI tests.
406 \omitvalue DebugDescription
407*/
408
409/*! \enum QAccessible::TextBoundaryType
410 This enum describes different types of text boundaries. It follows the IAccessible2 API and is used in the \l QAccessibleTextInterface.
411
412 \value CharBoundary Use individual characters as boundary.
413 \value WordBoundary Use words as boundaries.
414 \value SentenceBoundary Use sentences as boundary.
415 \value ParagraphBoundary Use paragraphs as boundary.
416 \value LineBoundary Use newlines as boundary.
417 \value NoBoundary No boundary (use the whole text).
418
419 \sa QAccessibleTextInterface
420*/
421
422/*! \enum QAccessible::Attribute
423 This enum describes different types of attributes used by the
424 \l QAccessibleAttributesInterface.
425 \since 6.8
426
427 These attributes are comparable to the concept of properties/(object)
428 attributes found in ARIA, AT-SPI2, IAccessible, UIA and NSAccessibility
429 and are mapped to their platform counterpart where applicable.
430
431 Each attribute is handled as a key-value pair, with the values of this
432 enumeration being used as keys.
433
434 Attribute values are represented in a \l QVariant. The type of the value
435 stored in the \l QVariant is fixed and specified below for each of the
436 attribute types.
437
438 \value Custom value type: \a QHash<QString, QString>
439 The \a Custom attribute is special in that
440 it can effectively represent multiple attributes at
441 once, since it itself is a \l QHash used to represent
442 key-value pairs.
443 For platforms supporting custom key-value pairs for
444 attributes, those set in the \a Custom attribute
445 are bridged to the platform layer without applying any
446 translation to platform-specific attributes. In general,
447 the other, more strongly typed attributes should be used.
448 This attribute can e.g. be used for prototyping
449 before officially adding an official new enumeration value
450 for a specific feature.
451 \value Level value type: \a int
452 Defines the hierarchical level of an element within a structure,
453 e.g. the heading level of a heading. This attribute conceptually
454 matches the "aria-level" property in ARIA.
455 \value [since 6.10] Locale value type: \a QLocale
456 Locale of the element.
457 This can be used to specify that an element has a locale that
458 differs from the application's default locale, e.g. for documents
459 or paragraphs within a document that use a language that differs
460 from the application's user interface language.
461 \value [since 6.11] Orientation value type: \a Qt::Orientation
462 Orientation of the element. This attribute conceptually matches
463 the "aria-orientation" property in ARIA.
464
465 \sa QAccessibleAttributesInterface
466*/
467
468/*! \enum QAccessible::AnnouncementPoliteness
469 This enum describes the priority for announcements used by the
470 \l QAccessibleAnnouncementEvent.
471 \since 6.8
472
473 With \a QAccessible::AnouncementPoliteness::Polite, assistive technologies
474 should announce the message at the next graceful opportunity such as at the
475 end of speaking the current sentence or when the user pauses typing.
476
477 When specifying \a QAccessible::AnouncementPoliteness::Assertive, assistive
478 technologies should notify the user immediately.
479
480 Because an interruption might disorient users or cause them to not complete
481 their current task, \a QAccessible::AnouncementPoliteness::Assertive should
482 not be used unless the interruption is imperative.
483
484 \value Polite The announcement has normal priority.
485 \value Assertive The announcement has high priority and should notify
486 the user immediately, even if that means interrupting the user's
487 current task.
488
489 \sa QAccessibleAnnouncementEvent
490*/
491
492
493/*!
494 \enum QAccessible::InterfaceType
495
496 \l QAccessibleInterface supports several sub interfaces.
497 In order to provide more information about some objects, their accessible
498 representation should implement one or more of these interfaces.
499
500 \note When subclassing one of these interfaces, \l QAccessibleInterface::interface_cast() needs to be implemented.
501
502 \value TextInterface For text that supports selections or is more than one line. Simple labels do not need to implement this interface.
503 \omitvalue EditableTextInterface \omit For text that can be edited by the user. \endomit
504 \value ValueInterface For objects that are used to manipulate a value, for example slider or scroll bar.
505 \value ActionInterface For interactive objects that allow the user to trigger an action. Basically everything that allows for example mouse interaction.
506 \omitvalue ImageInterface \omit For objects that represent an image. This interface is generally less important. \endomit
507 \value TableInterface For lists, tables and trees.
508 \value TableCellInterface For cells in a TableInterface object.
509 \value HyperlinkInterface For hyperlink nodes (usually embedded as children of text nodes)
510 \value [since 6.5] SelectionInterface For non-text objects that support selection of child objects.
511 \value [since 6.8] AttributesInterface For objects that support object-specific attributes.
512
513 \sa QAccessibleInterface::interface_cast(), QAccessibleTextInterface, QAccessibleValueInterface, QAccessibleActionInterface, QAccessibleTableInterface, QAccessibleTableCellInterface, QAccessibleSelectionInterface, QAccessibleAttributesInterface
514*/
515
516#if QT_CONFIG(accessibility)
517
518/*!
519 Destroys the QAccessibleInterface.
520*/
521QAccessibleInterface::~QAccessibleInterface()
522{
523}
524
525/*!
526 \typedef QAccessible::Id
527
528 Synonym for unsigned, used by the QAccessibleInterface cache.
529*/
530
531
532/* accessible widgets plugin discovery stuff */
533Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, acLoader,
534 (QAccessibleFactoryInterface_iid, "/accessible"_L1))
535typedef QHash<QString, QAccessiblePlugin*> QAccessiblePluginsHash;
536Q_GLOBAL_STATIC(QAccessiblePluginsHash, qAccessiblePlugins)
537
538// FIXME turn this into one global static struct
539Q_GLOBAL_STATIC(QList<QAccessible::InterfaceFactory>, qAccessibleFactories)
540Q_GLOBAL_STATIC(QList<QAccessible::ActivationObserver *>, qAccessibleActivationObservers)
541
542QAccessible::UpdateHandler QAccessible::updateHandler = nullptr;
543QAccessible::RootObjectHandler QAccessible::rootObjectHandler = nullptr;
544
545static bool cleanupAdded = false;
546
547static QPlatformAccessibility *platformAccessibility()
548{
549 QPlatformIntegration *pfIntegration = QGuiApplicationPrivate::platformIntegration();
550 return pfIntegration ? pfIntegration->accessibility() : nullptr;
551}
552
553/*!
554 \fn QAccessible::QAccessible()
555 \internal
556
557 This class is purely a collection of enums and static functions,
558 it is not supposed to be instantiated.
559*/
560
561
562/*!
563 \internal
564*/
565void QAccessible::cleanup()
566{
567 if (QPlatformAccessibility *pfAccessibility = platformAccessibility())
568 pfAccessibility->cleanup();
569}
570
571static void qAccessibleCleanup()
572{
573 qAccessibleActivationObservers()->clear();
574 qAccessibleFactories()->clear();
575}
576
577/*!
578 \typedef QAccessible::InterfaceFactory
579
580 This is a typedef for a pointer to a function with the following
581 signature:
582
583 \snippet code/src_gui_accessible_qaccessible.cpp 1
584
585 The function receives a QString and a QObject pointer, where the
586 QString is the key identifying the interface. The QObject is used
587 to pass on to the QAccessibleInterface so that it can hold a reference
588 to it.
589
590 If the key and the QObject does not have a corresponding
591 QAccessibleInterface, \nullptr will be returned.
592
593 Installed factories are called by queryAccessibilityInterface() until
594 one provides an interface.
595*/
596
597/*!
598 \typedef QAccessible::UpdateHandler
599
600 \internal
601
602 A function pointer type. Use a function with this prototype to install
603 your own update function.
604
605 The function is called by updateAccessibility().
606*/
607
608/*!
609 \typedef QAccessible::RootObjectHandler
610
611 \internal
612
613 A function pointer type. Use a function with this prototype to install
614 your own root object handler.
615
616 The function is called by setRootObject().
617*/
618
619
620/*!
621 Installs the InterfaceFactory \a factory. The last factory added
622 is the first one used by queryAccessibleInterface().
623*/
624void QAccessible::installFactory(InterfaceFactory factory)
625{
626 if (!factory)
627 return;
628
629 if (!cleanupAdded) {
630 qAddPostRoutine(qAccessibleCleanup);
631 cleanupAdded = true;
632 }
633 if (qAccessibleFactories()->contains(factory))
634 return;
635 qAccessibleFactories()->append(factory);
636}
637
638/*!
639 Removes \a factory from the list of installed InterfaceFactories.
640*/
641void QAccessible::removeFactory(InterfaceFactory factory)
642{
643 qAccessibleFactories()->removeAll(factory);
644}
645
646/*!
647 \internal
648
649 Installs the given \a handler as the function to be used by
650 updateAccessibility(), and returns the previously installed
651 handler.
652*/
653QAccessible::UpdateHandler QAccessible::installUpdateHandler(UpdateHandler handler)
654{
655 UpdateHandler old = updateHandler;
656 updateHandler = handler;
657 return old;
658}
659
660/*!
661 \internal
662
663 Installs the given \a handler as the function to be used by setRootObject(),
664 and returns the previously installed handler.
665*/
666QAccessible::RootObjectHandler QAccessible::installRootObjectHandler(RootObjectHandler handler)
667{
668 RootObjectHandler old = rootObjectHandler;
669 rootObjectHandler = handler;
670 return old;
671}
672
673/*!
674 \class QAccessible::ActivationObserver
675 \internal
676
677 Interface to listen to activation or deactivation of the accessibility framework.
678 \sa installActivationObserver()
679*/
680
681QAccessible::ActivationObserver::~ActivationObserver()
682{
683}
684
685/*!
686 \internal
687
688 Install \a observer to get notified of activation or deactivation (global accessibility has been enabled or disabled).
689*/
690void QAccessible::installActivationObserver(QAccessible::ActivationObserver *observer)
691{
692 if (!observer)
693 return;
694
695 if (!cleanupAdded) {
696 qAddPostRoutine(qAccessibleCleanup);
697 cleanupAdded = true;
698 }
699 if (qAccessibleActivationObservers()->contains(observer))
700 return;
701 qAccessibleActivationObservers()->append(observer);
702
703 // Make sure the newly added observer gets a callback on the next
704 // QPlatformAccessibility::setActive() callback
705 if (QPlatformAccessibility *pfAccessibility = platformAccessibility())
706 pfAccessibility->clearActiveNotificationState();
707}
708
709/*!
710 \internal
711
712 Remove an \a observer to no longer get notified of state changes.
713 \sa installActivationObserver()
714*/
715void QAccessible::removeActivationObserver(ActivationObserver *observer)
716{
717 qAccessibleActivationObservers()->removeAll(observer);
718}
719
720/*!
721 \internal
722
723 Sends accessibility activation notifications to all registered observers.
724*/
725void qAccessibleNotifyActivationObservers(bool active)
726{
727 for (int i = 0; i < qAccessibleActivationObservers()->size(); ++i)
728 qAccessibleActivationObservers()->at(i)->accessibilityActiveChanged(active);
729}
730
731/*!
732 If a QAccessibleInterface implementation exists for the given \a object,
733 this function returns a pointer to the implementation; otherwise it
734 returns \nullptr.
735
736 The function calls all installed factory functions (from most
737 recently installed to least recently installed) until one is found
738 that provides an interface for the class of \a object. If no
739 factory can provide an accessibility implementation for the class
740 the function loads installed accessibility plugins, and tests if
741 any of the plugins can provide the implementation.
742
743 If no implementation for the object's class is available, the
744 function tries to find an implementation for the object's parent
745 class, using the above strategy.
746
747 All interfaces are managed by an internal cache and should not be deleted.
748*/
749QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object)
750{
751 if (!object)
752 return nullptr;
753
754 if (Id id = QAccessibleCache::instance()->idForObject(object))
755 return QAccessibleCache::instance()->interfaceForId(id);
756
757 // Create a QAccessibleInterface for the object class. Start by the most
758 // derived class and walk up the class hierarchy.
759 const QMetaObject *mo = object->metaObject();
760 const auto *objectPriv = QObjectPrivate::get(object);
761 /*
762 We do not want to cache each and every QML metaobject (Button_QMLTYPE_124,
763 Button_QMLTYPE_125, etc.). Those dynamic metaobjects shouldn't have an
764 accessible interface in any case. Instead, we start the whole checking
765 with the first non-dynamic meta-object. To avoid potential regressions
766 in other areas of Qt that also use dynamic metaobjects, we only do this
767 for objects that are QML-related (approximated by checking whether they
768 have ddata set).
769 */
770 const bool qmlRelated = !objectPriv->isDeletingChildren &&
771 objectPriv->declarativeData;
772 while (qmlRelated && mo) {
773 auto mop = QMetaObjectPrivate::get(mo);
774 if (!mop || !(mop->flags & DynamicMetaObject))
775 break;
776
777 mo = mo->superClass();
778 };
779 while (mo) {
780 const QString cn = QLatin1StringView(mo->className());
781
782 // Check if the class has a InterfaceFactory installed.
783 for (int i = qAccessibleFactories()->size(); i > 0; --i) {
784 InterfaceFactory factory = qAccessibleFactories()->at(i - 1);
785 if (QAccessibleInterface *iface = factory(cn, object)) {
786 QAccessibleCache::instance()->insert(object, iface);
787 Q_ASSERT(QAccessibleCache::instance()->containsObject(object));
788 return iface;
789 }
790 }
791 // Find a QAccessiblePlugin (factory) for the class name. If there's
792 // no entry in the cache try to create it using the plugin loader.
793 if (!qAccessiblePlugins()->contains(cn)) {
794 QAccessiblePlugin *factory = nullptr; // 0 means "no plugin found". This is cached as well.
795 const int index = acLoader()->indexOf(cn);
796 if (index != -1)
797 factory = qobject_cast<QAccessiblePlugin *>(acLoader()->instance(index));
798 qAccessiblePlugins()->insert(cn, factory);
799 }
800
801 // At this point the cache should contain a valid factory pointer or 0:
802 Q_ASSERT(qAccessiblePlugins()->contains(cn));
803 QAccessiblePlugin *factory = qAccessiblePlugins()->value(cn);
804 if (factory) {
805 QAccessibleInterface *result = factory->create(cn, object);
806 if (result) {
807 QAccessibleCache::instance()->insert(object, result);
808 Q_ASSERT(QAccessibleCache::instance()->containsObject(object));
809 }
810 return result;
811 }
812 mo = mo->superClass();
813 }
814
815 if (object == qApp) {
816 QAccessibleInterface *appInterface = new QAccessibleApplication;
817 QAccessibleCache::instance()->insert(object, appInterface);
818 Q_ASSERT(QAccessibleCache::instance()->containsObject(qApp));
819 return appInterface;
820 }
821
822 return nullptr;
823}
824
825/*!
826 \brief Call this function to ensure that manually created interfaces
827 are properly memory managed.
828
829 Must only be called exactly once per interface \a iface.
830 This is implicitly called when calling queryAccessibleInterface,
831 calling this function is only required when QAccessibleInterfaces
832 are instantiated with the "new" operator. This is not recommended,
833 whenever possible use the default functions and let \l queryAccessibleInterface()
834 take care of this.
835
836 When it is necessary to reimplement the QAccessibleInterface::child() function
837 and returning the child after constructing it, this function needs to be called.
838 */
839QAccessible::Id QAccessible::registerAccessibleInterface(QAccessibleInterface *iface)
840{
841 Q_ASSERT(iface);
842 return QAccessibleCache::instance()->insert(iface->object(), iface);
843}
844
845/*!
846 Removes the interface belonging to this \a id from the cache and
847 deletes it. The id becomes invalid an may be re-used by the
848 cache.
849*/
850void QAccessible::deleteAccessibleInterface(Id id)
851{
852 QAccessibleCache::instance()->deleteInterface(id);
853}
854
855/*!
856 Returns the unique ID for the QAccessibleInterface \a iface.
857*/
858QAccessible::Id QAccessible::uniqueId(QAccessibleInterface *iface)
859{
860 Id id = QAccessibleCache::instance()->idForInterface(iface);
861 if (!id)
862 id = registerAccessibleInterface(iface);
863 return id;
864}
865
866/*!
867 Returns the QAccessibleInterface belonging to the \a id.
868
869 Returns \nullptr if the id is invalid.
870*/
871QAccessibleInterface *QAccessible::accessibleInterface(Id id)
872{
873 return QAccessibleCache::instance()->interfaceForId(id);
874}
875
876
877/*!
878 Returns \c true if the platform requested accessibility information.
879
880 This function will return false until a tool such as a screen reader
881 accessed the accessibility framework. It is still possible to use
882 \l QAccessible::queryAccessibleInterface() even if accessibility is not
883 active. But there will be no notifications sent to the platform.
884
885 It is recommended to use this function to prevent expensive notifications
886 via updateAccessibility() when they are not needed.
887*/
888bool QAccessible::isActive()
889{
890 if (QPlatformAccessibility *pfAccessibility = platformAccessibility())
891 return pfAccessibility->isActive();
892 return false;
893}
894
895/*!
896 \internal
897*/
898void QAccessible::setActive(bool active)
899{
900 if (QPlatformAccessibility *pfAccessibility = platformAccessibility())
901 pfAccessibility->setActive(active);
902}
903
904/*!
905 Sets the root object of the accessible objects of this application
906 to \a object. All other accessible objects are reachable using object
907 navigation from the root object.
908
909 Normally, it isn't necessary to call this function, because Qt sets
910 the QApplication object as the root object immediately before the
911 event loop is entered in QApplication::exec().
912
913 Use QAccessible::installRootObjectHandler() to redirect the function
914 call to a customized handler function.
915
916 \sa queryAccessibleInterface()
917*/
918void QAccessible::setRootObject(QObject *object)
919{
920 if (rootObjectHandler) {
921 rootObjectHandler(object);
922 return;
923 }
924
925 if (QPlatformAccessibility *pfAccessibility = platformAccessibility())
926 pfAccessibility->setRootObject(object);
927}
928
929/*!
930 Notifies about a change that might be relevant for accessibility clients.
931
932 \a event provides details about the change. These include the source
933 of the change and the nature of the change. The \a event should
934 contain enough information give meaningful notifications.
935
936 For example, the type \c ValueChange indicates that the position of
937 a slider has been changed.
938
939 Call this function whenever the state of your accessible object or
940 one of its sub-elements has been changed either programmatically
941 (e.g. by calling QLabel::setText()) or by user interaction.
942
943 If there are no accessibility tools listening to this event, the
944 performance penalty for calling this function is small, but if
945 determining the parameters of the call is expensive you can test
946 QAccessible::isActive() to avoid unnecessary computation.
947*/
948void QAccessible::updateAccessibility(QAccessibleEvent *event)
949{
950 // NOTE: Querying for the accessibleInterface below will result in
951 // resolving and caching the interface, which in some cases will
952 // cache the wrong information as updateAccessibility is called
953 // during construction of widgets. If you see cases where the
954 // cache seems wrong, this call is "to blame", but the code that
955 // caches dynamic data should be updated to handle change events.
956 if (isActive()) {
957 QAccessibleInterface *iface = event->accessibleInterface();
958 if (iface) {
959 if (event->type() == QAccessible::TableModelChanged) {
960 if (iface->tableInterface())
961 iface->tableInterface()->modelChange(static_cast<QAccessibleTableModelChangeEvent*>(event));
962 }
963 }
964 }
965 if (updateHandler) {
966 updateHandler(event);
967 return;
968 }
969
970 if (QPlatformAccessibility *pfAccessibility = platformAccessibility())
971 pfAccessibility->notifyAccessibilityUpdate(event);
972}
973
974static std::pair<int, int> qAccessibleTextBoundaryHelperHelper(QTextCursor &cursor,
975 QTextCursor::MoveOperation start,
976 QTextCursor::MoveOperation end)
977{
978 std::pair<int, int> result;
979 cursor.movePosition(start, QTextCursor::MoveAnchor);
980 result.first = cursor.position();
981 cursor.movePosition(end, QTextCursor::KeepAnchor);
982 result.second = cursor.position();
983 return result;
984}
985
986/*!
987 \internal
988 \brief qAccessibleTextBoundaryHelper is a helper function to find the accessible text boundaries for QTextCursor based documents.
989 \param documentCursor a valid cursor bound to the document (not null). It needs to ba at the position to look for the boundary
990 \param boundaryType the type of boundary to find
991 \return the boundaries as pair
992*/
993std::pair< int, int > QAccessible::qAccessibleTextBoundaryHelper(const QTextCursor &offsetCursor, TextBoundaryType boundaryType)
994{
995 Q_ASSERT(!offsetCursor.isNull());
996
997 QTextCursor cursor = offsetCursor;
998 switch (boundaryType) {
999 case CharBoundary:
1000 return qAccessibleTextBoundaryHelperHelper(cursor, QTextCursor::NoMove,
1001 QTextCursor::NextCharacter);
1002 case WordBoundary:
1003 return qAccessibleTextBoundaryHelperHelper(cursor, QTextCursor::StartOfWord,
1004 QTextCursor::EndOfWord);
1005 case SentenceBoundary: {
1006 // QCursor does not provide functionality to move to next sentence.
1007 // We therefore find the current block, then go through the block using
1008 // QTextBoundaryFinder and find the sentence the \offset represents
1009 std::pair<int, int> result = qAccessibleTextBoundaryHelperHelper(
1010 cursor, QTextCursor::StartOfBlock, QTextCursor::EndOfBlock);
1011 QString blockText = cursor.selectedText();
1012 const int offsetWithinBlockText = offsetCursor.position() - result.first;
1013 QTextBoundaryFinder sentenceFinder(QTextBoundaryFinder::Sentence, blockText);
1014 sentenceFinder.setPosition(offsetWithinBlockText);
1015 int prevBoundary = offsetWithinBlockText;
1016 int nextBoundary = offsetWithinBlockText;
1017 if (!(sentenceFinder.boundaryReasons() & QTextBoundaryFinder::StartOfItem))
1018 prevBoundary = sentenceFinder.toPreviousBoundary();
1019 nextBoundary = sentenceFinder.toNextBoundary();
1020 if (nextBoundary != -1)
1021 result.second = result.first + nextBoundary;
1022 if (prevBoundary != -1)
1023 result.first += prevBoundary;
1024 return result;
1025 }
1026 case LineBoundary:
1027 return qAccessibleTextBoundaryHelperHelper(cursor, QTextCursor::StartOfLine,
1028 QTextCursor::EndOfLine);
1029 case ParagraphBoundary:
1030 return qAccessibleTextBoundaryHelperHelper(cursor, QTextCursor::StartOfBlock,
1031 QTextCursor::EndOfBlock);
1032 case NoBoundary:
1033 return qAccessibleTextBoundaryHelperHelper(cursor, QTextCursor::Start, QTextCursor::End);
1034 }
1035
1036 Q_UNREACHABLE_RETURN({});
1037}
1038
1039/*!
1040 \class QAccessibleInterface
1041 \brief The QAccessibleInterface class defines an interface that exposes information
1042 about accessible objects.
1043
1044 \ingroup accessibility
1045 \inmodule QtGui
1046
1047 This class is part of \l {Accessibility for QWidget Applications}.
1048
1049 Accessibility tools (also called AT Clients), such as screen readers
1050 or braille displays, require high-level information about
1051 accessible objects in an application. Accessible objects provide
1052 specialized input and output methods, making it possible for users
1053 to use accessibility tools with enabled applications (AT Servers).
1054
1055 Every element that the user needs to interact with or react to is
1056 an accessible object, and should provide this information. These
1057 are mainly visual objects, such as widgets and widget elements, but
1058 can also be content, such as sounds.
1059
1060 The AT client uses three basic concepts to acquire information
1061 about any accessible object in an application:
1062 \list
1063 \li \e Properties The client can read information about
1064 accessible objects. In some cases the client can also modify these
1065 properties; such as text in a line edit.
1066 \li \e Actions The client can invoke actions like pressing a button
1067 or .
1068 \li \e{Relationships and Navigation} The client can traverse from one
1069 accessible object to another, using the relationships between objects.
1070 \endlist
1071
1072 The QAccessibleInterface defines the API for these three concepts.
1073
1074 \section1 Relationships and Navigation
1075
1076 The functions childCount() and indexOfChild() return the number of
1077 children of an accessible object and the index a child object has
1078 in its parent. The childAt() function returns a child QAccessibleInterface
1079 that is found at a position. The child does not have to be a direct
1080 child. This allows bypassing intermediate layers when the parent already knows the
1081 top-most child. childAt() is used for hit testing (finding the object
1082 under the mouse).
1083
1084 The relations() function provides information about the relations an
1085 object has to other objects, and parent() and child() allows
1086 traversing from one object to another object.
1087
1088 \section1 Properties
1089
1090 The central property of an accessible objects is what role() it
1091 has. Different objects can have the same role, e.g. both the "Add
1092 line" element in a scroll bar and the \c OK button in a dialog have
1093 the same role, "button". The role implies what kind of
1094 interaction the user can perform with the user interface element.
1095
1096 An object's state() property is a combination of different state
1097 flags and can describe both how the object's state differs from a
1098 "normal" state, e.g. it might be unavailable, and also how it
1099 behaves, e.g. it might be selectable.
1100
1101 The text() property provides textual information about the object.
1102 An object usually has a name, but can provide extended information
1103 such as a description, help text, or information about any
1104 keyboard accelerators it provides. Some objects allow changing the
1105 text() property through the setText() function, but this
1106 information is in most cases read-only.
1107
1108 The rect() property provides information about the geometry of an
1109 accessible object. This information is usually only available for
1110 visual objects.
1111
1112 \section1 Interfaces
1113
1114 To enable the user to interact with an accessible object the
1115 object must implement QAccessibleActionInterface in addition to
1116 QAccessibleInterface.
1117 Objects that support selections can define actions to change the selection.
1118
1119 There are several other interfaces that should be implemented as required.
1120 QAccessibleTextInterface should be used for bigger texts edits such as document views.
1121 This interface should not be implemented for labels/single line edits.
1122
1123 For sliders, scrollbars and other numerical value selectors QAccessibleValueInterface
1124 should be implemented.
1125
1126 Lists, tables and trees should implement QAccessibleTableInterface.
1127
1128 \sa QAccessible, QAccessibleActionInterface, QAccessibleTextInterface, QAccessibleValueInterface, QAccessibleTableInterface
1129*/
1130
1131/*!
1132 \fn bool QAccessibleInterface::isValid() const
1133
1134 Returns \c true if all the data necessary to use this interface
1135 implementation is valid (e.g. all pointers are non-null);
1136 otherwise returns \c false.
1137
1138 \sa object()
1139*/
1140
1141/*!
1142 \fn QObject *QAccessibleInterface::object() const
1143
1144 Returns a pointer to the QObject this interface implementation provides
1145 information for.
1146
1147 \sa isValid()
1148*/
1149
1150/*!
1151 \fn int QAccessibleInterface::childCount() const
1152
1153 Returns the number of children that belong to this object. A child
1154 can provide accessibility information on its own (e.g. a child
1155 widget), or be a sub-element of this accessible object.
1156
1157 All objects provide this information.
1158
1159 \sa indexOfChild()
1160*/
1161
1162/*!
1163 \fn int QAccessibleInterface::indexOfChild(const QAccessibleInterface *child) const
1164
1165 Returns the 0-based index of the object \a child in this object's
1166 children list, or -1 if \a child is not a child of this object.
1167
1168 All objects provide this information about their children.
1169
1170 \sa childCount()
1171*/
1172
1173/*!
1174 Returns the meaningful relations to other widgets. Usually this will not return parent/child
1175 relations, unless they are handled in a specific way such as in tree views.
1176 It will typically return the labelled-by and label relations.
1177
1178 It is possible to filter the relations by using the optional parameter \a match.
1179 It should never return itself.
1180
1181 \sa parent(), child()
1182*/
1183QList<std::pair<QAccessibleInterface*, QAccessible::Relation>>
1184QAccessibleInterface::relations(QAccessible::Relation match) const
1185{
1186 Q_UNUSED(match);
1187 return { };
1188}
1189
1190/*!
1191 Returns the object that has the keyboard focus.
1192
1193 The object returned can be any descendant, including itself.
1194*/
1195QAccessibleInterface *QAccessibleInterface::focusChild() const
1196{
1197 return nullptr;
1198}
1199
1200/*!
1201 \fn QAccessibleInterface *QAccessibleInterface::childAt(int x, int y) const
1202
1203 Returns the QAccessibleInterface of a child that contains the screen coordinates (\a x, \a y).
1204 If there are no children at this position this function returns \nullptr.
1205 The returned accessible must be a child, but not necessarily a direct child.
1206
1207 This function is only reliable for visible objects (invisible
1208 object might not be laid out correctly).
1209
1210 All visual objects provide this information.
1211
1212 A default implementation is provided for objects inheriting QAccessibleObject. This will iterate
1213 over all children. If the widget manages its children (e.g. a table) it will be more efficient
1214 to write a specialized implementation.
1215
1216 \sa rect()
1217*/
1218
1219/*!
1220 \fn QAccessibleInterface* QAccessibleInterface::parent() const
1221
1222 Returns the QAccessibleInterface of the parent in the accessible object hierarchy.
1223
1224 Returns \nullptr if no parent exists (e.g. for the top level application object).
1225
1226 \sa child()
1227*/
1228
1229/*!
1230 \fn QAccessibleInterface* QAccessibleInterface::child(int index) const
1231
1232 Returns the accessible child with index \a index.
1233 0-based index. The number of children of an object can be checked with childCount.
1234
1235 Returns \nullptr when asking for an invalid child (e.g. when the child became invalid in the meantime).
1236
1237 \sa childCount(), parent()
1238*/
1239
1240/*!
1241 \fn QString QAccessibleInterface::text(QAccessible::Text t) const
1242
1243 Returns the value of the text property \a t of the object.
1244
1245 The \l QAccessible::Name is a string used by clients to identify, find, or
1246 announce an accessible object for the user. All objects must have
1247 a name that is unique within their container. The name can be
1248 used differently by clients, so the name should both give a
1249 short description of the object and be unique.
1250
1251 An accessible object's \l QAccessible::Description provides textual information
1252 about an object's visual appearance. The description is primarily
1253 used to provide greater context for vision-impaired users, but is
1254 also used for context searching or other applications. Not all
1255 objects have a description. An "OK" button would not need a
1256 description, but a tool button that shows a picture of a smiley
1257 would.
1258
1259 The \l QAccessible::Value of an accessible object represents visual information
1260 contained by the object, e.g. the text in a line edit. Usually,
1261 the value can be modified by the user. Not all objects have a
1262 value, e.g. static text labels don't, and some objects have a
1263 state that already is the value, e.g. toggle buttons.
1264
1265 The \l QAccessible::Help text provides information about the function and
1266 usage of an accessible object. Not all objects provide this
1267 information.
1268
1269 The \l QAccessible::Accelerator is a keyboard shortcut that activates the
1270 object's default action. A keyboard shortcut is the underlined
1271 character in the text of a menu, menu item or widget, and is
1272 either the character itself, or a combination of this character
1273 and a modifier key like Alt, Ctrl or Shift. Command controls like
1274 tool buttons also have shortcut keys and usually display them in
1275 their tooltip.
1276
1277 The \l QAccessible::Identifier can be explicitly set to provide an
1278 ID to assistive technologies. This can be especially useful for UI tests.
1279 If no identifier has been explicitly set, the identifier is set by the
1280 respective interface to an ID based on \l QObject::objectName or its
1281 class name and \l QObject::objectName or class name of the parents
1282 in its parents chain.
1283
1284 All objects provide a string for \l QAccessible::Name.
1285
1286 \sa role(), state()
1287*/
1288
1289/*!
1290 \fn void QAccessibleInterface::setText(QAccessible::Text t, const QString &text)
1291
1292 Sets the text property \a t of the object to \a text.
1293
1294 Note that the text properties of most objects are read-only
1295 so calling this function might have no effect.
1296
1297 \sa text()
1298*/
1299
1300/*!
1301 \fn QRect QAccessibleInterface::rect() const
1302
1303 Returns the geometry of the object. The geometry is in screen coordinates.
1304
1305 This function is only reliable for visible objects (invisible
1306 objects might not be laid out correctly).
1307
1308 All visual objects provide this information.
1309
1310 \sa childAt()
1311*/
1312
1313/*!
1314 \fn QAccessible::Role QAccessibleInterface::role() const
1315
1316 Returns the role of the object.
1317 The role of an object is usually static.
1318
1319 All accessible objects have a role.
1320
1321 \sa text(), state()
1322*/
1323
1324/*!
1325 \fn QAccessible::State QAccessibleInterface::state() const
1326
1327 Returns the current state of the object.
1328 The returned value is a combination of the flags in
1329 the QAccessible::StateFlag enumeration.
1330
1331 All accessible objects have a state.
1332
1333 \sa text(), role()
1334*/
1335
1336/*!
1337 Returns the accessible's foreground color if applicable or an invalid QColor.
1338
1339 \sa backgroundColor()
1340*/
1341QColor QAccessibleInterface::foregroundColor() const
1342{
1343 return QColor();
1344}
1345
1346/*!
1347 Returns the accessible's background color if applicable or an invalid QColor.
1348
1349 \sa foregroundColor()
1350*/
1351QColor QAccessibleInterface::backgroundColor() const
1352{
1353 return QColor();
1354}
1355
1356/*!
1357 \fn QAccessibleTextInterface *QAccessibleInterface::textInterface()
1358*/
1359
1360/*!
1361 \fn QAccessibleTextInterface *QAccessibleInterface::editableTextInterface()
1362 \internal
1363*/
1364
1365/*!
1366 \fn QAccessibleValueInterface *QAccessibleInterface::valueInterface()
1367*/
1368
1369/*!
1370 \fn QAccessibleTableInterface *QAccessibleInterface::tableInterface()
1371*/
1372
1373/*!
1374 \fn QAccessibleTableCellInterface *QAccessibleInterface::tableCellInterface()
1375*/
1376
1377/*!
1378 \fn QAccessibleActionInterface *QAccessibleInterface::actionInterface()
1379*/
1380
1381/*!
1382 \fn QAccessibleImageInterface *QAccessibleInterface::imageInterface()
1383 \internal
1384*/
1385
1386/*!
1387 \fn QAccessibleSelectionInterface *QAccessibleInterface::selectionInterface()
1388 \since 6.5
1389*/
1390
1391/*!
1392 \class QAccessibleEvent
1393 \ingroup accessibility
1394 \inmodule QtGui
1395
1396 \brief The QAccessibleEvent class is the base class for accessibility notifications.
1397
1398 This class is used with \l QAccessible::updateAccessibility().
1399
1400 The event type is one of the values of \l QAccessible::Event.
1401 There are a number of subclasses that should be used to provide more details about the
1402 event.
1403
1404 For example to notify about a focus change when re-implementing QWidget::setFocus,
1405 the event could be used as follows:
1406 \snippet code/src_gui_accessible_qaccessible.cpp 2
1407
1408 To enable in process screen readers, all events must be sent after the change has happened.
1409*/
1410
1411/*! \fn QAccessibleEvent::QAccessibleEvent(QObject *object, QAccessible::Event type)
1412
1413 Constructs a QAccessibleEvent to notify that \a object has changed.
1414 The event \a type describes what changed.
1415*/
1416
1417/*! \fn QAccessibleEvent::QAccessibleEvent(QAccessibleInterface *interface, QAccessible::Event type)
1418
1419 Constructs a QAccessibleEvent to notify that \a interface has changed.
1420 The event \a type describes what changed.
1421 Use this function if you already have a QAccessibleInterface or no QObject, otherwise consider
1422 the overload taking a \l QObject parameter as it might be cheaper.
1423*/
1424
1425/*!
1426 Destroys the event.
1427*/
1428QAccessibleEvent::~QAccessibleEvent()
1429{
1430}
1431
1432/*! \fn QAccessible::Event QAccessibleEvent::type() const
1433 Returns the event type.
1434*/
1435
1436/*! \fn QObject* QAccessibleEvent::object() const
1437 Returns the event object.
1438*/
1439
1440/*! \fn void QAccessibleEvent::setChild(int child)
1441 Sets the child index to \a child.
1442*/
1443
1444/*! \fn int QAccessibleEvent::child() const
1445 Returns the child index.
1446*/
1447
1448/*!
1449 \internal
1450 Returns the uniqueId of the QAccessibleInterface represented by this event.
1451
1452 In case the object() function returns \nullptr, this is the only way to access the
1453 interface.
1454*/
1455QAccessible::Id QAccessibleEvent::uniqueId() const
1456{
1457 if (!m_object)
1458 return m_uniqueId;
1459 QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(m_object);
1460 if (!iface)
1461 return 0;
1462 if (m_child != -1) {
1463 iface = iface->child(m_child);
1464 if (Q_UNLIKELY(!iface)) {
1465 qCWarning(lcAccessibilityCore) << "Invalid child in QAccessibleEvent:" << m_object << "child:" << m_child;
1466 return 0;
1467 }
1468 }
1469 return QAccessible::uniqueId(iface);
1470}
1471
1472void QAccessibleEvent::setChild(int chld)
1473{
1474 if (m_type == QAccessible::ObjectDestroyed)
1475 qCWarning(lcAccessibilityCore) << "Calling QAccessibleEvent::setChild on ObjectDestroyed event " <<
1476 "is not supported";
1477 m_child = chld;
1478}
1479
1480/*!
1481 \class QAccessibleValueChangeEvent
1482 \ingroup accessibility
1483 \inmodule QtGui
1484
1485 \brief The QAccessibleValueChangeEvent describes a change in value for an accessible object.
1486
1487 It contains the new value.
1488
1489 This class is used with \l QAccessible::updateAccessibility().
1490*/
1491
1492/*! \fn QAccessibleValueChangeEvent::QAccessibleValueChangeEvent(QObject *object, const QVariant &value)
1493
1494 Constructs a new QAccessibleValueChangeEvent for \a object.
1495 The event contains the new \a value.
1496*/
1497/*! \fn QAccessibleValueChangeEvent::QAccessibleValueChangeEvent(QAccessibleInterface *iface, const QVariant &val)
1498
1499 Constructs a new QAccessibleValueChangeEvent for \a iface.
1500 The event contains the new value \a val.
1501*/
1502
1503/*! \fn void QAccessibleValueChangeEvent::setValue(const QVariant & value)
1504
1505 Sets the new \a value for this event.
1506*/
1507/*!
1508 \fn QVariant QAccessibleValueChangeEvent::value() const
1509
1510 Returns the new value of the accessible object of this event.
1511*/
1512
1513/*!
1514 \internal
1515*/
1516QAccessibleValueChangeEvent::~QAccessibleValueChangeEvent()
1517{
1518}
1519
1520/*!
1521 \class QAccessibleStateChangeEvent
1522 \ingroup accessibility
1523 \inmodule QtGui
1524
1525 \brief The QAccessibleStateChangeEvent notfies the accessibility framework
1526 that the state of an object has changed.
1527
1528 This class is used with \l QAccessible::updateAccessibility().
1529
1530 \sa QAccessibleInterface::state()
1531*/
1532/*! \fn QAccessibleStateChangeEvent::QAccessibleStateChangeEvent(QObject *object, QAccessible::State state)
1533
1534 Constructs a new QAccessibleStateChangeEvent for \a object.
1535 The difference to the object's previous state is in \a state.
1536*/
1537/*!
1538 \fn QAccessibleStateChangeEvent::QAccessibleStateChangeEvent(QAccessibleInterface *iface, QAccessible::State state)
1539
1540 Constructs a new QAccessibleStateChangeEvent.
1541 \a iface is the interface associated with the event
1542 \a state is the state of the accessible object.
1543*/
1544/*!
1545 \fn QAccessible::State QAccessibleStateChangeEvent::changedStates() const
1546 \brief Returns the states that have been changed.
1547
1548 Keep in mind that the returned states are the ones that have changed.
1549 To find out about the state of an object, use QAccessibleInterface::state().
1550
1551 For example, if an object used to have the focus but loses it,
1552 the object's state will have focused set to \c false. This event on the
1553 other hand tells about the change and has focused set to \c true since
1554 the focus state is changed from \c true to \c false.
1555*/
1556/*!
1557 \internal
1558*/
1559QAccessibleStateChangeEvent::~QAccessibleStateChangeEvent()
1560{
1561}
1562
1563/*!
1564 \class QAccessibleTableModelChangeEvent
1565 \ingroup accessibility
1566 \inmodule QtGui
1567
1568 \brief The QAccessibleTableModelChangeEvent signifies a change in a table, list, or tree where cells
1569 are added or removed.
1570 If the change affected a number of rows, firstColumn and lastColumn will return -1.
1571 Likewise for columns, the row functions may return -1.
1572
1573 This class is used with \l QAccessible::updateAccessibility().
1574*/
1575
1576/*! \enum QAccessibleTableModelChangeEvent::ModelChangeType
1577 This enum describes the different types of changes in the table model.
1578 \value ModelReset The model has been reset, all previous knowledge about the model is now invalid.
1579 \value DataChanged No cells have been added or removed, but the data of the specified cell range is invalid.
1580 \value RowsInserted New rows have been inserted.
1581 \value ColumnsInserted New columns have been inserted.
1582 \value RowsRemoved Rows have been removed.
1583 \value ColumnsRemoved Columns have been removed.
1584*/
1585/*! \fn QAccessibleTableModelChangeEvent::QAccessibleTableModelChangeEvent(QObject *object, ModelChangeType changeType)
1586
1587 Constructs a new QAccessibleTableModelChangeEvent for \a object of with \a changeType.
1588*/
1589/*! \fn int QAccessibleTableModelChangeEvent::firstColumn() const
1590
1591 Returns the first changed column.
1592*/
1593/*! \fn int QAccessibleTableModelChangeEvent::firstRow() const
1594
1595 Returns the first changed row.
1596*/
1597/*! \fn int QAccessibleTableModelChangeEvent::lastColumn() const
1598
1599 Returns the last changed column.
1600*/
1601/*! \fn int QAccessibleTableModelChangeEvent::lastRow() const
1602
1603 Returns the last changed row.
1604*/
1605/*! \fn QAccessibleTableModelChangeEvent::ModelChangeType QAccessibleTableModelChangeEvent::modelChangeType() const
1606
1607 Returns the type of change.
1608*/
1609/*! \fn void QAccessibleTableModelChangeEvent::setFirstColumn(int column)
1610
1611 Sets the first changed \a column.
1612*/
1613/*! \fn void QAccessibleTableModelChangeEvent::setFirstRow(int row)
1614
1615 Sets the first changed \a row.
1616*/
1617/*! \fn void QAccessibleTableModelChangeEvent::setLastColumn(int column)
1618
1619 Sets the last changed \a column.
1620*/
1621/*! \fn void QAccessibleTableModelChangeEvent::setLastRow(int row)
1622
1623 Sets the last changed \a row.
1624*/
1625/*! \fn void QAccessibleTableModelChangeEvent::setModelChangeType(ModelChangeType changeType)
1626
1627 Sets the type of change to \a changeType.
1628*/
1629/*!
1630 \fn QAccessibleTableModelChangeEvent::QAccessibleTableModelChangeEvent(QAccessibleInterface *iface, ModelChangeType changeType)
1631
1632 Constructs a new QAccessibleTableModelChangeEvent for interface \a iface with a model
1633 change type \a changeType.
1634*/
1635/*!
1636 \internal
1637*/
1638QAccessibleTableModelChangeEvent::~QAccessibleTableModelChangeEvent()
1639{
1640}
1641/*!
1642 \class QAccessibleTextCursorEvent
1643 \ingroup accessibility
1644 \inmodule QtGui
1645
1646 \brief The QAccessibleTextCursorEvent class notifies of cursor movements.
1647
1648 This class is used with \l QAccessible::updateAccessibility().
1649*/
1650/*! \fn QAccessibleTextCursorEvent::QAccessibleTextCursorEvent(QObject *object, int cursorPos)
1651
1652 Create a new QAccessibleTextCursorEvent for \a object.
1653 The \a cursorPos is the new cursor position.
1654*/
1655/*! \fn int QAccessibleTextCursorEvent::cursorPosition() const
1656
1657 Returns the cursor position.
1658*/
1659/*! \fn void QAccessibleTextCursorEvent::setCursorPosition(int position)
1660
1661 Sets the cursor \a position for this event.
1662*/
1663/*!
1664 \internal
1665*/
1666QAccessibleTextCursorEvent::~QAccessibleTextCursorEvent()
1667{
1668}
1669
1670
1671/*!
1672 \fn QAccessibleTextCursorEvent::QAccessibleTextCursorEvent(QAccessibleInterface *iface, int cursorPos)
1673
1674 Create a new QAccessibleTextCursorEvent for \a iface,
1675 The \a cursorPos is the new cursor position.
1676*/
1677
1678/*!
1679 \class QAccessibleTextInsertEvent
1680 \ingroup accessibility
1681 \inmodule QtGui
1682
1683 \brief The QAccessibleTextInsertEvent class notifies of text being inserted.
1684
1685 This class is used with \l QAccessible::updateAccessibility().
1686*/
1687/*! \fn QAccessibleTextInsertEvent::QAccessibleTextInsertEvent(QObject *object, int position, const QString &text)
1688
1689 Constructs a new QAccessibleTextInsertEvent event for \a object.
1690 The \a text has been inserted at \a position.
1691 By default, it is assumed that the cursor has moved to the end
1692 of the selection. If that is not the case, one needs to manually
1693 set it with \l QAccessibleTextCursorEvent::setCursorPosition() for this event.
1694*/
1695/*! \fn int QAccessibleTextInsertEvent::changePosition() const
1696
1697 Returns the position where the text was inserted.
1698*/
1699/*! \fn QString QAccessibleTextInsertEvent::textInserted() const
1700
1701 Returns the text that has been inserted.
1702*/
1703/*!
1704 \internal
1705*/
1706QAccessibleTextInsertEvent::~QAccessibleTextInsertEvent()
1707{
1708}
1709
1710
1711/*!
1712 \class QAccessibleTextRemoveEvent
1713 \ingroup accessibility
1714 \inmodule QtGui
1715
1716 \brief The QAccessibleTextRemoveEvent class notifies of text being deleted.
1717
1718 This class is used with \l QAccessible::updateAccessibility().
1719*/
1720/*! \fn QAccessibleTextRemoveEvent::QAccessibleTextRemoveEvent(QObject *object, int position, const QString &text)
1721
1722 Constructs a new QAccessibleTextRemoveEvent event for \a object.
1723 The \a text has been removed at \a position.
1724 By default it is assumed that the cursor has moved to \a position.
1725 If that is not the case, one needs to manually
1726 set it with \l QAccessibleTextCursorEvent::setCursorPosition() for this event.
1727*/
1728/*! \fn QAccessibleTextRemoveEvent::QAccessibleTextRemoveEvent(QAccessibleInterface *iface, int position, const QString &text)
1729
1730 Constructs a new QAccessibleTextRemoveEvent event for \a iface.
1731 The \a text has been removed at \a position.
1732 By default it is assumed that the cursor has moved to \a position.
1733 If that is not the case, one needs to manually
1734 set it with \l QAccessibleTextCursorEvent::setCursorPosition() for this event.
1735*/
1736
1737/*! \fn int QAccessibleTextRemoveEvent::changePosition() const
1738
1739 Returns the position where the text was removed.
1740*/
1741/*! \fn QString QAccessibleTextRemoveEvent::textRemoved() const
1742
1743 Returns the text that has been removed.
1744*/
1745/*!
1746 \internal
1747*/
1748QAccessibleTextRemoveEvent::~QAccessibleTextRemoveEvent()
1749{
1750}
1751
1752/*!
1753 \fn QAccessibleTextSelectionEvent::QAccessibleTextSelectionEvent(QAccessibleInterface *iface, int start, int end)
1754
1755 Constructs a new QAccessibleTextSelectionEvent for \a iface. The new selection this
1756 event notifies about is from position \a start to \a end.
1757*/
1758
1759/*!
1760 \fn QAccessibleTextInsertEvent::QAccessibleTextInsertEvent(QAccessibleInterface *iface, int position, const QString &text)
1761
1762 Constructs a new QAccessibleTextInsertEvent event for \a iface. The \a text has been inserted
1763 at \a position.
1764*/
1765
1766/*!
1767 \fn inline QAccessibleTextUpdateEvent::QAccessibleTextUpdateEvent(QAccessibleInterface *iface, int position, const QString &oldText,
1768 const QString &text)
1769
1770 Constructs a new QAccessibleTextUpdateEvent for \a iface. The text change takes place at
1771 \a position where the \a oldText was removed and \a text inserted instead.
1772
1773*/
1774
1775
1776
1777/*!
1778 \class QAccessibleTextUpdateEvent
1779 \ingroup accessibility
1780 \inmodule QtGui
1781
1782 \brief The QAccessibleTextUpdateEvent class notifies about text changes.
1783 This is for accessibles that support editable text such as line edits.
1784 This event occurs for example when a portion of selected text
1785 gets replaced by pasting a new text or in override mode of editors.
1786
1787 This class is used with \l QAccessible::updateAccessibility().
1788*/
1789/*! \fn QAccessibleTextUpdateEvent::QAccessibleTextUpdateEvent(QObject *object, int position, const QString &oldText, const QString &text)
1790
1791 Constructs a new QAccessibleTextUpdateEvent for \a object.
1792 The text change takes place at \a position where the \a oldText was removed and \a text inserted instead.
1793*/
1794/*! \fn int QAccessibleTextUpdateEvent::changePosition() const
1795
1796 Returns where the change took place.
1797*/
1798/*! \fn QString QAccessibleTextUpdateEvent::textInserted() const
1799
1800 Returns the inserted text.
1801*/
1802/*! \fn QString QAccessibleTextUpdateEvent::textRemoved() const
1803
1804 Returns the removed text.
1805*/
1806/*!
1807 \internal
1808*/
1809QAccessibleTextUpdateEvent::~QAccessibleTextUpdateEvent()
1810{
1811}
1812
1813
1814/*!
1815 \class QAccessibleTextSelectionEvent
1816 \ingroup accessibility
1817 \inmodule QtGui
1818
1819 \brief QAccessibleTextSelectionEvent signals a change in the text selection of an object.
1820
1821 This class is used with \l QAccessible::updateAccessibility().
1822*/
1823/*! \fn QAccessibleTextSelectionEvent::QAccessibleTextSelectionEvent(QObject *object, int start, int end)
1824
1825 Constructs a new QAccessibleTextSelectionEvent for \a object.
1826 The new selection this event notifies about is from position \a start to \a end.
1827*/
1828/*! \fn int QAccessibleTextSelectionEvent::selectionEnd() const
1829
1830 Returns the position of the last selected character.
1831*/
1832/*! \fn int QAccessibleTextSelectionEvent::selectionStart() const
1833
1834 Returns the position of the first selected character.
1835*/
1836/*! \fn void QAccessibleTextSelectionEvent::setSelection(int start, int end)
1837
1838 Sets the selection for this event from position \a start to \a end.
1839*/
1840/*!
1841 \internal
1842*/
1843QAccessibleTextSelectionEvent::~QAccessibleTextSelectionEvent()
1844{
1845}
1846
1847/*!
1848 \since 6.8
1849 \class QAccessibleAnnouncementEvent
1850 \ingroup accessibility
1851 \inmodule QtGui
1852
1853 \brief The QAccessibleAnnouncementEvent is used to request the announcement
1854 of a given message by assistive technologies.
1855
1856 This class is used with \l QAccessible::updateAccessibility().
1857*/
1858
1859/*! \fn QAccessibleAnnouncementEvent::QAccessibleAnnouncementEvent(QObject *object, const QString &message)
1860
1861 Constructs a new QAccessibleAnnouncementEvent event for \a object
1862 to request the announcement of \a message with politeness
1863 \l QAccessible::AnnouncementPoliteness::Polite.
1864
1865 \l QAccessibleAnnouncementEvent::setPoliteness can be used to adjust the politeness.
1866*/
1867
1868/*! \fn QAccessibleAnnouncementEvent::QAccessibleAnnouncementEvent(QAccessibleInterface *iface, const QString &message)
1869
1870 Constructs a new QAccessibleAnnouncementEvent event for \a iface
1871 to request the announcement of \a message with politeness
1872 \l QAccessible::AnnouncementPoliteness::Polite.
1873
1874 \l QAccessibleAnnouncementEvent::setPoliteness can be used to adjust the politeness.
1875*/
1876
1877/*! \fn QString QAccessibleAnnouncementEvent::message() const
1878
1879 Returns the message.
1880*/
1881
1882/*! \fn QAccessible::AnnouncementPoliteness QAccessibleAnnouncementEvent::politeness() const
1883
1884 Returns the politeness.
1885*/
1886
1887/*! \fn void QAccessibleAnnouncementEvent::setPoliteness(QAccessible::AnnouncementPoliteness politeness)
1888
1889 Sets the politeness with which the announcement will be requested to \a politeness.
1890*/
1891
1892
1893/*!
1894 \internal
1895*/
1896QAccessibleAnnouncementEvent::~QAccessibleAnnouncementEvent()
1897{
1898}
1899
1900/*!
1901 Returns the QAccessibleInterface associated with the event.
1902*/
1903QAccessibleInterface *QAccessibleEvent::accessibleInterface() const
1904{
1905 if (m_object == nullptr)
1906 return QAccessible::accessibleInterface(m_uniqueId);
1907
1908 QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(m_object);
1909 if (!iface || !iface->isValid())
1910 return nullptr;
1911
1912 if (m_child >= 0) {
1913 QAccessibleInterface *child = iface->child(m_child);
1914 if (child) {
1915 iface = child;
1916 } else {
1917 qCWarning(lcAccessibilityCore) << "Cannot create accessible child interface for object: " << m_object << " index: " << m_child << "type: " << m_type;
1918 }
1919 }
1920 return iface;
1921}
1922
1923/*!
1924 Returns the window associated with the underlying object.
1925 For instance, QAccessibleWidget reimplements this and returns
1926 the windowHandle() of the QWidget.
1927
1928 It is used on some platforms to be able to notify the AT client about
1929 state changes.
1930 The backend will traverse up all ancestors until it finds a window.
1931 (This means that at least one interface among the ancestors should
1932 return a valid QWindow pointer).
1933
1934 The default implementation returns \nullptr.
1935 */
1936QWindow *QAccessibleInterface::window() const
1937{
1938 return nullptr;
1939}
1940
1941/*!
1942 \internal
1943 Method to allow extending this class without breaking binary compatibility.
1944 The actual behavior and format of \a data depends on \a id argument
1945 which must be defined if the class is to be extended with another virtual
1946 function.
1947 Currently, this is unused.
1948*/
1949void QAccessibleInterface::virtual_hook(int /*id*/, void * /*data*/)
1950{
1951}
1952
1953/*!
1954 \fn void *QAccessibleInterface::interface_cast(QAccessible::InterfaceType type)
1955
1956 Returns a specialized accessibility interface \a type from the
1957 generic QAccessibleInterface.
1958
1959 This function must be reimplemented when providing more
1960 information about a widget or object through the specialized
1961 interfaces. For example a line edit should implement the
1962 QAccessibleTextInterface.
1963
1964 \sa QAccessible::InterfaceType, QAccessibleTextInterface,
1965 QAccessibleValueInterface, QAccessibleActionInterface,
1966 QAccessibleTableInterface, QAccessibleTableCellInterface
1967*/
1968
1969/*! \internal */
1970const char *qAccessibleRoleString(QAccessible::Role role)
1971{
1972 if (role >= QAccessible::UserRole)
1973 role = QAccessible::UserRole;
1974 static int roleEnum = QAccessible::staticMetaObject.indexOfEnumerator("Role");
1975 return QAccessible::staticMetaObject.enumerator(roleEnum).valueToKey(role);
1976}
1977
1978/*! \internal */
1979const char *qAccessibleEventString(QAccessible::Event event)
1980{
1981 static int eventEnum = QAccessible::staticMetaObject.indexOfEnumerator("Event");
1982 return QAccessible::staticMetaObject.enumerator(eventEnum).valueToKey(event);
1983}
1984
1985#ifndef QT_NO_DEBUG_STREAM
1986/*! \internal */
1987Q_GUI_EXPORT QDebug operator<<(QDebug d, const QAccessibleInterface *iface)
1988{
1989 QDebugStateSaver saver(d);
1990 if (!iface)
1991 return d << "QAccessibleInterface(0x0)";
1992
1993 d.nospace();
1994 d << "QAccessibleInterface(" << Qt::hex << (const void *) iface << Qt::dec;
1995 if (iface->isValid()) {
1996 d << " name=" << iface->text(QAccessible::Name) << ' ';
1997 d << "role=" << qAccessibleRoleString(iface->role()) << ' ';
1998 if (iface->childCount())
1999 d << "childc=" << iface->childCount() << ' ';
2000 if (iface->object()) {
2001 d << "obj=" << iface->object();
2002 }
2003 QStringList stateStrings;
2004 QAccessible::State st = iface->state();
2005 if (st.focusable)
2006 stateStrings << u"focusable"_s;
2007 if (st.focused)
2008 stateStrings << u"focused"_s;
2009 if (st.selected)
2010 stateStrings << u"selected"_s;
2011 if (st.invisible)
2012 stateStrings << u"invisible"_s;
2013
2014 if (!stateStrings.isEmpty())
2015 d << stateStrings.join(u'|');
2016
2017 if (!st.invisible)
2018 d << "rect=" << iface->rect();
2019
2020 } else {
2021 d << " invalid";
2022 }
2023 d << ')';
2024 return d;
2025}
2026
2027/*! \internal */
2028QDebug operator<<(QDebug d, const QAccessibleEvent &ev)
2029{
2030 QDebugStateSaver saver(d);
2031 d.nospace() << "QAccessibleEvent(";
2032 if (ev.object()) {
2033 d.nospace() << "object=" << Qt::hex << ev.object() << Qt::dec;
2034 d.nospace() << "child=" << ev.child();
2035 } else {
2036 d.nospace() << "no object, uniqueId=" << ev.uniqueId();
2037 }
2038 d << " event=" << qAccessibleEventString(ev.type());
2039 if (ev.type() == QAccessible::StateChanged) {
2040 QAccessible::State changed = static_cast<const QAccessibleStateChangeEvent*>(&ev)->changedStates();
2041 d << "State changed:";
2042 if (changed.disabled) d << "disabled";
2043 if (changed.selected) d << "selected";
2044 if (changed.focusable) d << "focusable";
2045 if (changed.focused) d << "focused";
2046 if (changed.pressed) d << "pressed";
2047 if (changed.checkable) d << "checkable";
2048 if (changed.checked) d << "checked";
2049 if (changed.checkStateMixed) d << "checkStateMixed";
2050 if (changed.readOnly) d << "readOnly";
2051 if (changed.hotTracked) d << "hotTracked";
2052 if (changed.defaultButton) d << "defaultButton";
2053 if (changed.expanded) d << "expanded";
2054 if (changed.collapsed) d << "collapsed";
2055 if (changed.busy) d << "busy";
2056 if (changed.expandable) d << "expandable";
2057 if (changed.marqueed) d << "marqueed";
2058 if (changed.animated) d << "animated";
2059 if (changed.invisible) d << "invisible";
2060 if (changed.offscreen) d << "offscreen";
2061 if (changed.sizeable) d << "sizeable";
2062 if (changed.movable) d << "movable";
2063 if (changed.selfVoicing) d << "selfVoicing";
2064 if (changed.selectable) d << "selectable";
2065 if (changed.linked) d << "linked";
2066 if (changed.traversed) d << "traversed";
2067 if (changed.multiSelectable) d << "multiSelectable";
2068 if (changed.extSelectable) d << "extSelectable";
2069 if (changed.passwordEdit) d << "passwordEdit"; // used to be Protected
2070 if (changed.hasPopup) d << "hasPopup";
2071 if (changed.modal) d << "modal";
2072
2073 // IA2 - we chose to not add some IA2 states for now
2074 // Below the ones that seem helpful
2075 if (changed.active) d << "active";
2076 if (changed.invalid) d << "invalid"; // = defunct
2077 if (changed.editable) d << "editable";
2078 if (changed.multiLine) d << "multiLine";
2079 if (changed.selectableText) d << "selectableText";
2080 if (changed.supportsAutoCompletion) d << "supportsAutoCompletion";
2081
2082 }
2083 d << ')';
2084 return d;
2085}
2086#endif // QT_NO_DEBUGSTREAM
2087
2088/*!
2089 \class QAccessibleTextInterface
2090 \inmodule QtGui
2091
2092 \ingroup accessibility
2093
2094 \brief The QAccessibleTextInterface class implements support for text handling.
2095
2096 This interface corresponds to the IAccessibleText interface.
2097 It should be implemented for widgets that display more text than a plain label.
2098 Labels should be represented by only \l QAccessibleInterface
2099 and return their text as name (\l QAccessibleInterface::text() with \l QAccessible::Name as type).
2100 The QAccessibleTextInterface is typically for text that a screen reader
2101 might want to read line by line, and for widgets that support text selection and input.
2102 This interface is, for example, implemented for QLineEdit.
2103
2104 \l{IAccessible2 Specification}
2105*/
2106
2107/*!
2108
2109 Destroys the QAccessibleTextInterface.
2110*/
2111QAccessibleTextInterface::~QAccessibleTextInterface()
2112{
2113}
2114
2115/*!
2116 \fn void QAccessibleTextInterface::addSelection(int startOffset, int endOffset)
2117
2118 Select the text from \a startOffset to \a endOffset.
2119 The \a startOffset is the first character that will be selected.
2120 The \a endOffset is the first character that will not be selected.
2121
2122 When the object supports multiple selections (e.g. in a word processor),
2123 this adds a new selection, otherwise it replaces the previous selection.
2124
2125 The selection will be \a endOffset - \a startOffset characters long.
2126*/
2127
2128/*!
2129 \fn QString QAccessibleTextInterface::attributes(int offset, int *startOffset, int *endOffset) const
2130
2131 Returns the text attributes at the position \a offset.
2132 In addition the range of the attributes is returned in \a startOffset and \a endOffset.
2133*/
2134
2135/*!
2136 \fn int QAccessibleTextInterface::cursorPosition() const
2137
2138 Returns the current cursor position.
2139*/
2140
2141/*!
2142 \fn QRect QAccessibleTextInterface::characterRect(int offset) const
2143
2144 Returns the position and size of the character at position \a offset in screen coordinates.
2145*/
2146
2147/*!
2148 \fn int QAccessibleTextInterface::selectionCount() const
2149
2150 Returns the number of selections in this text.
2151*/
2152
2153/*!
2154 \fn int QAccessibleTextInterface::offsetAtPoint(const QPoint &point) const
2155
2156 Returns the offset of the character at the \a point in screen coordinates.
2157*/
2158
2159/*!
2160 \fn void QAccessibleTextInterface::selection(int selectionIndex, int *startOffset, int *endOffset) const
2161
2162 Returns a selection. The size of the selection is returned in \a startOffset and \a endOffset.
2163 If there is no selection both \a startOffset and \a endOffset are \nullptr.
2164
2165 The accessibility APIs support multiple selections. For most widgets though, only one selection
2166 is supported with \a selectionIndex equal to 0.
2167*/
2168
2169/*!
2170 \fn QString QAccessibleTextInterface::text(int startOffset, int endOffset) const
2171
2172 Returns the text from \a startOffset to \a endOffset.
2173 The \a startOffset is the first character that will be returned.
2174 The \a endOffset is the first character that will not be returned.
2175*/
2176
2177/*!
2178 \internal
2179 Helper for finding line breaks in textBeforeOffset/textAtOffset/textAfterOffset.
2180 \a beforeAtAfter is the line we look for. -1 for before, 0 for at and 1 for after.
2181*/
2182static QString textLineBoundary(int beforeAtAfter, const QString &text, int offset, int *startOffset, int *endOffset)
2183{
2184 Q_ASSERT(beforeAtAfter >= -1 && beforeAtAfter <= 1);
2185 Q_ASSERT(*startOffset == -1 && *endOffset == -1);
2186 int length = text.size();
2187 Q_ASSERT(offset >= 0 && offset <= length);
2188
2189 // move offset into the right range (if asking for line before or after
2190 if (beforeAtAfter == 1) {
2191 offset = text.indexOf(QChar::LineFeed, qMin(offset, length - 1));
2192 if (offset < 0)
2193 return QString(); // after the last line comes nothing
2194 ++offset; // move after the newline
2195 } else if (beforeAtAfter == -1) {
2196 offset = text.lastIndexOf(QChar::LineFeed, qMax(offset - 1, 0));
2197 if (offset < 0)
2198 return QString(); // before first line comes nothing
2199 }
2200
2201 if (offset > 0)
2202 *startOffset = text.lastIndexOf(QChar::LineFeed, offset - 1);
2203 ++*startOffset; // move to the char after the newline (0 if lastIndexOf returned -1)
2204
2205 *endOffset = text.indexOf(QChar::LineFeed, qMin(offset, length - 1)) + 1; // include newline char
2206 if (*endOffset <= 0 || *endOffset > length)
2207 *endOffset = length; // if the text doesn't end with a newline it ends at length
2208
2209 return text.mid(*startOffset, *endOffset - *startOffset);
2210}
2211
2212/*!
2213 Returns the text item of type \a boundaryType that is close to offset \a offset
2214 and sets \a startOffset and \a endOffset values to the start and end positions
2215 of that item; returns an empty string if there is no such an item.
2216 Sets \a startOffset and \a endOffset values to -1 on error.
2217
2218 This default implementation is provided for small text edits. A word processor or
2219 text editor should provide their own efficient implementations. This function makes no
2220 distinction between paragraphs and lines.
2221
2222 \note this function can not take the cursor position into account. By convention
2223 an \a offset of -2 means that this function should use the cursor position as offset.
2224 Thus an offset of -2 must be converted to the cursor position before calling this
2225 function.
2226 An offset of -1 is used for the text length and custom implementations of this function
2227 have to return the result as if the length was passed in as offset.
2228*/
2229QString QAccessibleTextInterface::textBeforeOffset(int offset, QAccessible::TextBoundaryType boundaryType,
2230 int *startOffset, int *endOffset) const
2231{
2232 const QString txt = text(0, characterCount());
2233
2234 if (offset == -1)
2235 offset = txt.size();
2236
2237 *startOffset = *endOffset = -1;
2238 if (txt.isEmpty() || offset <= 0 || offset > txt.size())
2239 return QString();
2240
2241 // type initialized just to silence a compiler warning [-Werror=maybe-uninitialized]
2242 QTextBoundaryFinder::BoundaryType type = QTextBoundaryFinder::Grapheme;
2243 switch (boundaryType) {
2244 case QAccessible::CharBoundary:
2245 type = QTextBoundaryFinder::Grapheme;
2246 break;
2247 case QAccessible::WordBoundary:
2248 type = QTextBoundaryFinder::Word;
2249 break;
2250 case QAccessible::SentenceBoundary:
2251 type = QTextBoundaryFinder::Sentence;
2252 break;
2253 case QAccessible::LineBoundary:
2254 case QAccessible::ParagraphBoundary:
2255 // Lines can not use QTextBoundaryFinder since Line there means any potential line-break.
2256 return textLineBoundary(-1, txt, offset, startOffset, endOffset);
2257 case QAccessible::NoBoundary:
2258 // return empty, this function currently only supports single lines, so there can be no line before
2259 return QString();
2260 default:
2261 Q_UNREACHABLE();
2262 }
2263
2264 // keep behavior in sync with QTextCursor::movePosition()!
2265
2266 QTextBoundaryFinder boundary(type, txt);
2267 boundary.setPosition(offset);
2268
2269 do {
2270 if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem)))
2271 break;
2272 } while (boundary.toPreviousBoundary() > 0);
2273 Q_ASSERT(boundary.position() >= 0);
2274 const int endPos = boundary.position();
2275
2276 while (boundary.toPreviousBoundary() > 0) {
2277 if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem)))
2278 break;
2279 }
2280 if (boundary.position() < 0)
2281 return QString();
2282
2283 *endOffset = endPos;
2284 *startOffset = boundary.position();
2285
2286 return txt.mid(*startOffset, *endOffset - *startOffset);
2287}
2288
2289/*!
2290 Returns the text item of type \a boundaryType that is right after offset \a offset
2291 and sets \a startOffset and \a endOffset values to the start and end positions
2292 of that item; returns an empty string if there is no such an item.
2293 Sets \a startOffset and \a endOffset values to -1 on error.
2294
2295 This default implementation is provided for small text edits. A word processor or
2296 text editor should provide their own efficient implementations. This function makes no
2297 distinction between paragraphs and lines.
2298
2299 \note this function can not take the cursor position into account. By convention
2300 an \a offset of -2 means that this function should use the cursor position as offset.
2301 Thus an offset of -2 must be converted to the cursor position before calling this
2302 function.
2303 An offset of -1 is used for the text length and custom implementations of this function
2304 have to return the result as if the length was passed in as offset.
2305*/
2306QString QAccessibleTextInterface::textAfterOffset(int offset, QAccessible::TextBoundaryType boundaryType,
2307 int *startOffset, int *endOffset) const
2308{
2309 const QString txt = text(0, characterCount());
2310
2311 if (offset == -1)
2312 offset = txt.size();
2313
2314 *startOffset = *endOffset = -1;
2315 if (txt.isEmpty() || offset < 0 || offset >= txt.size())
2316 return QString();
2317
2318 // type initialized just to silence a compiler warning [-Werror=maybe-uninitialized]
2319 QTextBoundaryFinder::BoundaryType type = QTextBoundaryFinder::Grapheme;
2320 switch (boundaryType) {
2321 case QAccessible::CharBoundary:
2322 type = QTextBoundaryFinder::Grapheme;
2323 break;
2324 case QAccessible::WordBoundary:
2325 type = QTextBoundaryFinder::Word;
2326 break;
2327 case QAccessible::SentenceBoundary:
2328 type = QTextBoundaryFinder::Sentence;
2329 break;
2330 case QAccessible::LineBoundary:
2331 case QAccessible::ParagraphBoundary:
2332 // Lines can not use QTextBoundaryFinder since Line there means any potential line-break.
2333 return textLineBoundary(1, txt, offset, startOffset, endOffset);
2334 case QAccessible::NoBoundary:
2335 // return empty, this function currently only supports single lines, so there can be no line after
2336 return QString();
2337 default:
2338 Q_UNREACHABLE();
2339 }
2340
2341 // keep behavior in sync with QTextCursor::movePosition()!
2342
2343 QTextBoundaryFinder boundary(type, txt);
2344 boundary.setPosition(offset);
2345
2346 while (true) {
2347 int toNext = boundary.toNextBoundary();
2348 if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem)))
2349 break;
2350 if (toNext < 0 || toNext >= txt.size())
2351 break; // not found, the boundary might not exist
2352 }
2353 Q_ASSERT(boundary.position() <= txt.size());
2354 *startOffset = boundary.position();
2355
2356 while (true) {
2357 int toNext = boundary.toNextBoundary();
2358 if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem)))
2359 break;
2360 if (toNext < 0 || toNext >= txt.size())
2361 break; // not found, the boundary might not exist
2362 }
2363 Q_ASSERT(boundary.position() <= txt.size());
2364 *endOffset = boundary.position();
2365
2366 if ((*startOffset == -1) || (*endOffset == -1) || (*startOffset == *endOffset)) {
2367 *endOffset = -1;
2368 *startOffset = -1;
2369 }
2370
2371 return txt.mid(*startOffset, *endOffset - *startOffset);
2372}
2373
2374/*!
2375 Returns the text item of type \a boundaryType at offset \a offset
2376 and sets \a startOffset and \a endOffset values to the start and end positions
2377 of that item; returns an empty string if there is no such an item.
2378 Sets \a startOffset and \a endOffset values to -1 on error.
2379
2380 This default implementation is provided for small text edits. A word processor or
2381 text editor should provide their own efficient implementations. This function makes no
2382 distinction between paragraphs and lines.
2383
2384 \note this function can not take the cursor position into account. By convention
2385 an \a offset of -2 means that this function should use the cursor position as offset.
2386 Thus an offset of -2 must be converted to the cursor position before calling this
2387 function.
2388 An offset of -1 is used for the text length and custom implementations of this function
2389 have to return the result as if the length was passed in as offset.
2390*/
2391QString QAccessibleTextInterface::textAtOffset(int offset, QAccessible::TextBoundaryType boundaryType,
2392 int *startOffset, int *endOffset) const
2393{
2394 const QString txt = text(0, characterCount());
2395
2396 if (offset == -1)
2397 offset = txt.size();
2398
2399 *startOffset = *endOffset = -1;
2400 if (txt.isEmpty() || offset < 0 || offset > txt.size())
2401 return QString();
2402
2403 if (offset == txt.size() && boundaryType == QAccessible::CharBoundary)
2404 return QString();
2405
2406 // type initialized just to silence a compiler warning [-Werror=maybe-uninitialized]
2407 QTextBoundaryFinder::BoundaryType type = QTextBoundaryFinder::Grapheme;
2408 switch (boundaryType) {
2409 case QAccessible::CharBoundary:
2410 type = QTextBoundaryFinder::Grapheme;
2411 break;
2412 case QAccessible::WordBoundary:
2413 type = QTextBoundaryFinder::Word;
2414 break;
2415 case QAccessible::SentenceBoundary:
2416 type = QTextBoundaryFinder::Sentence;
2417 break;
2418 case QAccessible::LineBoundary:
2419 case QAccessible::ParagraphBoundary:
2420 // Lines can not use QTextBoundaryFinder since Line there means any potential line-break.
2421 return textLineBoundary(0, txt, offset, startOffset, endOffset);
2422 case QAccessible::NoBoundary:
2423 *startOffset = 0;
2424 *endOffset = txt.size();
2425 return txt;
2426 default:
2427 Q_UNREACHABLE();
2428 }
2429
2430 // keep behavior in sync with QTextCursor::movePosition()!
2431
2432 QTextBoundaryFinder boundary(type, txt);
2433 boundary.setPosition(offset);
2434
2435 do {
2436 if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem)))
2437 break;
2438 } while (boundary.toPreviousBoundary() > 0);
2439 Q_ASSERT(boundary.position() >= 0);
2440 const int startPos = boundary.position();
2441
2442 while (boundary.toNextBoundary() < txt.size()) {
2443 if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem)))
2444 break;
2445 if (boundary.position() == -1)
2446 return QString();
2447 }
2448
2449 Q_ASSERT(boundary.position() <= txt.size());
2450 *startOffset = startPos;
2451 *endOffset = boundary.position();
2452
2453 return txt.mid(*startOffset, *endOffset - *startOffset);
2454}
2455
2456/*!
2457 \fn void QAccessibleTextInterface::removeSelection(int selectionIndex)
2458
2459 Clears the selection with index \a selectionIndex.
2460*/
2461
2462/*!
2463 \fn void QAccessibleTextInterface::setCursorPosition(int position)
2464
2465 Moves the cursor to \a position.
2466*/
2467
2468/*!
2469 \fn void QAccessibleTextInterface::setSelection(int selectionIndex, int startOffset, int endOffset)
2470
2471 Set the selection \a selectionIndex to the range from \a startOffset to \a endOffset.
2472
2473 \sa addSelection(), removeSelection()
2474*/
2475
2476/*!
2477 \fn int QAccessibleTextInterface::characterCount() const
2478
2479 Returns the length of the text (total size including spaces).
2480*/
2481
2482/*!
2483 \fn void QAccessibleTextInterface::scrollToSubstring(int startIndex, int endIndex)
2484
2485 Ensures that the text between \a startIndex and \a endIndex is visible.
2486*/
2487
2488/*!
2489 \class QAccessibleEditableTextInterface
2490 \ingroup accessibility
2491 \inmodule QtGui
2492
2493 \brief The QAccessibleEditableTextInterface class implements support for objects with editable text.
2494
2495 When implementing this interface you will almost certainly also want to implement \l QAccessibleTextInterface.
2496
2497 \sa QAccessibleInterface
2498
2499 \l{IAccessible2 Specification}
2500*/
2501
2502/*!
2503
2504 Destroys the QAccessibleEditableTextInterface.
2505*/
2506QAccessibleEditableTextInterface::~QAccessibleEditableTextInterface()
2507{
2508}
2509
2510/*!
2511 \fn void QAccessibleEditableTextInterface::deleteText(int startOffset, int endOffset)
2512
2513 Deletes the text from \a startOffset to \a endOffset.
2514*/
2515
2516/*!
2517 \fn void QAccessibleEditableTextInterface::insertText(int offset, const QString &text)
2518
2519 Inserts \a text at position \a offset.
2520*/
2521
2522/*!
2523 \fn void QAccessibleEditableTextInterface::replaceText(int startOffset, int endOffset, const QString &text)
2524
2525 Removes the text from \a startOffset to \a endOffset and instead inserts \a text.
2526*/
2527
2528/*!
2529 \class QAccessibleValueInterface
2530 \inmodule QtGui
2531 \ingroup accessibility
2532
2533 \brief The QAccessibleValueInterface class implements support for objects that manipulate a value.
2534
2535 This interface should be implemented by accessible objects that represent a value.
2536 Examples are spinner, slider, dial and scroll bar.
2537
2538 Instead of forcing the user to deal with the individual parts of the widgets, this interface
2539 gives an easier approach to the kind of widget it represents.
2540
2541 Usually this interface is implemented by classes that also implement \l QAccessibleInterface.
2542
2543 \l{IAccessible2 Specification}
2544*/
2545
2546/*!
2547 Destroys the QAccessibleValueInterface.
2548
2549*/
2550QAccessibleValueInterface::~QAccessibleValueInterface()
2551{
2552}
2553
2554/*!
2555 \fn QVariant QAccessibleValueInterface::currentValue() const
2556
2557 Returns the current value of the widget. This is usually a double or int.
2558 \sa setCurrentValue()
2559*/
2560
2561/*!
2562 \fn void QAccessibleValueInterface::setCurrentValue(const QVariant &value)
2563
2564 Sets the \a value. If the desired \a value is out of the range of permissible values,
2565 this call will be ignored.
2566
2567 \sa currentValue(), minimumValue(), maximumValue()
2568*/
2569
2570/*!
2571 \fn QVariant QAccessibleValueInterface::maximumValue() const
2572
2573 Returns the maximum value this object accepts.
2574 \sa minimumValue(), currentValue()
2575*/
2576
2577/*!
2578 \fn QVariant QAccessibleValueInterface::minimumValue() const
2579
2580 Returns the minimum value this object accepts.
2581 \sa maximumValue(), currentValue()
2582*/
2583
2584/*!
2585 \fn QVariant QAccessibleValueInterface::minimumStepSize() const
2586
2587 Returns the minimum step size for the accessible.
2588 This is the smallest increment that makes sense when changing the value.
2589 When programmatically changing the value it should always be a multiple
2590 of the minimum step size.
2591
2592 Some tools use this value even when the setCurrentValue does not
2593 perform any action. Progress bars for example are read-only but
2594 should return their range divided by 100.
2595*/
2596
2597/*!
2598 \class QAccessibleImageInterface
2599 \inmodule QtGui
2600 \ingroup accessibility
2601 \internal
2602 \preliminary
2603
2604 \brief The QAccessibleImageInterface class implements support for
2605 the IAccessibleImage interface.
2606
2607 \l{IAccessible2 Specification}
2608*/
2609
2610/*!
2611 Destroys the QAccessibleImageInterface.
2612*/
2613QAccessibleImageInterface::~QAccessibleImageInterface()
2614{
2615}
2616
2617/*!
2618 \class QAccessibleTableCellInterface
2619 \inmodule QtGui
2620 \ingroup accessibility
2621
2622 \brief The QAccessibleTableCellInterface class implements support for
2623 the IAccessibleTable2 Cell interface.
2624
2625 \l{IAccessible2 Specification}
2626*/
2627
2628/*!
2629
2630 Destroys the QAccessibleTableCellInterface.
2631*/
2632QAccessibleTableCellInterface::~QAccessibleTableCellInterface()
2633{
2634}
2635
2636/*!
2637 \fn virtual int QAccessibleTableCellInterface::columnExtent() const
2638
2639 Returns the number of columns occupied by this cell accessible.
2640*/
2641
2642/*!
2643 \fn virtual QList<QAccessibleInterface*> QAccessibleTableCellInterface::columnHeaderCells() const
2644
2645 Returns the column headers as an array of cell accessibles.
2646*/
2647
2648/*!
2649 \fn virtual int QAccessibleTableCellInterface::columnIndex() const
2650
2651 Translates this cell accessible into the corresponding column index.
2652*/
2653
2654/*!
2655 \fn virtual int QAccessibleTableCellInterface::rowExtent() const
2656
2657 Returns the number of rows occupied by this cell accessible.
2658*/
2659
2660/*!
2661 \fn virtual QList<QAccessibleInterface*> QAccessibleTableCellInterface::rowHeaderCells() const
2662
2663 Returns the row headers as an array of cell accessibles.
2664*/
2665
2666/*!
2667 \fn virtual int QAccessibleTableCellInterface::rowIndex() const
2668
2669 Translates this cell accessible into the corresponding row index.
2670*/
2671
2672/*!
2673 \fn virtual bool QAccessibleTableCellInterface::isSelected() const
2674
2675 Returns a boolean value indicating whether this cell is selected.
2676*/
2677
2678/*!
2679 \fn virtual QAccessibleInterface *QAccessibleTableCellInterface::table() const
2680
2681 Returns the QAccessibleInterface of the table containing this cell.
2682*/
2683
2684
2685/*!
2686 \class QAccessibleTableInterface
2687 \inmodule QtGui
2688 \ingroup accessibility
2689
2690 \brief The QAccessibleTableInterface class implements support for
2691 the IAccessibleTable2 interface.
2692
2693 \l{IAccessible2 Specification}
2694*/
2695
2696/*!
2697
2698 Destroys the QAccessibleTableInterface.
2699*/
2700QAccessibleTableInterface::~QAccessibleTableInterface()
2701{
2702}
2703
2704/*!
2705 \fn virtual QAccessibleInterface *QAccessibleTableInterface::cellAt(int row, int column) const
2706
2707 Returns the cell at the specified \a row and \a column in the table.
2708*/
2709
2710/*!
2711 \fn virtual QAccessibleInterface *QAccessibleTableInterface::caption() const
2712
2713 Returns the caption for the table.
2714*/
2715
2716/*!
2717 \fn virtual QString QAccessibleTableInterface::columnDescription(int column) const
2718
2719 Returns the description text of the specified \a column in the table.
2720*/
2721
2722/*!
2723 \fn virtual int QAccessibleTableInterface::columnCount() const
2724
2725 Returns the total number of columns in table.
2726*/
2727
2728/*!
2729 \fn virtual int QAccessibleTableInterface::rowCount() const
2730
2731 Returns the total number of rows in table.
2732*/
2733
2734/*!
2735 \fn virtual int QAccessibleTableInterface::selectedCellCount() const
2736
2737 Returns the total number of selected cells.
2738*/
2739
2740/*!
2741 \fn virtual int QAccessibleTableInterface::selectedColumnCount() const
2742
2743 Returns the total number of selected columns.
2744*/
2745
2746/*!
2747 \fn virtual int QAccessibleTableInterface::selectedRowCount() const
2748
2749 Returns the total number of selected rows.
2750*/
2751
2752/*!
2753 \fn virtual QString QAccessibleTableInterface::rowDescription(int row) const
2754
2755 Returns the description text of the specified \a row in the table.
2756*/
2757
2758/*!
2759 \fn virtual QList<int> QAccessibleTableInterface::selectedCells() const
2760
2761 Returns the list of selected cell (by their index as \l QAccessibleInterface::child() accepts).
2762*/
2763
2764/*!
2765 \fn virtual QList<int> QAccessibleTableInterface::selectedColumns() const
2766
2767 Returns the list of currently selected columns.
2768*/
2769
2770/*!
2771 \fn virtual QList<int> QAccessibleTableInterface::selectedRows() const
2772
2773 Returns the list of currently selected rows.
2774*/
2775
2776/*!
2777 \fn virtual QAccessibleInterface *QAccessibleTableInterface::summary() const
2778
2779 Returns a QAccessibleInterface that represents a summary of the table.
2780 This function may return 0 if no such interface exists.
2781*/
2782
2783/*!
2784 \fn virtual bool QAccessibleTableInterface::isColumnSelected(int column) const
2785
2786 Returns a boolean value indicating whether the specified \a column is completely selected.
2787*/
2788
2789/*!
2790 \fn virtual bool QAccessibleTableInterface::isRowSelected(int row) const
2791
2792 Returns a boolean value indicating whether the specified \a row is completely selected.
2793*/
2794
2795/*!
2796 \fn virtual bool QAccessibleTableInterface::selectRow(int row)
2797
2798 Selects \a row. This function might unselect all previously selected rows.
2799 Returns \c true if the selection was successful.
2800*/
2801
2802/*!
2803 \fn virtual bool QAccessibleTableInterface::selectColumn(int column)
2804
2805 Selects \a column. This function might unselect all previously selected columns.
2806 Returns \c true if the selection was successful.
2807*/
2808
2809/*!
2810 \fn virtual bool QAccessibleTableInterface::unselectRow(int row)
2811
2812 Unselects \a row, leaving other selected rows selected (if any).
2813 Returns \c true if the selection was successful.
2814*/
2815
2816/*!
2817 \fn virtual bool QAccessibleTableInterface::unselectColumn(int column)
2818
2819 Unselects \a column, leaving other selected columns selected (if any).
2820 Returns \c true if the selection was successful.
2821*/
2822
2823/*!
2824 \fn virtual void QAccessibleTableInterface::modelChange(QAccessibleTableModelChangeEvent *event)
2825
2826 Informs about a change in the model's layout.
2827 The \a event contains the details.
2828 \sa QAccessibleTableModelChangeEvent
2829*/
2830
2831
2832/*!
2833 \class QAccessibleActionInterface
2834 \inmodule QtGui
2835 \ingroup accessibility
2836
2837 \brief The QAccessibleActionInterface class implements support for
2838 invocable actions in the interface.
2839
2840 Accessible objects should implement the action interface if they support user interaction.
2841 Usually this interface is implemented by classes that also implement \l QAccessibleInterface.
2842
2843 The supported actions should use the predefined actions offered in this class unless they do not
2844 fit a predefined action. In that case a custom action can be added.
2845
2846 When subclassing QAccessibleActionInterface you need to provide a list of actionNames which
2847 is the primary means to discover the available actions. Action names are never localized.
2848 In order to present actions to the user there are two functions that need to return localized versions
2849 of the name and give a description of the action. For the predefined action names use
2850 \l QAccessibleActionInterface::localizedActionName() and \l QAccessibleActionInterface::localizedActionDescription()
2851 to return their localized counterparts.
2852
2853 In general you should use one of the predefined action names, unless describing an action that does not fit these:
2854 \table
2855 \header \li Action name \li Description
2856 \row \li \l toggleAction() \li toggles the item (checkbox, radio button, switch, ...)
2857 \row \li \l decreaseAction() \li decrease the value of the accessible (e.g. spinbox)
2858 \row \li \l increaseAction() \li increase the value of the accessible (e.g. spinbox)
2859 \row \li \l pressAction() \li press or click or activate the accessible (should correspond to clicking the object with the mouse)
2860 \row \li \l setFocusAction() \li set the focus to this accessible
2861 \row \li \l showMenuAction() \li show a context menu, corresponds to right-clicks
2862 \endtable
2863
2864 In order to invoke the action, \l doAction() is called with an action name.
2865
2866 Most widgets will simply implement \l pressAction(). This is what happens when the widget is activated by
2867 being clicked, space pressed or similar.
2868
2869 \l{IAccessible2 Specification}
2870*/
2871
2872/*!
2873
2874 Destroys the QAccessibleActionInterface.
2875*/
2876QAccessibleActionInterface::~QAccessibleActionInterface()
2877{
2878}
2879
2880/*!
2881 \fn QStringList QAccessibleActionInterface::actionNames() const
2882
2883 Returns the list of actions supported by this accessible object.
2884 The actions returned should be in preferred order,
2885 i.e. the action that the user most likely wants to trigger should be returned first,
2886 while the least likely action should be returned last.
2887
2888 The list does only contain actions that can be invoked.
2889 It won't return disabled actions, or actions associated with disabled UI controls.
2890
2891 The list can be empty.
2892
2893 Note that this list is not localized. For a localized representation re-implement \l localizedActionName()
2894 and \l localizedActionDescription()
2895
2896 \sa doAction(), localizedActionName(), localizedActionDescription()
2897*/
2898
2899/*!
2900 \fn QString QAccessibleActionInterface::localizedActionName(const QString &actionName) const
2901
2902 Returns a localized action name of \a actionName.
2903
2904 For custom actions this function has to be re-implemented.
2905 When using one of the default names, you can call this function in QAccessibleActionInterface
2906 to get the localized string.
2907
2908 \sa actionNames(), localizedActionDescription()
2909*/
2910
2911/*!
2912 \fn QString QAccessibleActionInterface::localizedActionDescription(const QString &actionName) const
2913
2914 Returns a localized action description of the action \a actionName.
2915
2916 When using one of the default names, you can call this function in QAccessibleActionInterface
2917 to get the localized string.
2918
2919 \sa actionNames(), localizedActionName()
2920*/
2921
2922/*!
2923 \fn void QAccessibleActionInterface::doAction(const QString &actionName)
2924
2925 Invokes the action specified by \a actionName.
2926 Note that \a actionName is the non-localized name as returned by \l actionNames()
2927 This function is usually implemented by calling the same functions
2928 that other user interaction, such as clicking the object, would trigger.
2929
2930 \sa actionNames()
2931*/
2932
2933/*!
2934 \fn QStringList QAccessibleActionInterface::keyBindingsForAction(const QString &actionName) const
2935
2936 Returns a list of the keyboard shortcuts available for invoking the action named \a actionName.
2937
2938 This is important to let users learn alternative ways of using the application by emphasizing the keyboard.
2939
2940 \sa actionNames()
2941*/
2942
2943
2944struct QAccessibleActionStrings
2945{
2946 QAccessibleActionStrings() :
2947 pressAction(QStringLiteral(QT_TRANSLATE_NOOP("QAccessibleActionInterface", "Press"))),
2948 increaseAction(QStringLiteral(QT_TRANSLATE_NOOP("QAccessibleActionInterface", "Increase"))),
2949 decreaseAction(QStringLiteral(QT_TRANSLATE_NOOP("QAccessibleActionInterface", "Decrease"))),
2950 showMenuAction(QStringLiteral(QT_TRANSLATE_NOOP("QAccessibleActionInterface", "ShowMenu"))),
2951 setFocusAction(QStringLiteral(QT_TRANSLATE_NOOP("QAccessibleActionInterface", "SetFocus"))),
2952 toggleAction(QStringLiteral(QT_TRANSLATE_NOOP("QAccessibleActionInterface", "Toggle"))),
2953 scrollLeftAction(QStringLiteral(QT_TRANSLATE_NOOP("QAccessibleActionInterface", "Scroll Left"))),
2954 scrollRightAction(QStringLiteral(QT_TRANSLATE_NOOP("QAccessibleActionInterface", "Scroll Right"))),
2955 scrollUpAction(QStringLiteral(QT_TRANSLATE_NOOP("QAccessibleActionInterface", "Scroll Up"))),
2956 scrollDownAction(QStringLiteral(QT_TRANSLATE_NOOP("QAccessibleActionInterface", "Scroll Down"))),
2957 previousPageAction(QStringLiteral(QT_TRANSLATE_NOOP("QAccessibleActionInterface", "Previous Page"))),
2958 nextPageAction(QStringLiteral(QT_TRANSLATE_NOOP("QAccessibleActionInterface", "Next Page")))
2959 {}
2960
2961 const QString pressAction;
2962 const QString increaseAction;
2963 const QString decreaseAction;
2964 const QString showMenuAction;
2965 const QString setFocusAction;
2966 const QString toggleAction;
2967 const QString scrollLeftAction;
2968 const QString scrollRightAction;
2969 const QString scrollUpAction;
2970 const QString scrollDownAction;
2971 const QString previousPageAction;
2972 const QString nextPageAction;
2973
2974 QString localizedDescription(const QString &actionName)
2975 {
2976 if (actionName == pressAction)
2977 return QAccessibleActionInterface::tr("Triggers the action");
2978 else if (actionName == increaseAction)
2979 return QAccessibleActionInterface::tr("Increase the value");
2980 else if (actionName == decreaseAction)
2981 return QAccessibleActionInterface::tr("Decrease the value");
2982 else if (actionName == showMenuAction)
2983 return QAccessibleActionInterface::tr("Shows the menu");
2984 else if (actionName == setFocusAction)
2985 return QAccessibleActionInterface::tr("Sets the focus");
2986 else if (actionName == toggleAction)
2987 return QAccessibleActionInterface::tr("Toggles the state");
2988 else if (actionName == scrollLeftAction)
2989 return QAccessibleActionInterface::tr("Scrolls to the left");
2990 else if (actionName == scrollRightAction)
2991 return QAccessibleActionInterface::tr("Scrolls to the right");
2992 else if (actionName == scrollUpAction)
2993 return QAccessibleActionInterface::tr("Scrolls up");
2994 else if (actionName == scrollDownAction)
2995 return QAccessibleActionInterface::tr("Scrolls down");
2996 else if (actionName == previousPageAction)
2997 return QAccessibleActionInterface::tr("Goes back a page");
2998 else if (actionName == nextPageAction)
2999 return QAccessibleActionInterface::tr("Goes to the next page");
3000
3001
3002 return QString();
3003 }
3004};
3005
3006Q_GLOBAL_STATIC(QAccessibleActionStrings, accessibleActionStrings)
3007
3008QString QAccessibleActionInterface::localizedActionName(const QString &actionName) const
3009{
3010 return QAccessibleActionInterface::tr(qPrintable(actionName));
3011}
3012
3013QString QAccessibleActionInterface::localizedActionDescription(const QString &actionName) const
3014{
3015 return accessibleActionStrings()->localizedDescription(actionName);
3016}
3017
3018/*!
3019 Returns the name of the press default action.
3020 \sa actionNames(), localizedActionName()
3021 */
3022const QString &QAccessibleActionInterface::pressAction()
3023{
3024 return accessibleActionStrings()->pressAction;
3025}
3026
3027/*!
3028 Returns the name of the increase default action.
3029 \sa actionNames(), localizedActionName()
3030 */
3031const QString &QAccessibleActionInterface::increaseAction()
3032{
3033 return accessibleActionStrings()->increaseAction;
3034}
3035
3036/*!
3037 Returns the name of the decrease default action.
3038 \sa actionNames(), localizedActionName()
3039 */
3040const QString &QAccessibleActionInterface::decreaseAction()
3041{
3042 return accessibleActionStrings()->decreaseAction;
3043}
3044
3045/*!
3046 Returns the name of the show menu default action.
3047 \sa actionNames(), localizedActionName()
3048 */
3049const QString &QAccessibleActionInterface::showMenuAction()
3050{
3051 return accessibleActionStrings()->showMenuAction;
3052}
3053
3054/*!
3055 Returns the name of the set focus default action.
3056 \sa actionNames(), localizedActionName()
3057 */
3058const QString &QAccessibleActionInterface::setFocusAction()
3059{
3060 return accessibleActionStrings()->setFocusAction;
3061}
3062
3063/*!
3064 Returns the name of the toggle default action.
3065 \sa actionNames(), localizedActionName()
3066 */
3067const QString &QAccessibleActionInterface::toggleAction()
3068{
3069 return accessibleActionStrings()->toggleAction;
3070}
3071
3072/*!
3073 Returns the name of the scroll left default action.
3074 \sa actionNames(), localizedActionName()
3075 */
3076QString QAccessibleActionInterface::scrollLeftAction()
3077{
3078 return accessibleActionStrings()->scrollLeftAction;
3079}
3080
3081/*!
3082 Returns the name of the scroll right default action.
3083 \sa actionNames(), localizedActionName()
3084 */
3085QString QAccessibleActionInterface::scrollRightAction()
3086{
3087 return accessibleActionStrings()->scrollRightAction;
3088}
3089
3090/*!
3091 Returns the name of the scroll up default action.
3092 \sa actionNames(), localizedActionName()
3093 */
3094QString QAccessibleActionInterface::scrollUpAction()
3095{
3096 return accessibleActionStrings()->scrollUpAction;
3097}
3098
3099/*!
3100 Returns the name of the scroll down default action.
3101 \sa actionNames(), localizedActionName()
3102 */
3103QString QAccessibleActionInterface::scrollDownAction()
3104{
3105 return accessibleActionStrings()->scrollDownAction;
3106}
3107
3108/*!
3109 Returns the name of the previous page default action.
3110 \sa actionNames(), localizedActionName()
3111 */
3112QString QAccessibleActionInterface::previousPageAction()
3113{
3114 return accessibleActionStrings()->previousPageAction;
3115}
3116
3117/*!
3118 Returns the name of the next page default action.
3119 \sa actionNames(), localizedActionName()
3120 */
3121QString QAccessibleActionInterface::nextPageAction()
3122{
3123 return accessibleActionStrings()->nextPageAction;
3124}
3125
3126
3127/*!
3128 \since 6.5
3129 \class QAccessibleSelectionInterface
3130 \inmodule QtGui
3131 \ingroup accessibility
3132
3133 \brief The QAccessibleSelectionInterface class implements support for
3134 selection handling.
3135
3136 It provides methods for both, retrieving the current selection
3137 as well as modifying the selection.
3138
3139 Only selections of direct children are supported.
3140*/
3141
3142/*!
3143
3144 Destroys the QAccessibleSelectionInterface.
3145*/
3146QAccessibleSelectionInterface::~QAccessibleSelectionInterface()
3147{
3148}
3149
3150/*!
3151 \fn virtual int QAccessibleSelectionInterface::selectedItemCount() const
3152
3153 Returns the total number of selected accessible items.
3154*/
3155
3156/*!
3157 \fn virtual QList<QAccessibleInterface *> QAccessibleSelectionInterface::selectedItems() const
3158
3159 Returns the list of selected accessible items.
3160*/
3161
3162/*!
3163 Returns the selected accessible item at index \a selectionIndex in the selection.
3164
3165 Note that the index refers to the n-th selected accessible item (i.e. the index in the current selection),
3166 which generally differs from the index that would be passed to \l QAccessibleInterface::child()
3167 in order to retrieve the same item.
3168
3169 The default implementation uses \a selectionIndex to retrieve the item from the list
3170 of selected items retrieved by \l QAccessibleSelectionInterface::selectedItems().
3171
3172 In particular for implementations dealing with many selected items, reimplementing
3173 this method in a more efficient way may be desirable for performance reasons.
3174*/
3175QAccessibleInterface* QAccessibleSelectionInterface::selectedItem(int selectionIndex) const
3176{
3177 QList<QAccessibleInterface*> items = selectedItems();
3178 if (selectionIndex < 0 || selectionIndex > items.length() -1) {
3179 qCWarning(lcAccessibilityCore) << "Selection index" << selectionIndex << "out of range.";
3180 return nullptr;
3181 }
3182
3183 return items.at(selectionIndex);
3184}
3185
3186/*!
3187 Returns whether \a childItem is part of the current selection.
3188
3189 The default implementation checks whether \a childItem is contained
3190 in the list of items retrieved by \l QAccessibleSelectionInterface::selectedItems.
3191*/
3192bool QAccessibleSelectionInterface::isSelected(QAccessibleInterface *childItem) const
3193{
3194 return selectedItems().contains(childItem);
3195}
3196
3197/*!
3198 \fn virtual bool QAccessibleSelectionInterface::select(QAccessibleInterface *childItem)
3199
3200 Adds \a childItem to the selection.
3201 Returns whether \a childItem has actually been added to the selection.
3202
3203 For implementations that only allow single selections,
3204 this may replace the current selection.
3205*/
3206
3207/*!
3208 \fn virtual bool QAccessibleSelectionInterface::unselect(QAccessibleInterface *childItem)
3209
3210 Removes \a childItem from the selection.
3211
3212 Returns whether the accessible item has actually been removed from the selection.
3213*/
3214
3215/*!
3216 \fn virtual bool QAccessibleSelectionInterface::selectAll()
3217
3218 Selects all accessible child items.
3219
3220 Returns whether all accessible child items have actually been added to the selection.
3221*/
3222
3223/*!
3224 \fn virtual bool QAccessibleSelectionInterface::clear()
3225
3226 Unselects all accessible child items.
3227
3228 Returns whether all accessible child items have actually been removed from the selection,
3229 i.e. whether the selection is empty after this method has been called.
3230*/
3231
3232
3233/*!
3234 \since 6.8
3235 \class QAccessibleAttributesInterface
3236 \inmodule QtGui
3237 \ingroup accessibility
3238
3239 \brief The QAccessibleAttributesInterface class implements support for
3240 reporting attributes for an accessible object.
3241
3242 Attributes are key-value pairs. Values are stored in \l QVariant.
3243
3244 The \l QAccessible::Attribute enumeration describes the available keys and
3245 documents which type to use for the value of each key.
3246
3247 While the text-specific attributes handled by \l QAccessibleTextInterface::attributes
3248 are specific to objects implementing text and are specific to a specific text
3249 position/offset, the attributes handled by the \l QAccessibleAttributesInterface
3250 can be used for objects of any role and apply for the whole object.
3251
3252 Classes already implementing \l QAccessibleTextInterface for text-specific attrtibutes
3253 may want to implement \l QAccessibleAttributesInterface in addition for object-specific
3254 attributes.
3255*/
3256
3257/*!
3258
3259 Destroys the QAccessibleAttributesInterface.
3260*/
3261QAccessibleAttributesInterface::~QAccessibleAttributesInterface()
3262{
3263}
3264
3265/*!
3266 \fn QList<QAccessible::Attribute> QAccessibleAttributesInterface::attributeKeys() const
3267
3268 Returns the keys of all attributes the object supports. The \l QAccessible::Attribute
3269 enumeration describes available keys.
3270*/
3271
3272/*!
3273 \fn QVariant QAccessibleAttributesInterface::attributeValue(QAccessible::Attribute key) const
3274
3275 Returns the value of the attribute \a key of this object.
3276
3277 If the attribute is set for this object, a value of the type documented for the
3278 given key in the documentation of the \l QAccessible::Attribute enumeration is
3279 returned in the \l QVariant.
3280
3281 Otherwise, an invalid \l QVariant is returned.
3282*/
3283
3284/*! \internal */
3285QString qAccessibleLocalizedActionDescription(const QString &actionName)
3286{
3287 return accessibleActionStrings()->localizedDescription(actionName);
3288}
3289
3290/*!
3291 \internal
3292 \fn QString QAccessibleHyperlinkInterface::anchor() const
3293
3294 The logical/human readable name of the hyperlink
3295*/
3296
3297/*!
3298 \internal
3299 \fn QString QAccessibleHyperlinkInterface::anchorTarget() const
3300
3301 The target url of the hyperlink
3302*/
3303
3304/*!
3305 \internal
3306 \fn int QAccessibleHyperlinkInterface::startIndex() const
3307
3308 Returns the start index that will refer to the first character in the text where the hyperlink
3309 begins. The index corresponds to the index that the QAccessibleTextInterface needs in order
3310 to find the start of the hyperlink.
3311
3312*/
3313
3314/*!
3315 \internal
3316 \fn int QAccessibleHyperlinkInterface::endIndex() const
3317
3318 Returns the end index that will refer to the first character in the text where the hyperlink
3319 begins. The index corresponds to the index that the QAccessibleTextInterface needs in order
3320 to find the end of the hyperlink.
3321*/
3322
3323QAccessibleHyperlinkInterface::~QAccessibleHyperlinkInterface()
3324{
3325
3326}
3327
3328#endif // QT_CONFIG(accessibility)
3329
3330QT_END_NAMESPACE
3331
3332#include "moc_qaccessible_base.cpp"
Q_STATIC_LOGGING_CATEGORY(lcAccessibilityCore, "qt.accessibility.core")