| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickaccessibleattached.cpp |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||||||||
| 2 | ** | - | ||||||||||||
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. | - | ||||||||||||
| 4 | ** Contact: https://www.qt.io/licensing/ | - | ||||||||||||
| 5 | ** | - | ||||||||||||
| 6 | ** This file is part of the QtQuick module of the Qt Toolkit. | - | ||||||||||||
| 7 | ** | - | ||||||||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - | ||||||||||||
| 9 | ** Commercial License Usage | - | ||||||||||||
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||||||||
| 11 | ** accordance with the commercial license agreement provided with the | - | ||||||||||||
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||||||||
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||||||||
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - | ||||||||||||
| 15 | ** information use the contact form at https://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 3 as published by the Free Software | - | ||||||||||||
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - | ||||||||||||
| 21 | ** packaging of this file. Please review the following information to | - | ||||||||||||
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements | - | ||||||||||||
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - | ||||||||||||
| 24 | ** | - | ||||||||||||
| 25 | ** GNU General Public License Usage | - | ||||||||||||
| 26 | ** Alternatively, this file may be used under the terms of the GNU | - | ||||||||||||
| 27 | ** General Public License version 2.0 or (at your option) the GNU General | - | ||||||||||||
| 28 | ** Public license version 3 or any later version approved by the KDE Free | - | ||||||||||||
| 29 | ** Qt Foundation. The licenses are as published by the Free Software | - | ||||||||||||
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - | ||||||||||||
| 31 | ** included in the packaging of this file. Please review the following | - | ||||||||||||
| 32 | ** information to ensure the GNU General Public License requirements will | - | ||||||||||||
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - | ||||||||||||
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - | ||||||||||||
| 35 | ** | - | ||||||||||||
| 36 | ** $QT_END_LICENSE$ | - | ||||||||||||
| 37 | ** | - | ||||||||||||
| 38 | ****************************************************************************/ | - | ||||||||||||
| 39 | - | |||||||||||||
| 40 | #include "qquickaccessibleattached_p.h" | - | ||||||||||||
| 41 | - | |||||||||||||
| 42 | #if QT_CONFIG(accessibility) | - | ||||||||||||
| 43 | - | |||||||||||||
| 44 | #include "private/qquickitem_p.h" | - | ||||||||||||
| 45 | - | |||||||||||||
| 46 | QT_BEGIN_NAMESPACE | - | ||||||||||||
| 47 | - | |||||||||||||
| 48 | /*! | - | ||||||||||||
| 49 | \qmltype Accessible | - | ||||||||||||
| 50 | \instantiates QQuickAccessibleAttached | - | ||||||||||||
| 51 | \brief Enables accessibility of QML items. | - | ||||||||||||
| 52 | - | |||||||||||||
| 53 | \inqmlmodule QtQuick | - | ||||||||||||
| 54 | \ingroup qtquick-visual-utility | - | ||||||||||||
| 55 | \ingroup accessibility | - | ||||||||||||
| 56 | - | |||||||||||||
| 57 | This class is part of the \l {Accessibility for Qt Quick Applications}. | - | ||||||||||||
| 58 | - | |||||||||||||
| 59 | Items the user interacts with or that give information to the user | - | ||||||||||||
| 60 | need to expose their information to the accessibility framework. | - | ||||||||||||
| 61 | Then assistive tools can make use of that information to enable | - | ||||||||||||
| 62 | users to interact with the application in various ways. | - | ||||||||||||
| 63 | This enables Qt Quick applications to be used with screen-readers for example. | - | ||||||||||||
| 64 | - | |||||||||||||
| 65 | The most important properties are \l name, \l description and \l role. | - | ||||||||||||
| 66 | - | |||||||||||||
| 67 | Example implementation of a simple button: | - | ||||||||||||
| 68 | \qml | - | ||||||||||||
| 69 | Rectangle { | - | ||||||||||||
| 70 | id: myButton | - | ||||||||||||
| 71 | Text { | - | ||||||||||||
| 72 | id: label | - | ||||||||||||
| 73 | text: "next" | - | ||||||||||||
| 74 | } | - | ||||||||||||
| 75 | Accessible.role: Accessible.Button | - | ||||||||||||
| 76 | Accessible.name: label.text | - | ||||||||||||
| 77 | Accessible.description: "shows the next page" | - | ||||||||||||
| 78 | Accessible.onPressAction: { | - | ||||||||||||
| 79 | // do a button click | - | ||||||||||||
| 80 | } | - | ||||||||||||
| 81 | } | - | ||||||||||||
| 82 | \endqml | - | ||||||||||||
| 83 | The \l role is set to \c Button to indicate the type of control. | - | ||||||||||||
| 84 | \l {Accessible::}{name} is the most important information and bound to the text on the button. | - | ||||||||||||
| 85 | The name is a short and consise description of the control and should reflect the visual label. | - | ||||||||||||
| 86 | In this case it is not clear what the button does with the name only, so \l description contains | - | ||||||||||||
| 87 | an explanation. | - | ||||||||||||
| 88 | There is also a signal handler \l {Accessible::pressAction}{Accessible.pressAction} which can be invoked by assistive tools to trigger | - | ||||||||||||
| 89 | the button. This signal handler needs to have the same effect as tapping or clicking the button would have. | - | ||||||||||||
| 90 | - | |||||||||||||
| 91 | \sa Accessibility | - | ||||||||||||
| 92 | */ | - | ||||||||||||
| 93 | - | |||||||||||||
| 94 | /*! | - | ||||||||||||
| 95 | \qmlproperty string QtQuick::Accessible::name | - | ||||||||||||
| 96 | - | |||||||||||||
| 97 | This property sets an accessible name. | - | ||||||||||||
| 98 | For a button for example, this should have a binding to its text. | - | ||||||||||||
| 99 | In general this property should be set to a simple and concise | - | ||||||||||||
| 100 | but human readable name. Do not include the type of control | - | ||||||||||||
| 101 | you want to represent but just the name. | - | ||||||||||||
| 102 | */ | - | ||||||||||||
| 103 | - | |||||||||||||
| 104 | /*! | - | ||||||||||||
| 105 | \qmlproperty string QtQuick::Accessible::description | - | ||||||||||||
| 106 | - | |||||||||||||
| 107 | This property sets an accessible description. | - | ||||||||||||
| 108 | Similar to the name it describes the item. The description | - | ||||||||||||
| 109 | can be a little more verbose and tell what the item does, | - | ||||||||||||
| 110 | for example the functionallity of the button it describes. | - | ||||||||||||
| 111 | */ | - | ||||||||||||
| 112 | - | |||||||||||||
| 113 | /*! | - | ||||||||||||
| 114 | \qmlproperty enumeration QtQuick::Accessible::role | - | ||||||||||||
| 115 | - | |||||||||||||
| 116 | This flags sets the semantic type of the widget. | - | ||||||||||||
| 117 | A button for example would have "Button" as type. | - | ||||||||||||
| 118 | The value must be one of \l QAccessible::Role. | - | ||||||||||||
| 119 | - | |||||||||||||
| 120 | Some roles have special semantics. | - | ||||||||||||
| 121 | In order to implement check boxes for example a "checked" property is expected. | - | ||||||||||||
| 122 | - | |||||||||||||
| 123 | \table | - | ||||||||||||
| 124 | \header | - | ||||||||||||
| 125 | \li \b {Role} | - | ||||||||||||
| 126 | \li \b {Properties and signals} | - | ||||||||||||
| 127 | \li \b {Explanation} | - | ||||||||||||
| 128 | \row | - | ||||||||||||
| 129 | \li All interactive elements | - | ||||||||||||
| 130 | \li \l focusable and \l focused | - | ||||||||||||
| 131 | \li All elements that the user can interact with should have focusable set to \c true and | - | ||||||||||||
| 132 | set \c focus to \c true when they have the focus. This is important even for applications | - | ||||||||||||
| 133 | that run on touch-only devices since screen readers often implement a virtual focus that | - | ||||||||||||
| 134 | can be moved from item to item. | - | ||||||||||||
| 135 | \row | - | ||||||||||||
| 136 | \li Button, CheckBox, RadioButton | - | ||||||||||||
| 137 | \li \l {Accessible::pressAction}{Accessible.pressAction} | - | ||||||||||||
| 138 | \li A button should have a signal handler with the name \c onPressAction. | - | ||||||||||||
| 139 | This signal may be emitted by an assistive tool such as a screen-reader. | - | ||||||||||||
| 140 | The implementation needs to behave the same as a mouse click or tap on the button. | - | ||||||||||||
| 141 | \row | - | ||||||||||||
| 142 | \li CheckBox, RadioButton | - | ||||||||||||
| 143 | \li \l checkable, \l checked, \l {Accessible::toggleAction}{Accessible.toggleAction} | - | ||||||||||||
| 144 | - | |||||||||||||
| 145 | \li The check state of the check box. Updated on Press, Check and Uncheck actions. | - | ||||||||||||
| 146 | \row | - | ||||||||||||
| 147 | \li Slider, SpinBox, Dial, ScrollBar | - | ||||||||||||
| 148 | \li \c value, \c minimumValue, \c maximumValue, \c stepSize | - | ||||||||||||
| 149 | \li These properties reflect the state and possible values for the elements. | - | ||||||||||||
| 150 | \row | - | ||||||||||||
| 151 | \li Slider, SpinBox, Dial, ScrollBar | - | ||||||||||||
| 152 | \li \l {Accessible::increaseAction}{Accessible.increaseAction}, \l {Accessible::decreaseAction}{Accessible.decreaseAction} | - | ||||||||||||
| 153 | \li Actions to increase and decrease the value of the element. | - | ||||||||||||
| 154 | \endtable | - | ||||||||||||
| 155 | */ | - | ||||||||||||
| 156 | - | |||||||||||||
| 157 | /*! \qmlproperty bool QtQuick::Accessible::focusable | - | ||||||||||||
| 158 | \brief This property holds whether this item is focusable. | - | ||||||||||||
| 159 | - | |||||||||||||
| 160 | By default, this property is \c false except for items where the role is one of | - | ||||||||||||
| 161 | \c CheckBox, \c RadioButton, \c Button, \c MenuItem, \c PageTab, \c EditableText, \c SpinBox, \c ComboBox, | - | ||||||||||||
| 162 | \c Terminal or \c ScrollBar. | - | ||||||||||||
| 163 | \sa focused | - | ||||||||||||
| 164 | */ | - | ||||||||||||
| 165 | /*! \qmlproperty bool QtQuick::Accessible::focused | - | ||||||||||||
| 166 | \brief This property holds whether this item currently has the active focus. | - | ||||||||||||
| 167 | - | |||||||||||||
| 168 | By default, this property is \c false, but it will return \c true for items that | - | ||||||||||||
| 169 | have \l QQuickItem::hasActiveFocus() returning \c true. | - | ||||||||||||
| 170 | \sa focusable | - | ||||||||||||
| 171 | */ | - | ||||||||||||
| 172 | /*! \qmlproperty bool QtQuick::Accessible::checkable | - | ||||||||||||
| 173 | \brief This property holds whether this item is checkable (like a check box or some buttons). | - | ||||||||||||
| 174 | - | |||||||||||||
| 175 | By default this property is \c false. | - | ||||||||||||
| 176 | \sa checked | - | ||||||||||||
| 177 | */ | - | ||||||||||||
| 178 | /*! \qmlproperty bool QtQuick::Accessible::checked | - | ||||||||||||
| 179 | \brief This property holds whether this item is currently checked. | - | ||||||||||||
| 180 | - | |||||||||||||
| 181 | By default this property is \c false. | - | ||||||||||||
| 182 | \sa checkable | - | ||||||||||||
| 183 | */ | - | ||||||||||||
| 184 | /*! \qmlproperty bool QtQuick::Accessible::editable | - | ||||||||||||
| 185 | \brief This property holds whether this item has editable text. | - | ||||||||||||
| 186 | - | |||||||||||||
| 187 | By default this property is \c false. | - | ||||||||||||
| 188 | */ | - | ||||||||||||
| 189 | /*! \qmlproperty bool QtQuick::Accessible::searchEdit | - | ||||||||||||
| 190 | \brief This property holds whether this item is input for a search query. | - | ||||||||||||
| 191 | This property will only affect editable text. | - | ||||||||||||
| 192 | - | |||||||||||||
| 193 | By default this property is \c false. | - | ||||||||||||
| 194 | */ | - | ||||||||||||
| 195 | /*! \qmlproperty bool QtQuick::Accessible::ignored | - | ||||||||||||
| 196 | \brief This property holds whether this item should be ignored by the accessibility framework. | - | ||||||||||||
| 197 | - | |||||||||||||
| 198 | Sometimes an item is part of a group of items that should be treated as one. For example two labels might be | - | ||||||||||||
| 199 | visually placed next to each other, but separate items. For accessibility purposes they should be treated as one | - | ||||||||||||
| 200 | and thus they are represented by a third invisible item with the right geometry. | - | ||||||||||||
| 201 | - | |||||||||||||
| 202 | For example a speed display adds "m/s" as a smaller label: | - | ||||||||||||
| 203 | \qml | - | ||||||||||||
| 204 | Row { | - | ||||||||||||
| 205 | Label { | - | ||||||||||||
| 206 | id: speedLabel | - | ||||||||||||
| 207 | text: "Speed: 5" | - | ||||||||||||
| 208 | Accessible.ignored: true | - | ||||||||||||
| 209 | } | - | ||||||||||||
| 210 | Label { | - | ||||||||||||
| 211 | text: qsTr("m/s") | - | ||||||||||||
| 212 | Accessible.ignored: true | - | ||||||||||||
| 213 | } | - | ||||||||||||
| 214 | Accessible.role: Accessible.StaticText | - | ||||||||||||
| 215 | Accessible.name: speedLabel.text + " meters per second" | - | ||||||||||||
| 216 | } | - | ||||||||||||
| 217 | \endqml | - | ||||||||||||
| 218 | - | |||||||||||||
| 219 | \since 5.4 | - | ||||||||||||
| 220 | By default this property is \c false. | - | ||||||||||||
| 221 | */ | - | ||||||||||||
| 222 | /*! \qmlproperty bool QtQuick::Accessible::multiLine | - | ||||||||||||
| 223 | \brief This property holds whether this item has multiple text lines. | - | ||||||||||||
| 224 | - | |||||||||||||
| 225 | By default this property is \c false. | - | ||||||||||||
| 226 | */ | - | ||||||||||||
| 227 | /*! \qmlproperty bool QtQuick::Accessible::readOnly | - | ||||||||||||
| 228 | \brief This property indicates that a text field is read only. | - | ||||||||||||
| 229 | - | |||||||||||||
| 230 | It is relevant when the role is \l QAccessible::EditableText and set to be read-only. | - | ||||||||||||
| 231 | By default this property is \c false. | - | ||||||||||||
| 232 | */ | - | ||||||||||||
| 233 | /*! \qmlproperty bool QtQuick::Accessible::selected | - | ||||||||||||
| 234 | \brief This property holds whether this item is selected. | - | ||||||||||||
| 235 | - | |||||||||||||
| 236 | By default this property is \c false. | - | ||||||||||||
| 237 | \sa selectable | - | ||||||||||||
| 238 | */ | - | ||||||||||||
| 239 | /*! \qmlproperty bool QtQuick::Accessible::selectable | - | ||||||||||||
| 240 | \brief This property holds whether this item can be selected. | - | ||||||||||||
| 241 | - | |||||||||||||
| 242 | By default this property is \c false. | - | ||||||||||||
| 243 | \sa selected | - | ||||||||||||
| 244 | */ | - | ||||||||||||
| 245 | /*! \qmlproperty bool QtQuick::Accessible::pressed | - | ||||||||||||
| 246 | \brief This property holds whether this item is pressed (for example a button during a mouse click). | - | ||||||||||||
| 247 | - | |||||||||||||
| 248 | By default this property is \c false. | - | ||||||||||||
| 249 | */ | - | ||||||||||||
| 250 | /*! \qmlproperty bool QtQuick::Accessible::checkStateMixed | - | ||||||||||||
| 251 | \brief This property holds whether this item is in the partially checked state. | - | ||||||||||||
| 252 | - | |||||||||||||
| 253 | By default this property is \c false. | - | ||||||||||||
| 254 | \sa checked, checkable | - | ||||||||||||
| 255 | */ | - | ||||||||||||
| 256 | /*! \qmlproperty bool QtQuick::Accessible::defaultButton | - | ||||||||||||
| 257 | \brief This property holds whether this item is the default button of a dialog. | - | ||||||||||||
| 258 | - | |||||||||||||
| 259 | By default this property is \c false. | - | ||||||||||||
| 260 | */ | - | ||||||||||||
| 261 | /*! \qmlproperty bool QtQuick::Accessible::passwordEdit | - | ||||||||||||
| 262 | \brief This property holds whether this item is a password text edit. | - | ||||||||||||
| 263 | - | |||||||||||||
| 264 | By default this property is \c false. | - | ||||||||||||
| 265 | */ | - | ||||||||||||
| 266 | /*! \qmlproperty bool QtQuick::Accessible::selectableText | - | ||||||||||||
| 267 | \brief This property holds whether this item contains selectable text. | - | ||||||||||||
| 268 | - | |||||||||||||
| 269 | By default this property is \c false. | - | ||||||||||||
| 270 | */ | - | ||||||||||||
| 271 | - | |||||||||||||
| 272 | /*! | - | ||||||||||||
| 273 | \qmlsignal QtQuick::Accessible::pressAction() | - | ||||||||||||
| 274 | - | |||||||||||||
| 275 | This signal is emitted when a press action is received from an assistive tool such as a screen-reader. | - | ||||||||||||
| 276 | - | |||||||||||||
| 277 | The corresponding handler is \c onPressAction. | - | ||||||||||||
| 278 | */ | - | ||||||||||||
| 279 | /*! | - | ||||||||||||
| 280 | \qmlsignal QtQuick::Accessible::toggleAction() | - | ||||||||||||
| 281 | - | |||||||||||||
| 282 | This signal is emitted when a toggle action is received from an assistive tool such as a screen-reader. | - | ||||||||||||
| 283 | - | |||||||||||||
| 284 | The corresponding handler is \c onToggleAction. | - | ||||||||||||
| 285 | */ | - | ||||||||||||
| 286 | /*! | - | ||||||||||||
| 287 | \qmlsignal QtQuick::Accessible::increaseAction() | - | ||||||||||||
| 288 | - | |||||||||||||
| 289 | This signal is emitted when a increase action is received from an assistive tool such as a screen-reader. | - | ||||||||||||
| 290 | - | |||||||||||||
| 291 | The corresponding handler is \c onIncreaseAction. | - | ||||||||||||
| 292 | */ | - | ||||||||||||
| 293 | /*! | - | ||||||||||||
| 294 | \qmlsignal QtQuick::Accessible::decreaseAction() | - | ||||||||||||
| 295 | - | |||||||||||||
| 296 | This signal is emitted when a decrease action is received from an assistive tool such as a screen-reader. | - | ||||||||||||
| 297 | - | |||||||||||||
| 298 | The corresponding handler is \c onDecreaseAction. | - | ||||||||||||
| 299 | */ | - | ||||||||||||
| 300 | /*! | - | ||||||||||||
| 301 | \qmlsignal QtQuick::Accessible::scrollUpAction() | - | ||||||||||||
| 302 | - | |||||||||||||
| 303 | This signal is emitted when a scroll up action is received from an assistive tool such as a screen-reader. | - | ||||||||||||
| 304 | - | |||||||||||||
| 305 | The corresponding handler is \c onScrollUpAction. | - | ||||||||||||
| 306 | */ | - | ||||||||||||
| 307 | /*! | - | ||||||||||||
| 308 | \qmlsignal QtQuick::Accessible::scrollDownAction() | - | ||||||||||||
| 309 | - | |||||||||||||
| 310 | This signal is emitted when a scroll down action is received from an assistive tool such as a screen-reader. | - | ||||||||||||
| 311 | - | |||||||||||||
| 312 | The corresponding handler is \c onScrollDownAction. | - | ||||||||||||
| 313 | */ | - | ||||||||||||
| 314 | /*! | - | ||||||||||||
| 315 | \qmlsignal QtQuick::Accessible::scrollLeftAction() | - | ||||||||||||
| 316 | - | |||||||||||||
| 317 | This signal is emitted when a scroll left action is received from an assistive tool such as a screen-reader. | - | ||||||||||||
| 318 | - | |||||||||||||
| 319 | The corresponding handler is \c onScrollLeftAction. | - | ||||||||||||
| 320 | */ | - | ||||||||||||
| 321 | /*! | - | ||||||||||||
| 322 | \qmlsignal QtQuick::Accessible::scrollRightAction() | - | ||||||||||||
| 323 | - | |||||||||||||
| 324 | This signal is emitted when a scroll right action is received from an assistive tool such as a screen-reader. | - | ||||||||||||
| 325 | - | |||||||||||||
| 326 | The corresponding handler is \c onScrollRightAction. | - | ||||||||||||
| 327 | */ | - | ||||||||||||
| 328 | /*! | - | ||||||||||||
| 329 | \qmlsignal QtQuick::Accessible::previousPageAction() | - | ||||||||||||
| 330 | - | |||||||||||||
| 331 | This signal is emitted when a previous page action is received from an assistive tool such as a screen-reader. | - | ||||||||||||
| 332 | - | |||||||||||||
| 333 | The corresponding handler is \c onPreviousPageAction. | - | ||||||||||||
| 334 | */ | - | ||||||||||||
| 335 | /*! | - | ||||||||||||
| 336 | \qmlsignal QtQuick::Accessible::nextPageAction() | - | ||||||||||||
| 337 | - | |||||||||||||
| 338 | This signal is emitted when a next page action is received from an assistive tool such as a screen-reader. | - | ||||||||||||
| 339 | - | |||||||||||||
| 340 | The corresponding handler is \c onNextPageAction. | - | ||||||||||||
| 341 | */ | - | ||||||||||||
| 342 | - | |||||||||||||
| 343 | QMetaMethod QQuickAccessibleAttached::sigPress; | - | ||||||||||||
| 344 | QMetaMethod QQuickAccessibleAttached::sigToggle; | - | ||||||||||||
| 345 | QMetaMethod QQuickAccessibleAttached::sigIncrease; | - | ||||||||||||
| 346 | QMetaMethod QQuickAccessibleAttached::sigDecrease; | - | ||||||||||||
| 347 | QMetaMethod QQuickAccessibleAttached::sigScrollUp; | - | ||||||||||||
| 348 | QMetaMethod QQuickAccessibleAttached::sigScrollDown; | - | ||||||||||||
| 349 | QMetaMethod QQuickAccessibleAttached::sigScrollLeft; | - | ||||||||||||
| 350 | QMetaMethod QQuickAccessibleAttached::sigScrollRight; | - | ||||||||||||
| 351 | QMetaMethod QQuickAccessibleAttached::sigPreviousPage; | - | ||||||||||||
| 352 | QMetaMethod QQuickAccessibleAttached::sigNextPage; | - | ||||||||||||
| 353 | - | |||||||||||||
| 354 | QQuickAccessibleAttached::QQuickAccessibleAttached(QObject *parent) | - | ||||||||||||
| 355 | : QObject(parent), m_role(QAccessible::NoRole) | - | ||||||||||||
| 356 | { | - | ||||||||||||
| 357 | Q_ASSERT(parent); | - | ||||||||||||
| 358 | QQuickItem *item = qobject_cast<QQuickItem*>(parent); | - | ||||||||||||
| 359 | if (!item)
| 2-84 | ||||||||||||
| 360 | return; executed 2 times by 1 test: return;Executed by:
| 2 | ||||||||||||
| 361 | - | |||||||||||||
| 362 | // Enable accessibility for items with accessible content. This also | - | ||||||||||||
| 363 | // enables accessibility for the ancestors of souch items. | - | ||||||||||||
| 364 | item->d_func()->setAccessible(); | - | ||||||||||||
| 365 | QAccessibleEvent ev(item, QAccessible::ObjectCreated); | - | ||||||||||||
| 366 | QAccessible::updateAccessibility(&ev); | - | ||||||||||||
| 367 | - | |||||||||||||
| 368 | if (!parent->property("value").isNull()) {
| 0-84 | ||||||||||||
| 369 | connect(parent, SIGNAL(valueChanged()), this, SLOT(valueChanged())); | - | ||||||||||||
| 370 | } never executed: end of block | 0 | ||||||||||||
| 371 | if (!parent->property("cursorPosition").isNull()) {
| 0-84 | ||||||||||||
| 372 | connect(parent, SIGNAL(cursorPositionChanged()), this, SLOT(cursorPositionChanged())); | - | ||||||||||||
| 373 | } never executed: end of block | 0 | ||||||||||||
| 374 | - | |||||||||||||
| 375 | if (!sigPress.isValid()) {
| 4-80 | ||||||||||||
| 376 | sigPress = QMetaMethod::fromSignal(&QQuickAccessibleAttached::pressAction); | - | ||||||||||||
| 377 | sigToggle = QMetaMethod::fromSignal(&QQuickAccessibleAttached::toggleAction); | - | ||||||||||||
| 378 | sigIncrease = QMetaMethod::fromSignal(&QQuickAccessibleAttached::increaseAction); | - | ||||||||||||
| 379 | sigDecrease = QMetaMethod::fromSignal(&QQuickAccessibleAttached::decreaseAction); | - | ||||||||||||
| 380 | sigScrollUp = QMetaMethod::fromSignal(&QQuickAccessibleAttached::scrollUpAction); | - | ||||||||||||
| 381 | sigScrollDown = QMetaMethod::fromSignal(&QQuickAccessibleAttached::scrollDownAction); | - | ||||||||||||
| 382 | sigScrollLeft = QMetaMethod::fromSignal(&QQuickAccessibleAttached::scrollLeftAction); | - | ||||||||||||
| 383 | sigScrollRight = QMetaMethod::fromSignal(&QQuickAccessibleAttached::scrollRightAction); | - | ||||||||||||
| 384 | sigPreviousPage = QMetaMethod::fromSignal(&QQuickAccessibleAttached::previousPageAction); | - | ||||||||||||
| 385 | sigNextPage= QMetaMethod::fromSignal(&QQuickAccessibleAttached::nextPageAction); | - | ||||||||||||
| 386 | } executed 4 times by 2 tests: end of blockExecuted by:
| 4 | ||||||||||||
| 387 | } executed 84 times by 2 tests: end of blockExecuted by:
| 84 | ||||||||||||
| 388 | - | |||||||||||||
| 389 | QQuickAccessibleAttached::~QQuickAccessibleAttached() | - | ||||||||||||
| 390 | { | - | ||||||||||||
| 391 | } | - | ||||||||||||
| 392 | - | |||||||||||||
| 393 | QQuickAccessibleAttached *QQuickAccessibleAttached::qmlAttachedProperties(QObject *obj) | - | ||||||||||||
| 394 | { | - | ||||||||||||
| 395 | return new QQuickAccessibleAttached(obj); executed 84 times by 2 tests: return new QQuickAccessibleAttached(obj);Executed by:
| 84 | ||||||||||||
| 396 | } | - | ||||||||||||
| 397 | - | |||||||||||||
| 398 | bool QQuickAccessibleAttached::ignored() const | - | ||||||||||||
| 399 | { | - | ||||||||||||
| 400 | return !item()->d_func()->isAccessible; executed 4 times by 1 test: return !item()->d_func()->isAccessible;Executed by:
| 4 | ||||||||||||
| 401 | } | - | ||||||||||||
| 402 | - | |||||||||||||
| 403 | void QQuickAccessibleAttached::setIgnored(bool ignored) | - | ||||||||||||
| 404 | { | - | ||||||||||||
| 405 | if (this->ignored() != ignored) {
| 0-4 | ||||||||||||
| 406 | item()->d_func()->isAccessible = !ignored; | - | ||||||||||||
| 407 | emit ignoredChanged(); | - | ||||||||||||
| 408 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||
| 409 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||
| 410 | - | |||||||||||||
| 411 | bool QQuickAccessibleAttached::doAction(const QString &actionName) | - | ||||||||||||
| 412 | { | - | ||||||||||||
| 413 | QMetaMethod *sig = nullptr; | - | ||||||||||||
| 414 | if (actionName == QAccessibleActionInterface::pressAction())
| 0 | ||||||||||||
| 415 | sig = &sigPress; never executed: sig = &sigPress; | 0 | ||||||||||||
| 416 | else if (actionName == QAccessibleActionInterface::toggleAction())
| 0 | ||||||||||||
| 417 | sig = &sigToggle; never executed: sig = &sigToggle; | 0 | ||||||||||||
| 418 | else if (actionName == QAccessibleActionInterface::increaseAction())
| 0 | ||||||||||||
| 419 | sig = &sigIncrease; never executed: sig = &sigIncrease; | 0 | ||||||||||||
| 420 | else if (actionName == QAccessibleActionInterface::decreaseAction())
| 0 | ||||||||||||
| 421 | sig = &sigDecrease; never executed: sig = &sigDecrease; | 0 | ||||||||||||
| 422 | else if (actionName == QAccessibleActionInterface::scrollUpAction())
| 0 | ||||||||||||
| 423 | sig = &sigScrollUp; never executed: sig = &sigScrollUp; | 0 | ||||||||||||
| 424 | else if (actionName == QAccessibleActionInterface::scrollDownAction())
| 0 | ||||||||||||
| 425 | sig = &sigScrollDown; never executed: sig = &sigScrollDown; | 0 | ||||||||||||
| 426 | else if (actionName == QAccessibleActionInterface::scrollLeftAction())
| 0 | ||||||||||||
| 427 | sig = &sigScrollLeft; never executed: sig = &sigScrollLeft; | 0 | ||||||||||||
| 428 | else if (actionName == QAccessibleActionInterface::scrollRightAction())
| 0 | ||||||||||||
| 429 | sig = &sigScrollRight; never executed: sig = &sigScrollRight; | 0 | ||||||||||||
| 430 | else if (actionName == QAccessibleActionInterface::previousPageAction())
| 0 | ||||||||||||
| 431 | sig = &sigPreviousPage; never executed: sig = &sigPreviousPage; | 0 | ||||||||||||
| 432 | else if (actionName == QAccessibleActionInterface::nextPageAction())
| 0 | ||||||||||||
| 433 | sig = &sigNextPage; never executed: sig = &sigNextPage; | 0 | ||||||||||||
| 434 | if (sig && isSignalConnected(*sig))
| 0 | ||||||||||||
| 435 | return sig->invoke(this); never executed: return sig->invoke(this); | 0 | ||||||||||||
| 436 | return false; never executed: return false; | 0 | ||||||||||||
| 437 | } | - | ||||||||||||
| 438 | - | |||||||||||||
| 439 | void QQuickAccessibleAttached::availableActions(QStringList *actions) const | - | ||||||||||||
| 440 | { | - | ||||||||||||
| 441 | if (isSignalConnected(sigPress))
| 0 | ||||||||||||
| 442 | actions->append(QAccessibleActionInterface::pressAction()); never executed: actions->append(QAccessibleActionInterface::pressAction()); | 0 | ||||||||||||
| 443 | if (isSignalConnected(sigToggle))
| 0 | ||||||||||||
| 444 | actions->append(QAccessibleActionInterface::toggleAction()); never executed: actions->append(QAccessibleActionInterface::toggleAction()); | 0 | ||||||||||||
| 445 | if (isSignalConnected(sigIncrease))
| 0 | ||||||||||||
| 446 | actions->append(QAccessibleActionInterface::increaseAction()); never executed: actions->append(QAccessibleActionInterface::increaseAction()); | 0 | ||||||||||||
| 447 | if (isSignalConnected(sigDecrease))
| 0 | ||||||||||||
| 448 | actions->append(QAccessibleActionInterface::decreaseAction()); never executed: actions->append(QAccessibleActionInterface::decreaseAction()); | 0 | ||||||||||||
| 449 | if (isSignalConnected(sigScrollUp))
| 0 | ||||||||||||
| 450 | actions->append(QAccessibleActionInterface::scrollUpAction()); never executed: actions->append(QAccessibleActionInterface::scrollUpAction()); | 0 | ||||||||||||
| 451 | if (isSignalConnected(sigScrollDown))
| 0 | ||||||||||||
| 452 | actions->append(QAccessibleActionInterface::scrollDownAction()); never executed: actions->append(QAccessibleActionInterface::scrollDownAction()); | 0 | ||||||||||||
| 453 | if (isSignalConnected(sigScrollLeft))
| 0 | ||||||||||||
| 454 | actions->append(QAccessibleActionInterface::scrollLeftAction()); never executed: actions->append(QAccessibleActionInterface::scrollLeftAction()); | 0 | ||||||||||||
| 455 | if (isSignalConnected(sigScrollRight))
| 0 | ||||||||||||
| 456 | actions->append(QAccessibleActionInterface::scrollRightAction()); never executed: actions->append(QAccessibleActionInterface::scrollRightAction()); | 0 | ||||||||||||
| 457 | if (isSignalConnected(sigPreviousPage))
| 0 | ||||||||||||
| 458 | actions->append(QAccessibleActionInterface::previousPageAction()); never executed: actions->append(QAccessibleActionInterface::previousPageAction()); | 0 | ||||||||||||
| 459 | if (isSignalConnected(sigNextPage))
| 0 | ||||||||||||
| 460 | actions->append(QAccessibleActionInterface::nextPageAction()); never executed: actions->append(QAccessibleActionInterface::nextPageAction()); | 0 | ||||||||||||
| 461 | } never executed: end of block | 0 | ||||||||||||
| 462 | - | |||||||||||||
| 463 | QT_END_NAMESPACE | - | ||||||||||||
| 464 | - | |||||||||||||
| 465 | #include "moc_qquickaccessibleattached_p.cpp" | - | ||||||||||||
| 466 | - | |||||||||||||
| 467 | #endif | - | ||||||||||||
| Source code | Switch to Preprocessed file |