Call QAccessible::updateAccessibility when caret moves in QTextEdit
Change-Id: I3b9e5d8e67b4928558b642a4d23aa60ae9dfde60 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
This commit is contained in:
parent
568b278b75
commit
6e713cf03d
@ -53,6 +53,9 @@
|
|||||||
#include <qmenu.h>
|
#include <qmenu.h>
|
||||||
#include <qstyle.h>
|
#include <qstyle.h>
|
||||||
#include <qtimer.h>
|
#include <qtimer.h>
|
||||||
|
#ifndef QT_NO_ACCESSIBILITY
|
||||||
|
#include <qaccessible.h>
|
||||||
|
#endif
|
||||||
#include "private/qtextdocumentlayout_p.h"
|
#include "private/qtextdocumentlayout_p.h"
|
||||||
#include "qtextdocument.h"
|
#include "qtextdocument.h"
|
||||||
#include "private/qtextdocument_p.h"
|
#include "private/qtextdocument_p.h"
|
||||||
@ -154,7 +157,7 @@ void QTextEditPrivate::init(const QString &html)
|
|||||||
QObject::connect(control, SIGNAL(redoAvailable(bool)), q, SIGNAL(redoAvailable(bool)));
|
QObject::connect(control, SIGNAL(redoAvailable(bool)), q, SIGNAL(redoAvailable(bool)));
|
||||||
QObject::connect(control, SIGNAL(copyAvailable(bool)), q, SIGNAL(copyAvailable(bool)));
|
QObject::connect(control, SIGNAL(copyAvailable(bool)), q, SIGNAL(copyAvailable(bool)));
|
||||||
QObject::connect(control, SIGNAL(selectionChanged()), q, SIGNAL(selectionChanged()));
|
QObject::connect(control, SIGNAL(selectionChanged()), q, SIGNAL(selectionChanged()));
|
||||||
QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SIGNAL(cursorPositionChanged()));
|
QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SLOT(_q_cursorPositionChanged()));
|
||||||
|
|
||||||
QObject::connect(control, SIGNAL(textChanged()), q, SLOT(updateMicroFocus()));
|
QObject::connect(control, SIGNAL(textChanged()), q, SLOT(updateMicroFocus()));
|
||||||
|
|
||||||
@ -206,6 +209,16 @@ void QTextEditPrivate::_q_repaintContents(const QRectF &contentsRect)
|
|||||||
viewport->update(r);
|
viewport->update(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QTextEditPrivate::_q_cursorPositionChanged()
|
||||||
|
{
|
||||||
|
Q_Q(QTextEdit);
|
||||||
|
emit q->cursorPositionChanged();
|
||||||
|
#ifndef QT_NO_ACCESSIBILITY
|
||||||
|
QAccessibleTextCursorEvent event(q, q->textCursor().position());
|
||||||
|
QAccessible::updateAccessibility(&event);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void QTextEditPrivate::pageUpDown(QTextCursor::MoveOperation op, QTextCursor::MoveMode moveMode)
|
void QTextEditPrivate::pageUpDown(QTextCursor::MoveOperation op, QTextCursor::MoveMode moveMode)
|
||||||
{
|
{
|
||||||
QTextCursor cursor = control->textCursor();
|
QTextCursor cursor = control->textCursor();
|
||||||
|
@ -304,6 +304,7 @@ private:
|
|||||||
Q_PRIVATE_SLOT(d_func(), void _q_currentCharFormatChanged(const QTextCharFormat &))
|
Q_PRIVATE_SLOT(d_func(), void _q_currentCharFormatChanged(const QTextCharFormat &))
|
||||||
Q_PRIVATE_SLOT(d_func(), void _q_adjustScrollbars())
|
Q_PRIVATE_SLOT(d_func(), void _q_adjustScrollbars())
|
||||||
Q_PRIVATE_SLOT(d_func(), void _q_ensureVisible(const QRectF &))
|
Q_PRIVATE_SLOT(d_func(), void _q_ensureVisible(const QRectF &))
|
||||||
|
Q_PRIVATE_SLOT(d_func(), void _q_cursorPositionChanged())
|
||||||
friend class QTextEditControl;
|
friend class QTextEditControl;
|
||||||
friend class QTextDocument;
|
friend class QTextDocument;
|
||||||
friend class QWidgetTextControl;
|
friend class QWidgetTextControl;
|
||||||
|
@ -99,6 +99,7 @@ public:
|
|||||||
{ control->processEvent(e, QPointF(horizontalOffset(), verticalOffset()), viewport); }
|
{ control->processEvent(e, QPointF(horizontalOffset(), verticalOffset()), viewport); }
|
||||||
|
|
||||||
void _q_currentCharFormatChanged(const QTextCharFormat &format);
|
void _q_currentCharFormatChanged(const QTextCharFormat &format);
|
||||||
|
void _q_cursorPositionChanged();
|
||||||
|
|
||||||
void updateDefaultTextOption();
|
void updateDefaultTextOption();
|
||||||
|
|
||||||
|
@ -1583,6 +1583,8 @@ void tst_QAccessibility::textEditTest()
|
|||||||
edit.setTextCursor(c);
|
edit.setTextCursor(c);
|
||||||
QAccessibleTextSelectionEvent sel(&edit, 2, 4);
|
QAccessibleTextSelectionEvent sel(&edit, 2, 4);
|
||||||
QVERIFY_EVENT(&sel);
|
QVERIFY_EVENT(&sel);
|
||||||
|
QAccessibleTextCursorEvent cursor(&edit, 4);
|
||||||
|
QVERIFY_EVENT(&cursor);
|
||||||
|
|
||||||
edit.selectAll();
|
edit.selectAll();
|
||||||
int end = edit.textCursor().position();
|
int end = edit.textCursor().position();
|
||||||
|
Loading…
Reference in New Issue
Block a user