summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@nokia.com>2011-07-05 15:05:11 (GMT)
committerFrederik Gladhorn <frederik.gladhorn@nokia.com>2011-07-06 11:02:30 (GMT)
commitc1ec1a95806cda54d5b4e9f8ed159a611bd75964 (patch)
tree4dde0f017da4bbc5c30ae3e297d78dfcfaac8856 /src/plugins
parent43e116ea63ffd96d945fbaabeafb2374e5f18e9e (diff)
downloadQt-c1ec1a95806cda54d5b4e9f8ed159a611bd75964.zip
Qt-c1ec1a95806cda54d5b4e9f8ed159a611bd75964.tar.gz
Qt-c1ec1a95806cda54d5b4e9f8ed159a611bd75964.tar.bz2
Implement text interface for QLineEdit.
Add boundary helper functions to the QAccessibleTextInterface. Move LineEdit over to use QTextBoundaryFinder. Reviewed-by: Jan-Arve
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/accessible/widgets/simplewidgets.cpp40
1 files changed, 28 insertions, 12 deletions
diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp
index ad56cbd..4f469e5 100644
--- a/src/plugins/accessible/widgets/simplewidgets.cpp
+++ b/src/plugins/accessible/widgets/simplewidgets.cpp
@@ -68,6 +68,13 @@ extern QList<QWidget*> childWidgets(const QWidget *widget, bool includeTopLevel
QString Q_GUI_EXPORT qt_accStripAmp(const QString &text);
QString Q_GUI_EXPORT qt_accHotKey(const QString &text);
+QString Q_GUI_EXPORT textBeforeOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType,
+ int *startOffset, int *endOffset, const QString& text);
+QString Q_GUI_EXPORT textAtOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType,
+ int *startOffset, int *endOffset, const QString& text);
+QString Q_GUI_EXPORT textAfterOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType,
+ int *startOffset, int *endOffset, const QString& text);
+
/*!
\class QAccessibleButton
\brief The QAccessibleButton class implements the QAccessibleInterface for button type widgets.
@@ -815,25 +822,34 @@ QString QAccessibleLineEdit::text(int startOffset, int endOffset)
return lineEdit()->text().mid(startOffset, endOffset - startOffset);
}
-QString QAccessibleLineEdit::textBeforeOffset (int /*offset*/, BoundaryType /*boundaryType*/,
- int * /*startOffset*/, int * /*endOffset*/)
+QString QAccessibleLineEdit::textBeforeOffset(int offset, BoundaryType boundaryType,
+ int *startOffset, int *endOffset)
{
- // TODO
- return QString();
+ if (lineEdit()->echoMode() != QLineEdit::Normal) {
+ *startOffset = *endOffset = -1;
+ return QString();
+ }
+ return textBeforeOffsetFromString(offset, boundaryType, startOffset, endOffset, lineEdit()->text());
}
-QString QAccessibleLineEdit::textAfterOffset(int /*offset*/, BoundaryType /*boundaryType*/,
- int * /*startOffset*/, int * /*endOffset*/)
+QString QAccessibleLineEdit::textAfterOffset(int offset, BoundaryType boundaryType,
+ int *startOffset, int *endOffset)
{
- // TODO
- return QString();
+ if (lineEdit()->echoMode() != QLineEdit::Normal) {
+ *startOffset = *endOffset = -1;
+ return QString();
+ }
+ return textAfterOffsetFromString(offset, boundaryType, startOffset, endOffset, lineEdit()->text());
}
-QString QAccessibleLineEdit::textAtOffset(int /*offset*/, BoundaryType /*boundaryType*/,
- int * /*startOffset*/, int * /*endOffset*/)
+QString QAccessibleLineEdit::textAtOffset(int offset, BoundaryType boundaryType,
+ int *startOffset, int *endOffset)
{
- // TODO
- return QString();
+ if (lineEdit()->echoMode() != QLineEdit::Normal) {
+ *startOffset = *endOffset = -1;
+ return QString();
+ }
+ return textAtOffsetFromString(offset, boundaryType, startOffset, endOffset, lineEdit()->text());
}
void QAccessibleLineEdit::removeSelection(int selectionIndex)