Open
Accessibility: Add screen reader support to the editor via QAccessibleTextInterface#4557
Conversation
Implement QAccessibleInterface + QAccessibleTextInterface for QEditor
so that NVDA, JAWS, Narrator and other screen readers can access the
editor content via the platform accessibility APIs.
Changes:
- New qeditoraccessible.h/cpp: QEditorAccessible class implementing
QAccessibleWidget + QAccessibleTextInterface
* role() returns QAccessible::EditableText
* state() reflects read-only and selection state
* text(QAccessible::Value) returns full document text
* Full QAccessibleTextInterface: text(), cursorPosition(),
selection(), characterCount(), characterRect(), offsetAtPoint(),
textAtOffset/Before/After(), scrollToSubstring(), attributes()
* Offset helpers: line+column <-> absolute char offset
* Factory function registered via QAccessible::installFactory()
- qeditor.cpp:
* Include qeditoraccessible.h and QAccessible
* Call QAccessible::installFactory in init()
* Add documentOffsetFromPosition() helper
* Fire QAccessibleTextCursorEvent in emitCursorPositionChanged()
* Fire QAccessible::ValueChanged event in updateContent()
- qeditor.h: declare documentOffsetFromPosition()
- CMakeLists.txt: add new source/header files
Closes #4556
- Remove unused viewportPos variable from characterRect() - Clarify attributes() run-expansion logic for punctuation characters - Remove unnecessary queryAccessibleInterface() call before firing cursor event
Copilot
AI
changed the title
[WIP] Improve NVDA and screen reader support in the editor
Accessibility: Add screen reader support to the editor via QAccessibleTextInterface
Jul 17, 2026
Member
|
@copilot fix compilation error |
…tBeforeOffset/textAfterOffset
Contributor
Author
Fixed in the latest commit. The methods were named |
sunderme
marked this pull request as ready for review
July 19, 2026 16:42
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Blind and low-vision users could not use TeXstudio's editor with screen readers (NVDA, JAWS, Narrator) because the custom
QEditorwidget—based onQAbstractScrollAreawith custom painting—exposed no accessibility tree, so AT tools had no way to read text content, track the caret, or detect changes.New:
QEditorAccessible(qeditoraccessible.h/.cpp)Implements
QAccessibleWidget+QAccessibleTextInterfaceforQEditor, wiring the editor into Qt's platform accessibility bridge (IAccessible2 on Windows):EditableText, reflectsreadOnlyand selection stateQAccessible::Valuereturns the full document text;text(start, end)supports range queriescursorPosition(),setCursorPosition(),selection(),setSelection()— all convert between(line, column)and absolute offsets using\n-separated line countingtextAtOffset/Before/After()withChar/Word/Line/Sentence/Paragraphboundary types viaQTextBoundaryFindercharacterRect(offset)maps document coordinates to screen-space;offsetAtPoint()does the reverseQEditorAccessible::factory()registered withQAccessible::installFactory()— Qt's bridge calls this to instantiate the interface on demandModified:
qeditor.cpp/.hdocumentOffsetFromPosition(line, col)— converts(line, column)to absolute offset (used by both the accessible interface and event firing)emitCursorPositionChanged()firesQAccessibleTextCursorEventwith the current absolute offset when the caret movesupdateContent()firesQAccessible::ValueChangedwhen document content changesQEditor::init(); events guarded byQAccessible::isActive()to avoid overhead when no AT is running