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