-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.11.0 FF
-
None
-
Debian testing, qtbase self-compiled from git dev as of 897034bc9361ae776de9dfb615af24daffaf3778
The QAccessibleText::getTextAfterOffset implementation used for QTextEdit and the QML TextEdit is incorrect.
For example, when trying to retrieve the next word that is fully after a specific index, the implementation currently (sometimes) return the word which includes that index instead (which is what QAccessibleText::getTextAtOffset should be doing).
A similar problem exists for the for the QAccessibleText::getTextBeforeOffset implementation used by these text edits.
Sample steps to reproduce, using the corresponding methods of the AT-SPI2 Text interface on Linux:
- Build and run this sample program
#include <QApplication> #include <QLineEdit> #include <QMainWindow> #include <QTextEdit> #include <QVBoxLayout> int main(int argc, char* argv[]) { QApplication a(argc, argv); QMainWindow w; QWidget* widget = new QWidget; w.setCentralWidget(widget); QVBoxLayout* layout = new QVBoxLayout(widget); layout->addWidget(new QLineEdit("Hello world")); layout->addWidget(new QTextEdit("Hello world")); w.show(); return a.exec(); }
- start Accerciser Accessibility Explorer ( https://gitlab.gnome.org/GNOME/accerciser )
- in Accerciser's treeview of the sample program's a11y hierarchy, select the object for the QTextEdit
- in Accerciser's IPython console, try to get some words after given indices
In [43]: acc.queryText().getTextAfterOffset(2, 1) Out[43]: ('Hello', 0, 5) In [44]: acc.queryText().getTextAfterOffset(7, 1) Out[44]: ('world', 6, 11)
Actual result:
The returned words are not actually after the given offset.
Expected result:
Words actually completely after the given offset should be returned, or an empty string if there is no other word completely after the given offset.
The implementation used for the QLineEdit handles this correctly, as can be seen by selecting its a11y object in step 3 instead. Then, repeating step 4 gives this:
In [45]: acc.queryText().getTextAfterOffset(2, 1)
Out[45]: (' ', 5, 6)
In [46]: acc.queryText().getTextAfterOffset(7, 1)
Out[46]: ('', -1, -1)
(Whether the space character itself should be reported as a word or "hello" should be returned for acc.queryText().getTextAfterOffset(2, 1) is not matter of this ticket.)
For Gerrit Dashboard: QTBUG-140504 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
679126,1 | a11y: Simplify/Deduplicate qAccessibleTextBoundaryHelper | dev | qt/qtbase | Status: NEW | 0 | 0 |
679127,1 | a11y: Extract helpers for getting text at/before/after offset | dev | qt/qtbase | Status: NEW | 0 | 0 |
679128,1 | a11y: Fix cursor-based text{Before,After}Offset | dev | qt/qtbase | Status: NEW | 0 | 0 |
679341,1 | a11y: Use existing helpers to implement cursor-based text methods | dev | qt/qtdeclarative | Status: NEW | 0 | 0 |