diff options
author | Frederik Gladhorn <frederik.gladhorn@nokia.com> | 2011-04-26 16:41:15 (GMT) |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@nokia.com> | 2011-04-27 13:40:16 (GMT) |
commit | d8b933084ecc6ded6689f71ea6ca2e5fd339faf3 (patch) | |
tree | ed1640fc9413dafe3e6b5927c14a9847d46f3833 /src/gui | |
parent | c3ebd1d38826739cb989e65770d2a22b9a39dcc4 (diff) | |
download | Qt-d8b933084ecc6ded6689f71ea6ca2e5fd339faf3.zip Qt-d8b933084ecc6ded6689f71ea6ca2e5fd339faf3.tar.gz Qt-d8b933084ecc6ded6689f71ea6ca2e5fd339faf3.tar.bz2 |
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
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/accessible/qaccessible.h | 4 | ||||
-rw-r--r-- | src/gui/widgets/qlinecontrol.cpp | 10 | ||||
-rw-r--r-- | src/gui/widgets/qlinecontrol_p.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/qlineedit_p.cpp | 1 | ||||
-rw-r--r-- | src/gui/widgets/qlineedit_p.h | 1 |
5 files changed, 13 insertions, 5 deletions
diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h index 871ca58..1e9e55e 100644 --- a/src/gui/accessible/qaccessible.h +++ b/src/gui/accessible/qaccessible.h @@ -111,8 +111,8 @@ public: TableSummaryChanged, TextAttributeChanged, TextCaretMoved, - TextChanged, - TextColumnChanged, + // TextChanged, deprecated, use TextUpdated + TextColumnChanged = TextCaretMoved + 2, TextInserted, TextRemoved, TextUpdated, diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index 3eac64a..fa41c29 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -643,7 +643,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 } @@ -1230,6 +1235,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 } } diff --git a/src/gui/widgets/qlinecontrol_p.h b/src/gui/widgets/qlinecontrol_p.h index 3c505c8..7f3cad6 100644 --- a/src/gui/widgets/qlinecontrol_p.h +++ b/src/gui/widgets/qlinecontrol_p.h @@ -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 diff --git a/src/gui/widgets/qlineedit_p.cpp b/src/gui/widgets/qlineedit_p.cpp index 23ac613..03716d4 100644 --- a/src/gui/widgets/qlineedit_p.cpp +++ b/src/gui/widgets/qlineedit_p.cpp @@ -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))); diff --git a/src/gui/widgets/qlineedit_p.h b/src/gui/widgets/qlineedit_p.h index 32f6077..3169776 100644 --- a/src/gui/widgets/qlineedit_p.h +++ b/src/gui/widgets/qlineedit_p.h @@ -84,7 +84,6 @@ public: ~QLineEditPrivate() { - delete control; } QLineControl *control; |