/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
+** This file is part of the QtQml module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
QT_BEGIN_NAMESPACE
/*!
- \qmlclass Accessible QQuickAccessibleAttached
- \brief Attached property to enable accessibility of QML items.
+ \qmltype Accessible
+ \instantiates QQuickAccessibleAttached
+ \brief Enables accessibility of QML items
\inqmlmodule QtQuick 2
- \ingroup qml-basic-interaction-elements
+ \ingroup qtquick-visual-utility
\ingroup accessibility
This class is part of \l {Accessibility for Qt Quick Applications}.
\qml
Item {
id: myButton
+
Text {
id: label
// ...
}
+
Accessible.name: label.text
Accessible.role: Accessible.Button
+
+ function accessiblePressAction() {
+ //...
+ }
}
\endqml
\table
\header
- \o \bold {Role}
- \o \bold {Expected property}
- \o
+ \li \b {Role}
+ \li \b {Expected property}
+ \li
\row
- \o CheckBox
- \o checked
- \o The check state of the check box.
- \row
- \o RadioButton
- \o checked
- \o The selected state of the radio button.
+ \li Button
+ \li function accessiblePressAction
+ \li Called when the button receives a press action. The implementation should visually simulate a button click and perform the button action.
\row
- \o Button
- \o checkable
- \o Whether the button is checkable.
+ \li CheckBox, Radiobutton
+ \li checked
+ \li The check state of the check box. Updated on Press, Check and Uncheck actions.
\row
- \o Button
- \o checked
- \o Whether the button is checked (only if checkable is true).
+ \li Slider, SpinBox, Dial, ScrollBar
+ \li value, minimumValue, maximumValue, stepSize
+ \li value will be updated on increase and decrase actions, in accordance with the other properties
\endtable
-
*/
QQuickAccessibleAttached::QQuickAccessibleAttached(QObject *parent)
- : QObject(parent)
+ : QObject(parent), m_role(QAccessible::NoRole)
{
Q_ASSERT(parent);
QQuickItem *item = qobject_cast<QQuickItem*>(parent);
// Enable accessibility for items with accessible content. This also
// enables accessibility for the ancestors of souch items.
item->d_func()->setAccessibleFlagAndListener();
- QAccessible::updateAccessibility(item, 0, QAccessible::ObjectCreated);
+ QAccessibleEvent ev(item, QAccessible::ObjectCreated);
+ QAccessible::updateAccessibility(&ev);
}
QQuickAccessibleAttached::~QQuickAccessibleAttached()