Only call QA::updateAccessibility() if the "control owner" is a QWidget

QGraphicsItems are not accessible, and calling updateAccessibility()
with a QGraphicsTextItem caused the accessibility framework to try
to load a plugin for QGraphicsTextItem. Since that was not found, it
dumped this on the console:
"Cannot create accessible interface for object: QGraphicsTextItem"

Task-number: QTBUG-29720

Change-Id: I4aaa08ee6e97f03617fa08da0c6ef35992efdebf
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
This commit is contained in:
Jan Arve Saether 2013-05-15 10:56:40 +02:00 committed by The Qt Project
parent 57acf1b46c
commit 0cad334ab6

View File

@ -579,7 +579,7 @@ void QWidgetTextControlPrivate::selectionChanged(bool forceEmitSelectionChanged
if (forceEmitSelectionChanged) {
emit q->selectionChanged();
#ifndef QT_NO_ACCESSIBILITY
if (q->parent()) {
if (q->parent() && q->parent()->isWidgetType()) {
QAccessibleTextSelectionEvent ev(q->parent(), cursor.anchor(), cursor.position());
QAccessible::updateAccessibility(&ev);
}
@ -602,7 +602,7 @@ void QWidgetTextControlPrivate::selectionChanged(bool forceEmitSelectionChanged
|| cursor.anchor() != lastSelectionAnchor)))) {
emit q->selectionChanged();
#ifndef QT_NO_ACCESSIBILITY
if (q->parent()) {
if (q->parent() && q->parent()->isWidgetType()) {
QAccessibleTextSelectionEvent ev(q->parent(), cursor.anchor(), cursor.position());
QAccessible::updateAccessibility(&ev);
}