Commit 3d8f103c authored by Frederik Gladhorn's avatar Frederik Gladhorn Committed by Qt by Nokia

Add accessibility updates.

Re-add all accessibility updates with new api.

Change-Id: Iec91c41a0137911ccf6e9f4fa907a378d9dd335a
Reviewed-by: 's avatarJan-Arve Sæther <jan-arve.saether@nokia.com>
parent 91f9f123
......@@ -144,6 +144,10 @@ QQuickAccessibleAttached::QQuickAccessibleAttached(QObject *parent)
// Enable accessibility for items with accessible content. This also
// enables accessibility for the ancestors of souch items.
item->d_func()->setAccessibleFlagAndListener();
#ifndef QT_NO_ACCESSIBILITY
QAccessibleEvent ev(item, QAccessible::ObjectCreated);
QAccessible::updateAccessibility(&ev);
#endif
}
QQuickAccessibleAttached::~QQuickAccessibleAttached()
......
......@@ -85,6 +85,10 @@ public:
if (name != m_name) {
m_name = name;
emit nameChanged();
#ifndef QT_NO_ACCESSIBILITY
QAccessibleEvent ev(parent(), QAccessible::NameChanged);
QAccessible::updateAccessibility(&ev);
#endif
}
}
......@@ -94,6 +98,10 @@ public:
if (m_description != description) {
m_description = description;
emit descriptionChanged();
#ifndef QT_NO_ACCESSIBILITY
QAccessibleEvent ev(parent(), QAccessible::DescriptionChanged);
QAccessible::updateAccessibility(&ev);
#endif
}
}
......
......@@ -3122,6 +3122,10 @@ void QQuickItem::inputMethodEvent(QInputMethodEvent *event)
void QQuickItem::focusInEvent(QFocusEvent *)
{
#ifndef QT_NO_ACCESSIBILITY
QAccessibleEvent ev(this, QAccessible::Focus);
QAccessible::updateAccessibility(&ev);
#endif
}
void QQuickItem::focusOutEvent(QFocusEvent *)
......@@ -4085,7 +4089,12 @@ bool QQuickItemPrivate::setEffectiveVisibleRecur(bool newEffectiveVisible)
childVisibilityChanged |= QQuickItemPrivate::get(childItems.at(ii))->setEffectiveVisibleRecur(newEffectiveVisible);
itemChange(QQuickItem::ItemVisibleHasChanged, effectiveVisible);
#ifndef QT_NO_ACCESSIBILITY
if (isAccessible) {
QAccessibleEvent ev(q, effectiveVisible ? QAccessible::ObjectShow : QAccessible::ObjectHide);
QAccessible::updateAccessibility(&ev);
}
#endif
emit q->visibleChanged();
if (childVisibilityChanged)
emit q->visibleChildrenChanged();
......
......@@ -3302,6 +3302,7 @@ bool QQuickTextInputPrivate::finishChange(int validateFromState, bool update, bo
*/
void QQuickTextInputPrivate::internalSetText(const QString &txt, int pos, bool edited)
{
Q_Q(QQuickTextInput);
internalDeselect();
QString oldText = m_text;
if (m_maskData) {
......@@ -3315,7 +3316,15 @@ void QQuickTextInputPrivate::internalSetText(const QString &txt, int pos, bool e
m_cursor = (pos < 0 || pos > m_text.length()) ? m_text.length() : pos;
m_textDirty = (oldText != m_text);
finishChange(-1, true, edited);
bool changed = finishChange(-1, true, edited);
#ifdef QT_NO_ACCESSIBILITY
Q_UNUSED(changed)
#else
if (changed) {
QAccessibleTextUpdateEvent ev(q, 0, oldText, m_text);
QAccessible::updateAccessibility(&ev);
}
#endif
}
......@@ -3939,6 +3948,11 @@ bool QQuickTextInputPrivate::emitCursorPositionChanged()
}
}
#ifndef QT_NO_ACCESSIBILITY
QAccessibleTextCursorEvent ev(q, m_cursor);
QAccessible::updateAccessibility(&ev);
#endif
return true;
}
return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment