Make QLineControl send accessibility updates.
To make it emit the signals for the right object, it needs its parent to be the QGraphicsItem/SGItem/QLineEdit. According to IA2 it should emit TextUpdated and CursorMoved signals. TextChanged is deprecated. More fine grained signals would be desireable but this makes changes work at all. Reviewed-by: Morten Sorvig
This commit is contained in:
parent
1625b25a9f
commit
38ed8c2ddd
@ -111,8 +111,8 @@ public:
|
||||
TableSummaryChanged,
|
||||
TextAttributeChanged,
|
||||
TextCaretMoved,
|
||||
TextChanged,
|
||||
TextColumnChanged,
|
||||
// TextChanged, deprecated, use TextUpdated
|
||||
TextColumnChanged = TextCaretMoved + 2,
|
||||
TextInserted,
|
||||
TextRemoved,
|
||||
TextUpdated,
|
||||
|
@ -651,7 +651,12 @@ void QLineControl::internalSetText(const QString &txt, int pos, bool edited)
|
||||
m_modifiedState = m_undoState = 0;
|
||||
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);
|
||||
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
if (changed)
|
||||
QAccessible::updateAccessibility(parent(), 0, QAccessible::TextUpdated);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -1238,6 +1243,9 @@ void QLineControl::emitCursorPositionChanged()
|
||||
const int oldLast = m_lastCursorPos;
|
||||
m_lastCursorPos = m_cursor;
|
||||
cursorPositionChanged(oldLast, m_cursor);
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
QAccessible::updateAccessibility(parent(), 0, QAccessible::TextCaretMoved);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,10 +61,10 @@
|
||||
#include "QtGui/qtextlayout.h"
|
||||
#include "QtGui/qstyleoption.h"
|
||||
#include "QtCore/qpointer.h"
|
||||
#include "QtGui/qlineedit.h"
|
||||
#include "QtGui/qclipboard.h"
|
||||
#include "QtCore/qpoint.h"
|
||||
#include "QtGui/qcompleter.h"
|
||||
#include "QtGui/qaccessible.h"
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
|
@ -153,6 +153,7 @@ void QLineEditPrivate::init(const QString& txt)
|
||||
{
|
||||
Q_Q(QLineEdit);
|
||||
control = new QLineControl(txt);
|
||||
control->setParent(q);
|
||||
control->setFont(q->font());
|
||||
QObject::connect(control, SIGNAL(textChanged(QString)),
|
||||
q, SIGNAL(textChanged(QString)));
|
||||
|
@ -84,7 +84,6 @@ public:
|
||||
|
||||
~QLineEditPrivate()
|
||||
{
|
||||
delete control;
|
||||
}
|
||||
|
||||
QLineControl *control;
|
||||
|
Loading…
x
Reference in New Issue
Block a user