accessible/qaccessible.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtGui module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/contact-us. -
16** -
17** GNU Lesser General Public License Usage -
18** Alternatively, this file may be used under the terms of the GNU Lesser -
19** General Public License version 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include "qaccessible.h" -
43 -
44#include "qaccessibleplugin.h" -
45#include "qaccessibleobject.h" -
46#include "qaccessiblebridge.h" -
47#include <QtGui/QGuiApplication> -
48#include <private/qguiapplication_p.h> -
49#include <qpa/qplatformaccessibility.h> -
50#include <qpa/qplatformintegration.h> -
51 -
52#include <QtCore/qdebug.h> -
53#include <QtCore/qmetaobject.h> -
54#include <private/qfactoryloader_p.h> -
55 -
56QT_BEGIN_NAMESPACE -
57 -
58/*! -
59 \class QAccessible -
60 \brief The QAccessible class provides enums and static functions -
61 related to accessibility. -
62 \internal -
63 -
64 \ingroup accessibility -
65 \inmodule QtWidgets -
66 -
67 This class is part of \l {Accessibility for QWidget Applications}. -
68 -
69 Accessible applications can be used by people who are not able to -
70 use applications by conventional means. -
71 -
72 The functions in this class are used for communication between -
73 accessible applications (also called AT Servers) and -
74 accessibility tools (AT Clients), such as screen readers and -
75 braille displays. Clients and servers communicate in the following way: -
76 -
77 \list -
78 \li \e{AT Servers} notify the clients about events through calls to the -
79 updateAccessibility() function. -
80 -
81 \li \e{AT Clients} request information about the objects in the server. -
82 The QAccessibleInterface class is the core interface, and encapsulates -
83 this information in a pure virtual API. Implementations of the interface -
84 are provided by Qt through the queryAccessibleInterface() API. -
85 \endlist -
86 -
87 The communication between servers and clients is initialized by -
88 the setRootObject() function. Function pointers can be installed -
89 to replace or extend the default behavior of the static functions -
90 in QAccessible. -
91 -
92 Qt supports Microsoft Active Accessibility (MSAA), Mac OS X -
93 Accessibility, and the Unix/X11 AT-SPI standard. Other backends -
94 can be supported using QAccessibleBridge. -
95 -
96 In addition to QAccessible's static functions, Qt offers one -
97 generic interface, QAccessibleInterface, that can be used to wrap -
98 all widgets and objects (e.g., QPushButton). This single -
99 interface provides all the metadata necessary for the assistive -
100 technologies. Qt provides implementations of this interface for -
101 its built-in widgets as plugins. -
102 -
103 When you develop custom widgets, you can create custom subclasses -
104 of QAccessibleInterface and distribute them as plugins (using -
105 QAccessiblePlugin) or compile them into the application. -
106 Likewise, Qt's predefined accessibility support can be built as -
107 plugin (the default) or directly into the Qt library. The main -
108 advantage of using plugins is that the accessibility classes are -
109 only loaded into memory if they are actually used; they don't -
110 slow down the common case where no assistive technology is being -
111 used. -
112 -
113 Qt also includes two convenience classes, QAccessibleObject and -
114 QAccessibleWidget, that inherit from QAccessibleInterface and -
115 provide the lowest common denominator of metadata (e.g., widget -
116 geometry, window title, basic help text). You can use them as -
117 base classes when wrapping your custom QObject or QWidget -
118 subclasses. -
119 -
120 \sa QAccessibleInterface -
121*/ -
122 -
123 -
124/*! -
125 \class QAccessible::State -
126 -
127 \inmodule QtGui -
128 -
129 This structure defines bit flags that indicate -
130 the state of an accessible object. The values are: -
131 -
132 \value active The object is the active window or the active sub-element in a container (that would get focus when focusing the container). -
133 \value adjustable The object represents an adjustable value, e.g. sliders. -
134 \value animated The object's appearance changes frequently. -
135 \value busy The object cannot accept input at the moment. -
136 \value checkable The object is checkable. -
137 \value checked The object's check box is checked. -
138 \value checkStateMixed The third state of checkboxes (half checked in tri-state check boxes). -
139 \value collapsed The object is collapsed, e.g. a closed listview item, or an iconified window. -
140 \value defaultButton The object represents the default button in a dialog. -
141 \value defunct The object no longer exists. -
142 \value editable The object has a text carret (and often implements the text interface). -
143 \value expandable The object is expandable, mostly used for cells in a tree view. -
144 \value expanded The object is expanded, currently its children are visible. -
145 \value extSelectable The object supports extended selection. -
146 \value focusable The object can receive focus. Only objects in the active window can receive focus. -
147 \value focused The object has keyboard focus. -
148 \value hasPopup The object opens a popup. -
149 \value hotTracked The object's appearance is sensitive to the mouse cursor position. -
150 \value invalid The object is no longer valid (because it has been deleted). -
151 \value invalidEntry Input validation current input invalid. -
152 \value invisible The object is not visible to the user. -
153 \value linked The object is linked to another object, e.g. a hyperlink. -
154 \value marqueed The object displays scrolling contents, e.g. a log view. -
155 \value modal The object blocks input from other objects. -
156 \value movable The object can be moved. -
157 \value multiLine The object has multiple lines of text (word wrap), as opposed to a single line. -
158 \value multiSelectable The object supports multiple selected items. -
159 \value offscreen The object is clipped by the visible area. Objects that are off screen are also invisible. -
160 \value passwordEdit The object is a password field, e.g. a line edit for entering a Password. -
161 \value playsSound The object produces sound when interacted with. -
162 \value pressed The object is pressed. -
163 \value readOnly The object can usually be edited, but is explicitly set to read-only. -
164 \value selectable The object is selectable. -
165 \value selectableText The object has text which can be selected. This is different from selectable which refers to the object's children. -
166 \value selected The object is selected. -
167 \value selfVoicing The object describes itself through speech or sound. -
168 \value sizeable The object can be resized, e.g. top-level windows. -
169 \value summaryElement The object summarizes the state of the window and should be treated with priority. -
170 \value supportsAutoCompletion The object has auto-completion, for example in line edits or combo boxes. -
171 \value traversed The object is linked and has been visited. -
172 \value updatesFrequently The object changes frequently and needs to be refreshed when accessing it. -
173 \value disabled The object is unavailable to the user, e.g. a disabled widget. -
174 -
175 Implementations of QAccessibleInterface::state() return a combination -
176 of these flags. -
177*/ -
178 -
179/*! -
180 \fn QAccessible::State::State() -
181 -
182 Constructs a new QAccessible::State with all states set to false. -
183*/ -
184 -
185/*! -
186 \enum QAccessible::Event -
187 -
188 This enum type defines accessible event types. -
189 -
190 \omitvalue InvalidEvent Internal: Used when creating subclasses of QAccessibleEvent. -
191 \value AcceleratorChanged The keyboard accelerator for an action has been changed. -
192 \value ActionChanged An action has been changed. -
193 \value ActiveDescendantChanged -
194 \value Alert A system alert (e.g., a message from a QMessageBox) -
195 \value AttributeChanged -
196 \value ContextHelpEnd Context help (QWhatsThis) for an object is finished. -
197 \value ContextHelpStart Context help (QWhatsThis) for an object is initiated. -
198 \value DefaultActionChanged The default QAccessible::Action for the accessible -
199 object has changed. -
200 \value DescriptionChanged The object's QAccessible::Description changed. -
201 \value DialogEnd A dialog (QDialog) has been hidden -
202 \value DialogStart A dialog (QDialog) has been set visible. -
203 \value DocumentContentChanged The contents of a text document have changed. -
204 \value DocumentLoadComplete A document has been loaded. -
205 \value DocumentLoadStopped A document load has been stopped. -
206 \value DocumentReload A document reload has been initiated. -
207 \value DragDropEnd A drag and drop operation is about to finished. -
208 \value DragDropStart A drag and drop operation is about to be initiated. -
209 \value Focus An object has gained keyboard focus. -
210 \value ForegroundChanged A window has been activated (i.e., a new window has -
211 gained focus on the desktop). -
212 \value HelpChanged The QAccessible::Help text property of an object has -
213 changed. -
214 \value HyperlinkEndIndexChanged The end position of the display text for a hypertext -
215 link has changed. -
216 \value HyperlinkNumberOfAnchorsChanged The number of anchors in a hypertext link has changed, -
217 perhaps because the display text has been split to -
218 provide more than one link. -
219 \value HyperlinkSelectedLinkChanged The link for the selected hypertext link has changed. -
220 \value HyperlinkStartIndexChanged The start position of the display text for a hypertext -
221 link has changed. -
222 \value HypertextChanged The display text for a hypertext link has changed. -
223 \value HypertextLinkActivated A hypertext link has been activated, perhaps by being -
224 clicked or via a key press. -
225 \value HypertextLinkSelected A hypertext link has been selected. -
226 \value HypertextNLinksChanged -
227 \value LocationChanged An object's location on the screen has changed. -
228 \value MenuCommand A menu item is triggered. -
229 \value MenuEnd A menu has been closed (Qt uses PopupMenuEnd for all -
230 menus). -
231 \value MenuStart A menu has been opened on the menubar (Qt uses -
232 PopupMenuStart for all menus). -
233 \value NameChanged The QAccessible::Name property of an object has changed. -
234 \value ObjectAttributeChanged -
235 \value ObjectCreated A new object is created. -
236 \value ObjectDestroyed An object is deleted. -
237 \value ObjectHide An object is hidden; for example, with QWidget::hide(). -
238 Any children the object that is hidden has do not send -
239 this event. It is not sent when an object is hidden as -
240 it is being obcured by others. -
241 \value ObjectReorder A layout or item view has added, removed, or moved an -
242 object (Qt does not use this event). -
243 \value ObjectShow An object is displayed; for example, with -
244 QWidget::show(). -
245 \value PageChanged -
246 \value ParentChanged An object's parent object changed. -
247 \value PopupMenuEnd A pop-up menu has closed. -
248 \value PopupMenuStart A pop-up menu has opened. -
249 \value ScrollingEnd A scrollbar scroll operation has ended (the mouse has -
250 released the slider handle). -
251 \value ScrollingStart A scrollbar scroll operation is about to start; this may -
252 be caused by a mouse press on the slider handle, for -
253 example. -
254 \value SectionChanged -
255 \value SelectionAdd An item has been added to the selection in an item view. -
256 \value SelectionRemove An item has been removed from an item view selection. -
257 \value Selection The selection has changed in a menu or item view. -
258 \value SelectionWithin Several changes to a selection has occurred in an item -
259 view. -
260 \value SoundPlayed A sound has been played by an object -
261 \omitvalue StateChanged The QAccessible::State of an object has changed. -
262 This value is used internally for the QAccessibleStateChangeEvent. -
263 \value TableCaptionChanged A table caption has been changed. -
264 \value TableColumnDescriptionChanged The description of a table column, typically found in -
265 the column's header, has been changed. -
266 \value TableColumnHeaderChanged A table column header has been changed. -
267 \omitvalue TableModelChanged The model providing data for a table has been changed. -
268 \value TableRowDescriptionChanged The description of a table row, typically found in the -
269 row's header, has been changed. -
270 \value TableRowHeaderChanged A table row header has been changed. -
271 \value TableSummaryChanged The summary of a table has been changed. -
272 \omitvalue TextAttributeChanged -
273 \omitvalue TextCaretMoved The caret has moved in an editable widget. -
274 The caret represents the cursor position in an editable -
275 widget with the input focus. -
276 \value TextColumnChanged A text column has been changed. -
277 \omitvalue TextInserted Text has been inserted into an editable widget. -
278 \omitvalue TextRemoved Text has been removed from an editable widget. -
279 \omitvalue TextSelectionChanged The selected text has changed in an editable widget. -
280 \omitvalue TextUpdated The text has been update in an editable widget. -
281 \omitvalue ValueChanged The QAccessible::Value of an object has changed. -
282 \value VisibleDataChanged -
283 -
284 The values for this enum are defined to be the same as those defined in the -
285 \l{AccessibleEventID.idl File Reference}{IAccessible2} and -
286 \l{Microsoft Active Accessibility Event Constants}{MSAA} specifications. -
287*/ -
288 -
289/*! -
290 \enum QAccessible::Role -
291 -
292 This enum defines the role of an accessible object. The roles are: -
293 -
294 \value AlertMessage An object that is used to alert the user. -
295 \value Animation An object that displays an animation. -
296 \value Application The application's main window. -
297 \value Assistant An object that provids interactive help. -
298 \value Border An object that represents a border. -
299 \value ButtonDropDown A button that drops down a list of items. -
300 \value ButtonDropGrid A button that drops down a grid. -
301 \value ButtonMenu A button that drops down a menu. -
302 \value Canvas An object that displays graphics that the user can interact with. -
303 \value Caret An object that represents the system caret (text cursor). -
304 \value Cell A cell in a table. -
305 \value Chart An object that displays a graphical representation of data. -
306 \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. -
307 \value Client The client area in a window. -
308 \value Clock A clock displaying time. -
309 \value Column A column of cells, usually within a table. -
310 \value ColumnHeader A header for a column of data. -
311 \value ComboBox A list of choices that the user can select from. -
312 \value Cursor An object that represents the mouse cursor. -
313 \value Desktop The object represents the desktop or workspace. -
314 \value Dial An object that represents a dial or knob. -
315 \value Dialog A dialog box. -
316 \value Document A document window, usually in an MDI environment. -
317 \value EditableText Editable text -
318 \value Equation An object that represents a mathematical equation. -
319 \value Graphic A graphic or picture, e.g. an icon. -
320 \value Grip A grip that the user can drag to change the size of widgets. -
321 \value Grouping An object that represents a logical grouping of other objects. -
322 \value HelpBalloon An object that displays help in a separate, short lived window. -
323 \value HotkeyField A hotkey field that allows the user to enter a key sequence. -
324 \value Indicator An indicator that represents a current value or item. -
325 \value LayeredPane An object that can contain layered children, e.g. in a stack. -
326 \value Link A link to something else. -
327 \value List A list of items, from which the user can select one or more items. -
328 \value ListItem An item in a list of items. -
329 \value MenuBar A menu bar from which menus are opened by the user. -
330 \value MenuItem An item in a menu or menu bar. -
331 \value NoRole The object has no role. This usually indicates an invalid object. -
332 \value PageTab A page tab that the user can select to switch to a different page in a dialog. -
333 \value PageTabList A list of page tabs. -
334 \value Pane A generic container. -
335 \value PopupMenu A menu which lists options that the user can select to perform an action. -
336 \value ProgressBar The object displays the progress of an operation in progress. -
337 \value PropertyPage A property page where the user can change options and settings. -
338 \value Button A button. -
339 \value RadioButton An object that represents an option that is mutually exclusive with other options. -
340 \value Row A row of cells, usually within a table. -
341 \value RowHeader A header for a row of data. -
342 \value ScrollBar A scroll bar, which allows the user to scroll the visible area. -
343 \value Separator A separator that divides space into logical areas. -
344 \value Slider A slider that allows the user to select a value within a given range. -
345 \value Sound An object that represents a sound. -
346 \value SpinBox A spin box widget that allows the user to enter a value within a given range. -
347 \value Splitter A splitter distributing available space between its child widgets. -
348 \value StaticText Static text, such as labels for other widgets. -
349 \value StatusBar A status bar. -
350 \value Table A table representing data in a grid of rows and columns. -
351 \value Terminal A terminal or command line interface. -
352 \value TitleBar The title bar caption of a window. -
353 \value ToolBar A tool bar, which groups widgets that the user accesses frequently. -
354 \value ToolTip A tool tip which provides information about other objects. -
355 \value Tree A list of items in a tree structure. -
356 \value TreeItem An item in a tree structure. -
357 \value UserRole The first value to be used for user defined roles. -
358 \value Whitespace Blank space between other objects. -
359 \value Window A top level window. -
360*/ -
361 -
362/*! -
363 \enum QAccessible::RelationFlag -
364 -
365 This enum type defines bit flags that can be combined to indicate -
366 the relationship between two accessible objects. -
367 -
368 \value Label The first object is the label of the second object. -
369 \value Labelled The first object is labelled by the second object. -
370 \value Controller The first object controls the second object. -
371 \value Controlled The first object is controlled by the second object. -
372 \value AllRelations Used as a mask to specify that we are interesting in information -
373 about all relations -
374 -
375 Implementations of relations() return a combination of these flags. -
376 Some values are mutually exclusive. -
377*/ -
378 -
379/*! -
380 \enum QAccessible::Text -
381 -
382 This enum specifies string information that an accessible object -
383 returns. -
384 -
385 \value Name The name of the object. This can be used both -
386 as an identifier or a short description by -
387 accessible clients. -
388 \value Description A short text describing the object. -
389 \value Value The value of the object. -
390 \value Help A longer text giving information about how to use the object. -
391 \value Accelerator The keyboard shortcut that executes the object's default action. -
392 \value UserText The first value to be used for user defined text. -
393 \omitvalue DebugDescription -
394*/ -
395 -
396/*! -
397 \enum QAccessible::InterfaceType -
398 -
399 \l QAccessibleInterface supports several sub interfaces. -
400 In order to provide more information about some objects, their accessible -
401 representation should implement one or more of these interfaces. -
402 When subclassing one of these interfaces, \l QAccessibleInterface::interface_cast also needs to be implemented. -
403 -
404 \value TextInterface For text that supports selections or is more than one line. Simple labels do not need to implement this interface. -
405 \value EditableTextInterface For text that can be edited by the user. -
406 \value ValueInterface For objects that are used to manipulate a value, for example slider or scroll bar. -
407 \value ActionInterface For interactive objects that allow the user to trigger an action. Basically everything that allows for example mouse interaction. -
408 \omitvalue ImageInterface For objects that represent an image. This interface is generally less important. -
409 \value TableInterface For lists, tables and trees. -
410 \value TableCellInterface For cells in a TableInterface object. -
411 -
412 \sa QAccessibleInterface::interface_cast, QAccessibleTextInterface, QAccessibleEditableTextInterface, QAccessibleValueInterface, QAccessibleActionInterface, QAccessibleTableInterface, QAccessibleTableCellInterface -
413*/ -
414 -
415/*! -
416 \fn QAccessibleInterface::~QAccessibleInterface() -
417 -
418 Destroys the object. -
419*/ -
420 -
421 -
422 -
423 -
424/* accessible widgets plugin discovery stuff */ -
425#ifndef QT_NO_ACCESSIBILITY -
426#ifndef QT_NO_LIBRARY -
427Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
never executed: delete x;
executed: return thisGlobalStatic.pointer.load();
Execution Count:278
partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
evaluated: !thisGlobalStatic.pointer.load()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:277
partially evaluated: !thisGlobalStatic.destroyed
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-278
428 (QAccessibleFactoryInterface_iid, QLatin1String("/accessible"))) -
429#endif -
430#endif -
431 -
432Q_GLOBAL_STATIC(QList<QAccessible::InterfaceFactory>, qAccessibleFactories)
never executed: delete x;
executed: return thisGlobalStatic.pointer.load();
Execution Count:563
partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
evaluated: !thisGlobalStatic.pointer.load()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:562
partially evaluated: !thisGlobalStatic.destroyed
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-563
433 -
434QAccessible::UpdateHandler QAccessible::updateHandler = 0; -
435QAccessible::RootObjectHandler QAccessible::rootObjectHandler = 0; -
436 -
437static bool accessibility_active = false; -
438static bool cleanupAdded = false; -
439 -
440#ifndef QT_NO_ACCESSIBILITY -
441static QPlatformAccessibility *platformAccessibility() -
442{ -
443 QPlatformIntegration *pfIntegration = QGuiApplicationPrivate::platformIntegration();
executed (the execution status of this line is deduced): QPlatformIntegration *pfIntegration = QGuiApplicationPrivate::platformIntegration();
-
444 return pfIntegration ? pfIntegration->accessibility() : 0;
executed: return pfIntegration ? pfIntegration->accessibility() : 0;
Execution Count:43
43
445} -
446#endif -
447 -
448/*! -
449 \internal -
450*/ -
451void QAccessible::cleanup() -
452{ -
453#ifndef QT_NO_ACCESSIBILITY -
454 if (QPlatformAccessibility *pfAccessibility = platformAccessibility())
never evaluated: QPlatformAccessibility *pfAccessibility = platformAccessibility()
0
455 pfAccessibility->cleanup();
never executed: pfAccessibility->cleanup();
0
456#endif -
457}
never executed: }
0
458 -
459static void qAccessibleCleanup() -
460{ -
461 qAccessibleFactories()->clear();
executed (the execution status of this line is deduced): qAccessibleFactories()->clear();
-
462}
executed: }
Execution Count:1
1
463 -
464/*! -
465 \typedef QAccessible::InterfaceFactory -
466 -
467 This is a typedef for a pointer to a function with the following -
468 signature: -
469 -
470 \snippet code/src_gui_accessible_qaccessible.cpp 1 -
471 -
472 The function receives a QString and a QObject pointer, where the -
473 QString is the key identifying the interface. The QObject is used -
474 to pass on to the QAccessibleInterface so that it can hold a reference -
475 to it. -
476 -
477 If the key and the QObject does not have a corresponding -
478 QAccessibleInterface, a null-pointer will be returned. -
479 -
480 Installed factories are called by queryAccessibilityInterface() until -
481 one provides an interface. -
482*/ -
483 -
484/*! -
485 \typedef QAccessible::UpdateHandler -
486 -
487 \internal -
488 -
489 A function pointer type. Use a function with this prototype to install -
490 your own update function. -
491 -
492 The function is called by updateAccessibility(). -
493*/ -
494 -
495/*! -
496 \typedef QAccessible::RootObjectHandler -
497 -
498 \internal -
499 -
500 A function pointer type. Use a function with this prototype to install -
501 your own root object handler. -
502 -
503 The function is called by setRootObject(). -
504*/ -
505 -
506 -
507/*! -
508 Installs the InterfaceFactory \a factory. The last factory added -
509 is the first one used by queryAccessibleInterface(). -
510*/ -
511void QAccessible::installFactory(InterfaceFactory factory) -
512{ -
513 if (!factory)
partially evaluated: !factory
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
514 return;
never executed: return;
0
515 -
516 if (!cleanupAdded) {
partially evaluated: !cleanupAdded
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
517 qAddPostRoutine(qAccessibleCleanup);
executed (the execution status of this line is deduced): qAddPostRoutine(qAccessibleCleanup);
-
518 cleanupAdded = true;
executed (the execution status of this line is deduced): cleanupAdded = true;
-
519 }
executed: }
Execution Count:1
1
520 if (qAccessibleFactories()->contains(factory))
partially evaluated: qAccessibleFactories()->contains(factory)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
521 return;
never executed: return;
0
522 qAccessibleFactories()->append(factory);
executed (the execution status of this line is deduced): qAccessibleFactories()->append(factory);
-
523}
executed: }
Execution Count:1
1
524 -
525/*! -
526 Removes \a factory from the list of installed InterfaceFactories. -
527*/ -
528void QAccessible::removeFactory(InterfaceFactory factory) -
529{ -
530 qAccessibleFactories()->removeAll(factory);
never executed (the execution status of this line is deduced): qAccessibleFactories()->removeAll(factory);
-
531}
never executed: }
0
532 -
533/*! -
534 \internal -
535 -
536 Installs the given \a handler as the function to be used by -
537 updateAccessibility(), and returns the previously installed -
538 handler. -
539*/ -
540QAccessible::UpdateHandler QAccessible::installUpdateHandler(UpdateHandler handler) -
541{ -
542 UpdateHandler old = updateHandler;
executed (the execution status of this line is deduced): UpdateHandler old = updateHandler;
-
543 updateHandler = handler;
executed (the execution status of this line is deduced): updateHandler = handler;
-
544 return old;
executed: return old;
Execution Count:2
2
545} -
546 -
547/*! -
548 Installs the given \a handler as the function to be used by setRootObject(), -
549 and returns the previously installed handler. -
550*/ -
551QAccessible::RootObjectHandler QAccessible::installRootObjectHandler(RootObjectHandler handler) -
552{ -
553 RootObjectHandler old = rootObjectHandler;
executed (the execution status of this line is deduced): RootObjectHandler old = rootObjectHandler;
-
554 rootObjectHandler = handler;
executed (the execution status of this line is deduced): rootObjectHandler = handler;
-
555 return old;
executed: return old;
Execution Count:2
2
556} -
557 -
558/*! -
559 If a QAccessibleInterface implementation exists for the given \a object, -
560 this function returns a pointer to the implementation; otherwise it -
561 returns 0. -
562 -
563 The function calls all installed factory functions (from most -
564 recently installed to least recently installed) until one is found -
565 that provides an interface for the class of \a object. If no -
566 factory can provide an accessibility implementation for the class -
567 the function loads installed accessibility plugins, and tests if -
568 any of the plugins can provide the implementation. -
569 -
570 If no implementation for the object's class is available, the -
571 function tries to find an implementation for the object's parent -
572 class, using the above strategy. -
573 -
574 \warning The caller is responsible for deleting the returned -
575 interface after use. -
576*/ -
577QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object) -
578{ -
579 accessibility_active = true;
executed (the execution status of this line is deduced): accessibility_active = true;
-
580 if (!object)
partially evaluated: !object
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:223
0-223
581 return 0;
never executed: return 0;
0
582 -
583 const QMetaObject *mo = object->metaObject();
executed (the execution status of this line is deduced): const QMetaObject *mo = object->metaObject();
-
584 while (mo) {
evaluated: mo
TRUEFALSE
yes
Evaluation Count:280
yes
Evaluation Count:2
2-280
585 const QString cn = QLatin1String(mo->className());
executed (the execution status of this line is deduced): const QString cn = QLatin1String(mo->className());
-
586 for (int i = qAccessibleFactories()->count(); i > 0; --i) {
evaluated: i > 0
TRUEFALSE
yes
Evaluation Count:280
yes
Evaluation Count:278
278-280
587 InterfaceFactory factory = qAccessibleFactories()->at(i - 1);
executed (the execution status of this line is deduced): InterfaceFactory factory = qAccessibleFactories()->at(i - 1);
-
588 if (QAccessibleInterface *iface = factory(cn, object))
evaluated: QAccessibleInterface *iface = factory(cn, object)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:278
2-278
589 return iface;
executed: return iface;
Execution Count:2
2
590 }
executed: }
Execution Count:278
278
591#ifndef QT_NO_ACCESSIBILITY -
592#ifndef QT_NO_LIBRARY -
593 if (QAccessibleInterface * iface = qLoadPlugin1<QAccessibleInterface, QAccessiblePlugin>(loader(), cn, object))
evaluated: QAccessibleInterface * iface = qLoadPlugin1<QAccessibleInterface, QAccessiblePlugin>(loader(), cn, object)
TRUEFALSE
yes
Evaluation Count:219
yes
Evaluation Count:59
59-219
594 return iface;
executed: return iface;
Execution Count:219
219
595#endif -
596#endif -
597 mo = mo->superClass();
executed (the execution status of this line is deduced): mo = mo->superClass();
-
598 }
executed: }
Execution Count:59
59
599 -
600#ifndef QT_NO_ACCESSIBILITY -
601 if (object == qApp)
partially evaluated: object == (static_cast<QGuiApplication *>(QCoreApplication::instance()))
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
602 return new QAccessibleApplication;
executed: return new QAccessibleApplication;
Execution Count:2
2
603#endif -
604 -
605 return 0;
never executed: return 0;
0
606} -
607 -
608/*! -
609 Returns true if an accessibility implementation has been requested -
610 during the runtime of the application; otherwise returns false. -
611 -
612 Use this function to prevent potentially expensive notifications via -
613 updateAccessibility(). -
614*/ -
615bool QAccessible::isActive() -
616{ -
617 return accessibility_active;
executed: return accessibility_active;
Execution Count:360373
360373
618} -
619 -
620 -
621 -
622/*! -
623 Sets the root object of the accessible objects of this application -
624 to \a object. All other accessible objects are reachable using object -
625 navigation from the root object. -
626 -
627 Normally, it isn't necessary to call this function, because Qt sets -
628 the QApplication object as the root object immediately before the -
629 event loop is entered in QApplication::exec(). -
630 -
631 Use QAccessible::installRootObjectHandler() to redirect the function -
632 call to a customized handler function. -
633 -
634 \sa queryAccessibleInterface() -
635*/ -
636void QAccessible::setRootObject(QObject *object) -
637{ -
638 if (rootObjectHandler) {
partially evaluated: rootObjectHandler
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:43
0-43
639 rootObjectHandler(object);
never executed (the execution status of this line is deduced): rootObjectHandler(object);
-
640 return;
never executed: return;
0
641 } -
642 -
643#ifndef QT_NO_ACCESSIBILITY -
644 if (QPlatformAccessibility *pfAccessibility = platformAccessibility())
partially evaluated: QPlatformAccessibility *pfAccessibility = platformAccessibility()
TRUEFALSE
yes
Evaluation Count:43
no
Evaluation Count:0
0-43
645 pfAccessibility->setRootObject(object);
executed: pfAccessibility->setRootObject(object);
Execution Count:43
43
646#endif -
647}
executed: }
Execution Count:43
43
648 -
649/*! -
650 Notifies about a change that might be relevant for accessibility clients. -
651 -
652 \a event provides details about the change. These include the source -
653 of the change and the nature of the change. The \a event should -
654 contain enough information give meaningful notifications. -
655 -
656 For example, the type \c ValueChange indicates that the position of -
657 a slider has been changed. -
658 -
659 Call this function whenever the state of your accessible object or -
660 one of its sub-elements has been changed either programmatically -
661 (e.g. by calling QLabel::setText()) or by user interaction. -
662 -
663 If there are no accessibility tools listening to this event, the -
664 performance penalty for calling this function is small, but if -
665 determining the parameters of the call is expensive you can test -
666 QAccessible::isActive() to avoid unnecessary computation. -
667*/ -
668void QAccessible::updateAccessibility(QAccessibleEvent *event) -
669{ -
670 if (updateHandler) {
evaluated: updateHandler
TRUEFALSE
yes
Evaluation Count:857
yes
Evaluation Count:85163
857-85163
671 updateHandler(event);
executed (the execution status of this line is deduced): updateHandler(event);
-
672 return;
executed: return;
Execution Count:857
857
673 } -
674 -
675 if (!isActive())
partially evaluated: !isActive()
TRUEFALSE
yes
Evaluation Count:85163
no
Evaluation Count:0
0-85163
676 return;
executed: return;
Execution Count:85163
85163
677 -
678#ifndef QT_NO_ACCESSIBILITY -
679 if (QPlatformAccessibility *pfAccessibility = platformAccessibility())
never evaluated: QPlatformAccessibility *pfAccessibility = platformAccessibility()
0
680 pfAccessibility->notifyAccessibilityUpdate(event);
never executed: pfAccessibility->notifyAccessibilityUpdate(event);
0
681#endif -
682}
never executed: }
0
683 -
684#if QT_DEPRECATED_SINCE(5, 0) -
685/*! -
686 \obsolete -
687 \fn void QAccessible::updateAccessibility(QObject *object, int child, Event reason); -
688 -
689 \brief Use QAccessible::updateAccessibility(QAccessibleEvent*) instead. -
690*/ -
691#endif -
692 -
693/*! -
694 \class QAccessibleInterface -
695 \brief The QAccessibleInterface class defines an interface that exposes information -
696 about accessible objects. -
697 \internal -
698 -
699 \ingroup accessibility -
700 \inmodule QtGui -
701 -
702 This class is part of \l {Accessibility for QWidget Applications}. -
703 -
704 Accessibility tools (also called AT Clients), such as screen readers -
705 or braille displays, require high-level information about -
706 accessible objects in an application. Accessible objects provide -
707 specialized input and output methods, making it possible for users -
708 to use accessibility tools with enabled applications (AT Servers). -
709 -
710 Every element that the user needs to interact with or react to is -
711 an accessible object, and should provide this information. These -
712 are mainly visual objects, such as widgets and widget elements, but -
713 can also be content, such as sounds. -
714 -
715 The AT client uses three basic concepts to acquire information -
716 about any accessible object in an application: -
717 \list -
718 \li \e Properties The client can read information about -
719 accessible objects. In some cases the client can also modify these -
720 properties; such as text in a line edit. -
721 \li \e Actions The client can invoke actions like pressing a button -
722 or . -
723 \li \e{Relationships and Navigation} The client can traverse from one -
724 accessible object to another, using the relationships between objects. -
725 \endlist -
726 -
727 The QAccessibleInterface defines the API for these three concepts. -
728 -
729 \section1 Relationships and Navigation -
730 -
731 The functions childCount() and indexOfChild() return the number of -
732 children of an accessible object and the index a child object has -
733 in its parent. The childAt() function returns a child QAccessibleInterface -
734 that is found at a position. The child does not have to be a direct -
735 child. This allows bypassing intermediate layers when the parent already knows the -
736 top-most child. childAt() is used for hit testing (finding the object -
737 under the mouse). -
738 -
739 The relations() function provides information about the relations an -
740 object has to other objects, and parent() and child() allows -
741 traversing from one object to another object. -
742 -
743 \section1 Properties -
744 -
745 The central property of an accessible objects is what role() it -
746 has. Different objects can have the same role, e.g. both the "Add -
747 line" element in a scroll bar and the \c OK button in a dialog have -
748 the same role, "button". The role implies what kind of -
749 interaction the user can perform with the user interface element. -
750 -
751 An object's state() property is a combination of different state -
752 flags and can describe both how the object's state differs from a -
753 "normal" state, e.g. it might be unavailable, and also how it -
754 behaves, e.g. it might be selectable. -
755 -
756 The text() property provides textual information about the object. -
757 An object usually has a name, but can provide extended information -
758 such as a description, help text, or information about any -
759 keyboard accelerators it provides. Some objects allow changing the -
760 text() property through the setText() function, but this -
761 information is in most cases read-only. -
762 -
763 The rect() property provides information about the geometry of an -
764 accessible object. This information is usually only available for -
765 visual objects. -
766 -
767 \section1 Interfaces -
768 -
769 To enable the user to interact with an accessible object the -
770 object must implement QAccessibleActionInterface in addition to -
771 QAccessibleInterface. -
772 Objects that support selections can define actions to change the selection. -
773 -
774 There are several other interfaces that should be implemented as required. -
775 QAccessibleTextInterface should be used for bigger texts edits such as document views. -
776 This interface should not be implemented for labels/single line edits. -
777 The complementary QAccessibleEditableTextInterface should be added when the -
778 Text is editable. -
779 -
780 For sliders, scrollbars and other numerical value selectors QAccessibleValueInterface -
781 should be implemented. -
782 -
783 Lists, tables and trees should implement QAccessibleTableInterface. -
784 -
785 \sa QAccessible, QAccessibleActionInterface, QAccessibleTextInterface, QAccessibleEditableTextInterface, QAccessibleValueInterface, QAccessibleTableInterface -
786*/ -
787 -
788/*! -
789 \fn bool QAccessibleInterface::isValid() const -
790 -
791 Returns true if all the data necessary to use this interface -
792 implementation is valid (e.g. all pointers are non-null); -
793 otherwise returns false. -
794 -
795 \sa object() -
796*/ -
797 -
798/*! -
799 \fn QObject *QAccessibleInterface::object() const -
800 -
801 Returns a pointer to the QObject this interface implementation provides -
802 information for. -
803 -
804 \sa isValid() -
805*/ -
806 -
807/*! -
808 \fn int QAccessibleInterface::childCount() const -
809 -
810 Returns the number of children that belong to this object. A child -
811 can provide accessibility information on its own (e.g. a child -
812 widget), or be a sub-element of this accessible object. -
813 -
814 All objects provide this information. -
815 -
816 \sa indexOfChild() -
817*/ -
818 -
819/*! -
820 \fn int QAccessibleInterface::indexOfChild(const QAccessibleInterface *child) const -
821 -
822 Returns the 0-based index of the object \a child in this object's -
823 children list, or -1 if \a child is not a child of this object. -
824 -
825 All objects provide this information about their children. -
826 -
827 \sa childCount() -
828*/ -
829 -
830/*! -
831 Returns the meaningful relations to other widgets. Usually this will not return parent/child -
832 relations, unless they are handled in a specific way such as in tree views. -
833 It will typically return the labelled-by and label relations. -
834 -
835 It is possible to filter the relations by using \a match. -
836 It should never return itself. -
837 -
838 \sa parent(), child() -
839*/ -
840QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > -
841QAccessibleInterface::relations(QAccessible::Relation /*match = QAccessible::AllRelations*/) const -
842{ -
843 return QVector<QPair<QAccessibleInterface*, QAccessible::Relation> >();
never executed: return QVector<QPair<QAccessibleInterface*, QAccessible::Relation> >();
0
844} -
845 -
846/*! -
847 Returns the object that has the keyboard focus. -
848 -
849 The object returned can be any descendant, including itself. -
850*/ -
851QAccessibleInterface *QAccessibleInterface::focusChild() const -
852{ -
853 return 0;
never executed: return 0;
0
854} -
855 -
856/*! -
857 \fn QAccessibleInterface *QAccessibleInterface::childAt(int x, int y) const -
858 -
859 Returns the QAccessibleInterface of a child that contains the screen coordinates (\a x, \a y). -
860 If there are no children at this position this function returns 0. -
861 The returned accessible must be a child, but not necessarily a direct child. -
862 -
863 This function is only relyable for visible objects (invisible -
864 object might not be laid out correctly). -
865 -
866 All visual objects provide this information. -
867 -
868 A default implementation is provided for objects inheriting QAccessibleObject. This will iterate -
869 over all children. If the widget manages its children (e.g. a table) it will be more efficient -
870 to write a specialized implementation. -
871 -
872 \sa rect() -
873*/ -
874 -
875/*! -
876 \fn QAccessibleInterface* QAccessibleInterface::parent() const -
877 -
878 Returns the QAccessibleInterface of the parent in the accessible object hierarchy. -
879 -
880 Returns 0 if no parent exists (e.g. for the top level application object). -
881 -
882 \sa child() -
883*/ -
884 -
885/*! -
886 \fn QAccessibleInterface* QAccessibleInterface::child(int index) const -
887 -
888 Returns the accessible child with index \a index. -
889 0-based index. The number of children of an object can be checked with childCount. -
890 -
891 Returns 0 when asking for an invalid child (e.g. when the child became invalid in the meantime). -
892 -
893 \sa childCount(), parent() -
894*/ -
895 -
896/*! -
897 \fn QString QAccessibleInterface::text(QAccessible::Text t) const -
898 -
899 Returns the value of the text property \a t of the object. -
900 -
901 The \l QAccessible::Name is a string used by clients to identify, find, or -
902 announce an accessible object for the user. All objects must have -
903 a name that is unique within their container. The name can be -
904 used differently by clients, so the name should both give a -
905 short description of the object and be unique. -
906 -
907 An accessible object's \l QAccessible::Description provides textual information -
908 about an object's visual appearance. The description is primarily -
909 used to provide greater context for vision-impaired users, but is -
910 also used for context searching or other applications. Not all -
911 objects have a description. An "OK" button would not need a -
912 description, but a tool button that shows a picture of a smiley -
913 would. -
914 -
915 The \l QAccessible::Value of an accessible object represents visual information -
916 contained by the object, e.g. the text in a line edit. Usually, -
917 the value can be modified by the user. Not all objects have a -
918 value, e.g. static text labels don't, and some objects have a -
919 state that already is the value, e.g. toggle buttons. -
920 -
921 The \l QAccessible::Help text provides information about the function and -
922 usage of an accessible object. Not all objects provide this -
923 information. -
924 -
925 The \l QAccessible::Accelerator is a keyboard shortcut that activates the -
926 object's default action. A keyboard shortcut is the underlined -
927 character in the text of a menu, menu item or widget, and is -
928 either the character itself, or a combination of this character -
929 and a modifier key like Alt, Ctrl or Shift. Command controls like -
930 tool buttons also have shortcut keys and usually display them in -
931 their tooltip. -
932 -
933 All objects provide a string for \l QAccessible::Name. -
934 -
935 \sa role(), state() -
936*/ -
937 -
938/*! -
939 \fn void QAccessibleInterface::setText(QAccessible::Text t, const QString &text) -
940 -
941 Sets the text property \a t of the object to \a text. -
942 -
943 Note that the text properties of most objects are read-only -
944 so calling this function might have no effect. -
945 -
946 \sa text() -
947*/ -
948 -
949/*! -
950 \fn QRect QAccessibleInterface::rect() const -
951 -
952 Returns the geometry of the object. The geometry is in screen coordinates. -
953 -
954 This function is only reliable for visible objects (invisible -
955 objects might not be laid out correctly). -
956 -
957 All visual objects provide this information. -
958 -
959 \sa childAt() -
960*/ -
961 -
962/*! -
963 \fn QAccessible::Role QAccessibleInterface::role() const -
964 -
965 Returns the role of the object. -
966 The role of an object is usually static. -
967 -
968 All accessible objects have a role. -
969 -
970 \sa text(), state() -
971*/ -
972 -
973/*! -
974 \fn QAccessible::State QAccessibleInterface::state() const -
975 -
976 Returns the current state of the object. -
977 The returned value is a combination of the flags in -
978 the QAccessible::StateFlag enumeration. -
979 -
980 All accessible objects have a state. -
981 -
982 \sa text(), role() -
983*/ -
984 -
985 -
986/*! -
987 \fn QAccessibleEditableTextInterface *QAccessibleInterface::editableTextInterface() -
988 \internal -
989*/ -
990 -
991/*! -
992 Returns the accessible's foreground color if applicable or an invalid QColor. -
993 -
994 \sa backgroundColor() -
995*/ -
996QColor QAccessibleInterface::foregroundColor() const -
997{ -
998 return QColor();
never executed: return QColor();
0
999} -
1000 -
1001/*! -
1002 Returns the accessible's background color if applicable or an invalid QColor. -
1003 -
1004 \sa foregroundColor() -
1005*/ -
1006QColor QAccessibleInterface::backgroundColor() const -
1007{ -
1008 return QColor();
never executed: return QColor();
0
1009} -
1010 -
1011/*! -
1012 \fn QAccessibleTextInterface *QAccessibleInterface::textInterface() -
1013 \internal -
1014*/ -
1015 -
1016/*! -
1017 \fn QAccessibleValueInterface *QAccessibleInterface::valueInterface() -
1018 \internal -
1019*/ -
1020 -
1021/*! -
1022 \fn QAccessibleTableInterface *QAccessibleInterface::tableInterface() -
1023 \internal -
1024*/ -
1025 -
1026/*! -
1027 \fn QAccessibleTableCellInterface *QAccessibleInterface::tableCellInterface() -
1028 \internal -
1029*/ -
1030 -
1031/*! -
1032 \fn QAccessibleActionInterface *QAccessibleInterface::actionInterface() -
1033 \internal -
1034*/ -
1035 -
1036/*! -
1037 \fn QAccessibleImageInterface *QAccessibleInterface::imageInterface() -
1038 \internal -
1039*/ -
1040 -
1041/*! -
1042 \class QAccessibleEvent -
1043 \internal -
1044 \ingroup accessibility -
1045 \inmodule QtGui -
1046 -
1047 \brief The QAccessibleEvent class contains parameters that describe updates in the -
1048 accessibility framework. -
1049 -
1050 This class is used with \l QAccessible::updateAccessibility(). -
1051 -
1052 The event type is one of the values of \l QAccessible::Event, which -
1053 determines the subclass of QAccessibleEvent that applies. -
1054 -
1055 To enable in process screen readers, all events must be sent after the change has happened. -
1056*/ -
1057 -
1058/*! \fn QAccessibleEvent::QAccessibleEvent(QObject *object, QAccessible::Event type) -
1059 -
1060 Constructs a QAccessibleEvent to notify that \a object has changed. -
1061 The event \a type explains what changed. -
1062 */ -
1063 -
1064/*! \fn QAccessibleEvent::~QAccessibleEvent() -
1065 Destroys the event. -
1066*/ -
1067 -
1068/*! \fn QAccessible::Event QAccessibleEvent::type() const -
1069 Returns the event type. -
1070*/ -
1071 -
1072/*! \fn QObject* QAccessibleEvent::object() const -
1073 Returns the event object. -
1074*/ -
1075 -
1076/*! \fn void QAccessibleEvent::setChild(int child) -
1077 Sets the child index to \a child. -
1078*/ -
1079 -
1080/*! \fn int QAccessibleEvent::child() const -
1081 Returns the child index. -
1082*/ -
1083 -
1084 -
1085/*! -
1086 \class QAccessibleValueChangeEvent -
1087 \internal -
1088 \ingroup accessibility -
1089 \inmodule QtGui -
1090 -
1091 \brief The QAccessibleValueChangeEvent describes a change in value for an accessible object. -
1092 -
1093 It contains the new value. -
1094 -
1095 This class is used with \l QAccessible::updateAccessibility(). -
1096*/ -
1097 -
1098/*! \fn QAccessibleValueChangeEvent::QAccessibleValueChangeEvent(QObject *object, const QVariant &value) -
1099 Constructs a new QAccessibleValueChangeEvent for \a object. -
1100 The event contains the new \a value. -
1101*/ -
1102/*! \fn void QAccessibleValueChangeEvent::setValue(const QVariant & value) -
1103 Sets the new \a value for this event. -
1104*/ -
1105/*! -
1106 \fn QVariant QAccessibleValueChangeEvent::value() const -
1107 -
1108 Returns the new value of the accessible object of this event. -
1109*/ -
1110 -
1111/*! -
1112 \class QAccessibleStateChangeEvent -
1113 \internal -
1114 \ingroup accessibility -
1115 \inmodule QtGui -
1116 -
1117 \brief The QAccessibleStateChangeEvent notfies the accessibility framework -
1118 that the state of an object has changed. -
1119 -
1120 This class is used with \l QAccessible::updateAccessibility(). -
1121 -
1122 \sa QAccessibleInterface::state() -
1123*/ -
1124/*! \fn QAccessibleStateChangeEvent::QAccessibleStateChangeEvent(QObject *object, QAccessible::State state) -
1125 Constructs a new QAccessibleStateChangeEvent for \a object. -
1126 The difference to the object's previous state is in \a state. -
1127*/ -
1128/*! -
1129 \fn QAccessible::State QAccessibleStateChangeEvent::changedStates() const -
1130 \internal -
1131 -
1132 \brief Returns the states that have been changed. -
1133 -
1134 Be aware that the returned states are the ones that have changed, -
1135 to find out about the state of an object, use QAccessibleInterface::state(). -
1136 -
1137 For example, if an object used to have the focus but loses it, -
1138 the object's state will have focused set to \c false. This event on the -
1139 other hand tells about the change and has focused set to \c true since -
1140 the focus state is changed from \c true to \c false. -
1141*/ -
1142 -
1143 -
1144/*! -
1145 \class QAccessibleTableModelChangeEvent -
1146 \internal -
1147 \ingroup accessibility -
1148 \inmodule QtGui -
1149 -
1150 \brief The QAccessibleTableModelChangeEvent signifies a change in a table, list, or tree where cells -
1151 are added or removed. -
1152 If the change affected a number of rows, firstColumn and lastColumn will return \c -1. -
1153 Likewise for columns, the row functions may return \c -1. -
1154 -
1155 This class is used with \l QAccessible::updateAccessibility(). -
1156*/ -
1157 -
1158/*! \enum QAccessibleTableModelChangeEvent::ModelChangeType -
1159 This enum describes different types of changes in the table model. -
1160 \value ModelReset The model has been reset, all previous knowledge about the model is now invalid. -
1161 \value DataChanged No cells have been added or removed, but the data of the specified cell range is invalid. -
1162 \value RowsInserted New rows have been inserted. -
1163 \value ColumnsInserted New columns have been inserted. -
1164 \value RowsRemoved Rows have been removed. -
1165 \value ColumnsRemoved Columns have been removed. -
1166*/ -
1167/*! \fn QAccessibleTableModelChangeEvent::QAccessibleTableModelChangeEvent(QObject *object, ModelChangeType changeType) -
1168 Constructs a new QAccessibleTableModelChangeEvent for \a object of with \a changeType. -
1169*/ -
1170/*! \fn int QAccessibleTableModelChangeEvent::firstColumn() const -
1171 Returns the first changed column. -
1172*/ -
1173/*! \fn int QAccessibleTableModelChangeEvent::firstRow() const -
1174 Returns the first changed row. -
1175*/ -
1176/*! \fn int QAccessibleTableModelChangeEvent::lastColumn() const -
1177 Returns the last changed column. -
1178*/ -
1179/*! \fn int QAccessibleTableModelChangeEvent::lastRow() const -
1180 Returns the last changed row. -
1181*/ -
1182/*! \fn QAccessibleTableModelChangeEvent::ModelChangeType QAccessibleTableModelChangeEvent::modelChangeType() const -
1183 Returns the type of change. -
1184*/ -
1185/*! \fn void QAccessibleTableModelChangeEvent::setFirstColumn(int column) -
1186 Sets the first changed \a column. -
1187*/ -
1188/*! \fn void QAccessibleTableModelChangeEvent::setFirstRow(int row) -
1189 Sets the first changed \a row. -
1190*/ -
1191/*! \fn void QAccessibleTableModelChangeEvent::setLastColumn(int column) -
1192 Sets the last changed \a column. -
1193*/ -
1194/*! \fn void QAccessibleTableModelChangeEvent::setLastRow(int row) -
1195 Sets the last changed \a row. -
1196*/ -
1197/*! \fn void QAccessibleTableModelChangeEvent::setModelChangeType(ModelChangeType changeType) -
1198 Sets the type of change to \a changeType. -
1199*/ -
1200 -
1201 -
1202/*! -
1203 \class QAccessibleTextCursorEvent -
1204 \internal -
1205 \ingroup accessibility -
1206 \inmodule QtGui -
1207 -
1208 \brief The QAccessibleEvent class -
1209 -
1210 This class is used with \l QAccessible::updateAccessibility(). -
1211*/ -
1212/*! \fn QAccessibleTextCursorEvent::QAccessibleTextCursorEvent(QObject *object, int cursorPosition) -
1213 Create a new QAccessibleTextCursorEvent for \a object. -
1214 The \a cursorPosition is the new cursor position. -
1215*/ -
1216/*! \fn int QAccessibleTextCursorEvent::cursorPosition() const -
1217 Returns the cursor position. -
1218*/ -
1219/*! \fn void QAccessibleTextCursorEvent::setCursorPosition(int position) -
1220 Sets the cursor \a position for this event. -
1221*/ -
1222 -
1223/*! -
1224 \class QAccessibleTextInsertEvent -
1225 \internal -
1226 \ingroup accessibility -
1227 \inmodule QtGui -
1228 -
1229 \brief The QAccessibleEvent class -
1230 -
1231 This class is used with \l QAccessible::updateAccessibility(). -
1232*/ -
1233/*! \fn QAccessibleTextInsertEvent::QAccessibleTextInsertEvent(QObject *object, int position, const QString &text) -
1234 Constructs a new QAccessibleTextInsertEvent event for \a object. -
1235 The \a text has been inserted at \a position. -
1236 By default, it is assumed that the cursor has moved to the end -
1237 of the selection. If that is not the case, one needs to manually -
1238 set it with \l QAccessibleTextCursorEvent::setCursorPosition for this event. -
1239*/ -
1240/*! \fn int QAccessibleTextInsertEvent::changePosition() const -
1241 Returns the position where the text was inserted. -
1242*/ -
1243/*! \fn QString QAccessibleTextInsertEvent::textInserted() const -
1244 Returns the text that has been inserted. -
1245*/ -
1246 -
1247/*! -
1248 \class QAccessibleTextRemoveEvent -
1249 \internal -
1250 \ingroup accessibility -
1251 \inmodule QtGui -
1252 -
1253 \brief The QAccessibleEvent class -
1254 -
1255 This class is used with \l QAccessible::updateAccessibility(). -
1256*/ -
1257/*! \fn QAccessibleTextRemoveEvent::QAccessibleTextRemoveEvent(QObject *object, int position, const QString &text) -
1258 Constructs a new QAccessibleTextRemoveEvent event for \a object. -
1259 The \a text has been removed at \a position. -
1260 By default it is assumed that the cursor has moved to \a position. -
1261 If that is not the case, one needs to manually -
1262 set it with \l QAccessibleTextCursorEvent::setCursorPosition for this event. -
1263*/ -
1264 -
1265/*! \fn int QAccessibleTextRemoveEvent::changePosition() const -
1266 Returns the position where the text was removed. -
1267*/ -
1268/*! \fn QString QAccessibleTextRemoveEvent::textRemoved() const -
1269 Returns the text that has been removed. -
1270*/ -
1271 -
1272/*! -
1273 \class QAccessibleTextUpdateEvent -
1274 \internal -
1275 \ingroup accessibility -
1276 \inmodule QtGui -
1277 -
1278 \brief The QAccessibleEvent class notifies about text changes. -
1279 This is for accessibles that support editable text such as line edits. -
1280 This event occurs for example when a portion of selected text -
1281 gets replaced by pasting a new text or in override mode of editors. -
1282 -
1283 This class is used with \l QAccessible::updateAccessibility(). -
1284*/ -
1285/*! \fn QAccessibleTextUpdateEvent::QAccessibleTextUpdateEvent(QObject *object, int position, const QString &oldText, const QString &text) -
1286 Constructs a new QAccessibleTextUpdateEvent for \a object. -
1287 The text change takes place at \a position where the \a oldText was removed and \a text inserted instead. -
1288*/ -
1289/*! \fn int QAccessibleTextUpdateEvent::changePosition() const -
1290 Returns where the change took place. -
1291*/ -
1292/*! \fn QString QAccessibleTextUpdateEvent::textInserted() const -
1293 Returns the inserted text. -
1294*/ -
1295/*! \fn QString QAccessibleTextUpdateEvent::textRemoved() const -
1296 Returns the removed text. -
1297*/ -
1298 -
1299/*! -
1300 \class QAccessibleTextSelectionEvent -
1301 \internal -
1302 \ingroup accessibility -
1303 \inmodule QtGui -
1304 -
1305 \brief The QAccessibleEvent class -
1306 -
1307 This class is used with \l QAccessible::updateAccessibility(). -
1308*/ -
1309/*! \fn QAccessibleTextSelectionEvent::QAccessibleTextSelectionEvent(QObject *object, int start, int end) -
1310 Constructs a new QAccessibleTextSelectionEvent for \a object. -
1311 The new selection this event notifies about is from position \a start to \a end. -
1312*/ -
1313/*! \fn int QAccessibleTextSelectionEvent::selectionEnd() const -
1314 Returns the position of the last selected character. -
1315*/ -
1316/*! \fn int QAccessibleTextSelectionEvent::selectionStart() const -
1317 Returns the position of the first selected character. -
1318*/ -
1319/*! \fn void QAccessibleTextSelectionEvent::setSelection(int start, int end) -
1320 Sets the selection for this event from position \a start to \a end. -
1321*/ -
1322 -
1323 -
1324 -
1325/*! -
1326 Returns the QAccessibleInterface associated with the event. -
1327 The caller of this function takes ownership of the returned interface. -
1328*/ -
1329QAccessibleInterface *QAccessibleEvent::accessibleInterface() const -
1330{ -
1331 QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(m_object);
never executed (the execution status of this line is deduced): QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(m_object);
-
1332 if (!iface) {
never evaluated: !iface
0
1333 qWarning() << "Cannot create accessible interface for object: " << m_object;
never executed (the execution status of this line is deduced): QMessageLogger("accessible/qaccessible.cpp", 1333, __PRETTY_FUNCTION__).warning() << "Cannot create accessible interface for object: " << m_object;
-
1334 return 0;
never executed: return 0;
0
1335 } -
1336 -
1337 if (m_child >= 0) {
never evaluated: m_child >= 0
0
1338 QAccessibleInterface *child = iface->child(m_child);
never executed (the execution status of this line is deduced): QAccessibleInterface *child = iface->child(m_child);
-
1339 if (child) {
never evaluated: child
0
1340 delete iface;
never executed (the execution status of this line is deduced): delete iface;
-
1341 iface = child;
never executed (the execution status of this line is deduced): iface = child;
-
1342 } else {
never executed: }
0
1343 qWarning() << "Cannot creat accessible child interface for object: " << m_object << " index: " << m_child;
never executed (the execution status of this line is deduced): QMessageLogger("accessible/qaccessible.cpp", 1343, __PRETTY_FUNCTION__).warning() << "Cannot creat accessible child interface for object: " << m_object << " index: " << m_child;
-
1344 }
never executed: }
0
1345 } -
1346 return iface;
never executed: return iface;
0
1347} -
1348 -
1349/*! -
1350 Returns the window associated with the underlying object. -
1351 For instance, QAccessibleWidget reimplements this and returns -
1352 the windowHandle() of the QWidget. -
1353 -
1354 It is used on some platforms to be able to notify the AT client about -
1355 state changes. -
1356 The backend will traverse up all ancestors until it finds a window. -
1357 (This means that at least one interface among the ancestors should -
1358 return a valid QWindow pointer). -
1359 -
1360 The default implementation of this returns 0. -
1361 \internal -
1362 */ -
1363QWindow *QAccessibleInterface::window() const -
1364{ -
1365 return 0;
never executed: return 0;
0
1366} -
1367 -
1368/*! -
1369 \internal -
1370 Method to allow extending this class without breaking binary compatibility. -
1371 The actual behavior and format of \a data depends on \a id argument -
1372 which must be defined if the class is to be extended with another virtual -
1373 function. -
1374 Currently, this is unused. -
1375*/ -
1376void QAccessibleInterface::virtual_hook(int /*id*/, void * /*data*/) -
1377{ -
1378} -
1379 -
1380/*! -
1381 \fn void *QAccessibleInterface::interface_cast(QAccessible::InterfaceType type) -
1382 -
1383 Returns a specialized accessibility interface \a type from the -
1384 generic QAccessibleInterface. -
1385 -
1386 This function must be reimplemented when providing more -
1387 information about a widget or object through the specialized -
1388 interfaces. For example a line edit should implement the -
1389 QAccessibleTextInterface and QAccessibleEditableTextInterface. -
1390 -
1391 Qt's QLineEdit for example has its accessibility support -
1392 implemented in QAccessibleLineEdit. -
1393 -
1394 \code -
1395void *QAccessibleLineEdit::interface_cast(QAccessible::InterfaceType t) -
1396{ -
1397 if (t == QAccessible::TextInterface) -
1398 return static_cast<QAccessibleTextInterface*>(this); -
1399 else if (t == QAccessible::EditableTextInterface) -
1400 return static_cast<QAccessibleEditableTextInterface*>(this); -
1401 return QAccessibleWidget::interface_cast(t); -
1402} -
1403 \endcode -
1404 -
1405 \sa QAccessible::InterfaceType, QAccessibleTextInterface, -
1406 QAccessibleEditableTextInterface, QAccessibleValueInterface, -
1407 QAccessibleActionInterface, QAccessibleTableInterface, -
1408 QAccessibleTableCellInterface -
1409*/ -
1410 -
1411/*! \internal */ -
1412const char *qAccessibleRoleString(QAccessible::Role role) -
1413{ -
1414 if (role >=0x40)
never evaluated: role >=0x40
0
1415 role = QAccessible::UserRole;
never executed: role = QAccessible::UserRole;
0
1416 static int roleEnum = QAccessible::staticMetaObject.indexOfEnumerator("Role"); -
1417 return QAccessible::staticMetaObject.enumerator(roleEnum).valueToKey(role);
never executed: return QAccessible::staticMetaObject.enumerator(roleEnum).valueToKey(role);
0
1418} -
1419 -
1420/*! \internal */ -
1421const char *qAccessibleEventString(QAccessible::Event event) -
1422{ -
1423 static int eventEnum = QAccessible::staticMetaObject.indexOfEnumerator("Event"); -
1424 return QAccessible::staticMetaObject.enumerator(eventEnum).valueToKey(event);
executed: return QAccessible::staticMetaObject.enumerator(eventEnum).valueToKey(event);
Execution Count:2
2
1425} -
1426 -
1427/*! \internal */ -
1428bool operator==(const QAccessible::State &first, const QAccessible::State &second) -
1429{ -
1430 return memcmp(&first, &second, sizeof(QAccessible::State)) == 0;
executed: return memcmp(&first, &second, sizeof(QAccessible::State)) == 0;
Execution Count:16
16
1431} -
1432 -
1433#ifndef QT_NO_DEBUG_STREAM -
1434Q_GUI_EXPORT QDebug operator<<(QDebug d, const QAccessibleInterface *iface) -
1435{ -
1436 if (!iface) {
never evaluated: !iface
0
1437 d << "QAccessibleInterface(null)";
never executed (the execution status of this line is deduced): d << "QAccessibleInterface(null)";
-
1438 return d;
never executed: return d;
0
1439 } -
1440 d.nospace();
never executed (the execution status of this line is deduced): d.nospace();
-
1441 d << "QAccessibleInterface(" << hex << (void *) iface << dec;
never executed (the execution status of this line is deduced): d << "QAccessibleInterface(" << hex << (void *) iface << dec;
-
1442 if (iface->isValid()) {
never evaluated: iface->isValid()
0
1443 d << " name=" << iface->text(QAccessible::Name) << " ";
never executed (the execution status of this line is deduced): d << " name=" << iface->text(QAccessible::Name) << " ";
-
1444 d << "role=" << qAccessibleRoleString(iface->role()) << " ";
never executed (the execution status of this line is deduced): d << "role=" << qAccessibleRoleString(iface->role()) << " ";
-
1445 if (iface->childCount())
never evaluated: iface->childCount()
0
1446 d << "childc=" << iface->childCount() << " ";
never executed: d << "childc=" << iface->childCount() << " ";
0
1447 if (iface->object()) {
never evaluated: iface->object()
0
1448 d << "obj=" << iface->object();
never executed (the execution status of this line is deduced): d << "obj=" << iface->object();
-
1449 }
never executed: }
0
1450 QStringList stateStrings;
never executed (the execution status of this line is deduced): QStringList stateStrings;
-
1451 QAccessible::State st = iface->state();
never executed (the execution status of this line is deduced): QAccessible::State st = iface->state();
-
1452 if (st.focusable)
never evaluated: st.focusable
0
1453 stateStrings << QLatin1String("focusable");
never executed: stateStrings << QLatin1String("focusable");
0
1454 if (st.focused)
never evaluated: st.focused
0
1455 stateStrings << QLatin1String("focused");
never executed: stateStrings << QLatin1String("focused");
0
1456 if (st.selected)
never evaluated: st.selected
0
1457 stateStrings << QLatin1String("selected");
never executed: stateStrings << QLatin1String("selected");
0
1458 if (st.invisible)
never evaluated: st.invisible
0
1459 stateStrings << QLatin1String("invisible");
never executed: stateStrings << QLatin1String("invisible");
0
1460 -
1461 if (!stateStrings.isEmpty())
never evaluated: !stateStrings.isEmpty()
0
1462 d << stateStrings.join(QLatin1Char('|'));
never executed: d << stateStrings.join(QLatin1Char('|'));
0
1463 -
1464 if (!st.invisible)
never evaluated: !st.invisible
0
1465 d << "rect=" << iface->rect();
never executed: d << "rect=" << iface->rect();
0
1466 -
1467 } else {
never executed: }
0
1468 d << " invalid";
never executed (the execution status of this line is deduced): d << " invalid";
-
1469 }
never executed: }
0
1470 d << ")";
never executed (the execution status of this line is deduced): d << ")";
-
1471 return d.space();
never executed: return d.space();
0
1472} -
1473 -
1474/*! \internal */ -
1475QDebug operator<<(QDebug d, const QAccessibleEvent &ev) -
1476{ -
1477 if (!&ev) {
never evaluated: !&ev
0
1478 d << "QAccessibleEvent(null)";
never executed (the execution status of this line is deduced): d << "QAccessibleEvent(null)";
-
1479 return d;
never executed: return d;
0
1480 } -
1481 d.nospace() << "QAccessibleEvent(object=" << hex << ev.object();
never executed (the execution status of this line is deduced): d.nospace() << "QAccessibleEvent(object=" << hex << ev.object();
-
1482 d.nospace() << dec;
never executed (the execution status of this line is deduced): d.nospace() << dec;
-
1483 d.nospace() << "child=" << ev.child();
never executed (the execution status of this line is deduced): d.nospace() << "child=" << ev.child();
-
1484 d << " event=" << qAccessibleEventString(ev.type());
never executed (the execution status of this line is deduced): d << " event=" << qAccessibleEventString(ev.type());
-
1485 if (ev.type() == QAccessible::StateChanged) {
never evaluated: ev.type() == QAccessible::StateChanged
0
1486 QAccessible::State changed = static_cast<const QAccessibleStateChangeEvent*>(&ev)->changedStates();
never executed (the execution status of this line is deduced): QAccessible::State changed = static_cast<const QAccessibleStateChangeEvent*>(&ev)->changedStates();
-
1487 d << "State changed:";
never executed (the execution status of this line is deduced): d << "State changed:";
-
1488 if (changed.disabled) d << "disabled";
never executed: d << "disabled";
never evaluated: changed.disabled
0
1489 if (changed.selected) d << "selected";
never executed: d << "selected";
never evaluated: changed.selected
0
1490 if (changed.focusable) d << "focusable";
never executed: d << "focusable";
never evaluated: changed.focusable
0
1491 if (changed.focused) d << "focused";
never executed: d << "focused";
never evaluated: changed.focused
0
1492 if (changed.pressed) d << "pressed";
never executed: d << "pressed";
never evaluated: changed.pressed
0
1493 if (changed.checkable) d << "checkable";
never executed: d << "checkable";
never evaluated: changed.checkable
0
1494 if (changed.checked) d << "checked";
never executed: d << "checked";
never evaluated: changed.checked
0
1495 if (changed.checkStateMixed) d << "checkStateMixed";
never executed: d << "checkStateMixed";
never evaluated: changed.checkStateMixed
0
1496 if (changed.readOnly) d << "readOnly";
never executed: d << "readOnly";
never evaluated: changed.readOnly
0
1497 if (changed.hotTracked) d << "hotTracked";
never executed: d << "hotTracked";
never evaluated: changed.hotTracked
0
1498 if (changed.defaultButton) d << "defaultButton";
never executed: d << "defaultButton";
never evaluated: changed.defaultButton
0
1499 if (changed.expanded) d << "expanded";
never executed: d << "expanded";
never evaluated: changed.expanded
0
1500 if (changed.collapsed) d << "collapsed";
never executed: d << "collapsed";
never evaluated: changed.collapsed
0
1501 if (changed.busy) d << "busy";
never executed: d << "busy";
never evaluated: changed.busy
0
1502 if (changed.expandable) d << "expandable";
never executed: d << "expandable";
never evaluated: changed.expandable
0
1503 if (changed.marqueed) d << "marqueed";
never executed: d << "marqueed";
never evaluated: changed.marqueed
0
1504 if (changed.animated) d << "animated";
never executed: d << "animated";
never evaluated: changed.animated
0
1505 if (changed.invisible) d << "invisible";
never executed: d << "invisible";
never evaluated: changed.invisible
0
1506 if (changed.offscreen) d << "offscreen";
never executed: d << "offscreen";
never evaluated: changed.offscreen
0
1507 if (changed.sizeable) d << "sizeable";
never executed: d << "sizeable";
never evaluated: changed.sizeable
0
1508 if (changed.movable) d << "movable";
never executed: d << "movable";
never evaluated: changed.movable
0
1509 if (changed.selfVoicing) d << "selfVoicing";
never executed: d << "selfVoicing";
never evaluated: changed.selfVoicing
0
1510 if (changed.selectable) d << "selectable";
never executed: d << "selectable";
never evaluated: changed.selectable
0
1511 if (changed.linked) d << "linked";
never executed: d << "linked";
never evaluated: changed.linked
0
1512 if (changed.traversed) d << "traversed";
never executed: d << "traversed";
never evaluated: changed.traversed
0
1513 if (changed.multiSelectable) d << "multiSelectable";
never executed: d << "multiSelectable";
never evaluated: changed.multiSelectable
0
1514 if (changed.extSelectable) d << "extSelectable";
never executed: d << "extSelectable";
never evaluated: changed.extSelectable
0
1515 if (changed.passwordEdit) d << "passwordEdit"; // used to be Protected
never executed: d << "passwordEdit";
never evaluated: changed.passwordEdit
0
1516 if (changed.hasPopup) d << "hasPopup";
never executed: d << "hasPopup";
never evaluated: changed.hasPopup
0
1517 if (changed.modal) d << "modal";
never executed: d << "modal";
never evaluated: changed.modal
0
1518 -
1519 // IA2 - we chose to not add some IA2 states for now -
1520 // Below the ones that seem helpful -
1521 if (changed.active) d << "active";
never executed: d << "active";
never evaluated: changed.active
0
1522 if (changed.invalid) d << "invalid"; // = defunct
never executed: d << "invalid";
never evaluated: changed.invalid
0
1523 if (changed.editable) d << "editable";
never executed: d << "editable";
never evaluated: changed.editable
0
1524 if (changed.multiLine) d << "multiLine";
never executed: d << "multiLine";
never evaluated: changed.multiLine
0
1525 if (changed.selectableText) d << "selectableText";
never executed: d << "selectableText";
never evaluated: changed.selectableText
0
1526 if (changed.supportsAutoCompletion) d << "supportsAutoCompletion";
never executed: d << "supportsAutoCompletion";
never evaluated: changed.supportsAutoCompletion
0
1527 -
1528 }
never executed: }
0
1529 d.nospace() << ")";
never executed (the execution status of this line is deduced): d.nospace() << ")";
-
1530 return d.space();
never executed: return d.space();
0
1531} -
1532 -
1533#endif -
1534 -
1535QT_END_NAMESPACE -
1536 -
1537 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial