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