Fix crash on startup when running screenreader
For exaple Qt Creator would crash when started and a screen reader (eg NVDA) is running. This is due to updateAccessibility being called during the ctor of the TextEdit and on Windows the AT can access properties in the same call resulting in accessing the text control before it's fully constructed. Also make sure to not send accessibility updates for non-widget type edits since we don't support any accessibility in Qt Quick 1. Task-number: QTBUG-38659 Change-Id: I1635fa3b2c4d3509f44daf760e4d7b4171d67e1d Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
This commit is contained in:
parent
1fdd765ae8
commit
5bca5d0a51
@ -438,7 +438,6 @@ void QWidgetTextControlPrivate::setContent(Qt::TextFormat format, const QString
|
||||
|
||||
QObject::connect(doc, SIGNAL(contentsChanged()), q, SLOT(_q_updateCurrentCharFormatAndSelection()));
|
||||
QObject::connect(doc, SIGNAL(cursorPositionChanged(QTextCursor)), q, SLOT(_q_emitCursorPosChanged(QTextCursor)));
|
||||
QObject::connect(doc, SIGNAL(contentsChange(int,int,int)), q, SLOT(_q_contentsChanged(int,int,int)));
|
||||
QObject::connect(doc, SIGNAL(documentLayoutChanged()), q, SLOT(_q_documentLayoutChanged()));
|
||||
|
||||
// convenience signal forwards
|
||||
@ -501,6 +500,8 @@ void QWidgetTextControlPrivate::setContent(Qt::TextFormat format, const QString
|
||||
|
||||
q->ensureCursorVisible();
|
||||
emit q->cursorPositionChanged();
|
||||
|
||||
QObject::connect(doc, SIGNAL(contentsChange(int,int,int)), q, SLOT(_q_contentsChanged(int,int,int)), Qt::UniqueConnection);
|
||||
}
|
||||
|
||||
void QWidgetTextControlPrivate::startDrag()
|
||||
@ -646,7 +647,8 @@ void QWidgetTextControlPrivate::_q_contentsChanged(int from, int charsRemoved, i
|
||||
{
|
||||
Q_Q(QWidgetTextControl);
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
if (QAccessible::isActive()) {
|
||||
|
||||
if (QAccessible::isActive() && q->parent() && q->parent()->isWidgetType()) {
|
||||
QTextCursor tmp(doc);
|
||||
tmp.setPosition(from);
|
||||
tmp.setPosition(from + charsAdded, QTextCursor::KeepAnchor);
|
||||
|
Loading…
Reference in New Issue
Block a user