summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@nokia.com>2011-04-26 18:41:15 +0200
committerThierry Bastian <thierry.bastian@nokia.com>2011-05-12 15:59:33 +0200
commit38ed8c2dddfe55c4a940adb534fa41ecae02af69 (patch)
tree234ad13c153be1b2548d88edfca00d2a7215f445 /src
parent1625b25a9f172254c9121a66df9f9e9acaaf89fd (diff)
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')
-rw-r--r--src/gui/accessible/qaccessible.h4
-rw-r--r--src/gui/widgets/qlinecontrol.cpp10
-rw-r--r--src/gui/widgets/qlinecontrol_p.h2
-rw-r--r--src/gui/widgets/qlineedit_p.cpp1
-rw-r--r--src/gui/widgets/qlineedit_p.h1
5 files changed, 13 insertions, 5 deletions
diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h
index 871ca58995..1e9e55e16f 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 40ebb65d0a..2a15555b89 100644
--- a/src/gui/widgets/qlinecontrol.cpp
+++ b/src/gui/widgets/qlinecontrol.cpp
@@ -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
}
}
diff --git a/src/gui/widgets/qlinecontrol_p.h b/src/gui/widgets/qlinecontrol_p.h
index 6918b83b90..9764ba9c59 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 23ac61384f..03716d4c66 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 32f6077438..31697764e9 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;