summaryrefslogtreecommitdiffstats
path: root/src/widgets/accessible
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-06-25 15:27:56 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-08-13 09:07:04 +0200
commitfc931e5595fb63bf1b2f08460046b18f08e20a85 (patch)
tree7f51c0c283184d49712b21cde2ada38b15631746 /src/widgets/accessible
parent135a2868443a1d9962dece52034db475f3e75036 (diff)
Accessibility: Fix boundaries for text functions in QLineEdit
Make the functions work consistently. For example asking for the line at the cursor position when the cursor was at the end returned an empty line before. Task-number: QTBUG-38500 Change-Id: I60fc78c7be129a59c83efcfce6d8fdd16f2c3f65 Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
Diffstat (limited to 'src/widgets/accessible')
-rw-r--r--src/widgets/accessible/simplewidgets.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/widgets/accessible/simplewidgets.cpp b/src/widgets/accessible/simplewidgets.cpp
index 88d3981391..6fd249f372 100644
--- a/src/widgets/accessible/simplewidgets.cpp
+++ b/src/widgets/accessible/simplewidgets.cpp
@@ -752,6 +752,10 @@ QString QAccessibleLineEdit::textBeforeOffset(int offset, QAccessible::TextBound
*startOffset = *endOffset = -1;
return QString();
}
+ if (offset == -1)
+ offset = lineEdit()->text().length();
+ if (offset == -2)
+ offset = cursorPosition();
return QAccessibleTextInterface::textBeforeOffset(offset, boundaryType, startOffset, endOffset);
}
@@ -762,6 +766,10 @@ QString QAccessibleLineEdit::textAfterOffset(int offset, QAccessible::TextBounda
*startOffset = *endOffset = -1;
return QString();
}
+ if (offset == -1)
+ offset = lineEdit()->text().length();
+ if (offset == -2)
+ offset = cursorPosition();
return QAccessibleTextInterface::textAfterOffset(offset, boundaryType, startOffset, endOffset);
}
@@ -772,6 +780,10 @@ QString QAccessibleLineEdit::textAtOffset(int offset, QAccessible::TextBoundaryT
*startOffset = *endOffset = -1;
return QString();
}
+ if (offset == -1)
+ offset = lineEdit()->text().length();
+ if (offset == -2)
+ offset = cursorPosition();
return QAccessibleTextInterface::textAtOffset(offset, boundaryType, startOffset, endOffset);
}