[Accessibility] Making QTableViews/QTableWidgets accessible

Lihao Huang huang_lihao at me.com
Sun Dec 16 14:47:56 CET 2018

Hi there,
This is my first time posting to a mailing list, so my bad if my etiquette is terrible. Please call me out on it. 
I’m a low vision developer and have been messing around with Qt5.12 for about a week now. I’m trying to build a simple To Do desktop app that lists a bunch of tasks that need to be done in a table. Seemed simple enough. 

Following the Qt Address Book example, I tried using a custom QAbstractTableModel and QTableView class to hold my data. But no matter how many rows of QStrings I insert into the Model, OSX’s Screen Reader (Voiceover) still thinks the table is empty and I’m unable to interact with any of the added rows or cells. When I ask a friend to click on the rows, they get highlighted and selected, but still the screen reader doesn’t read anything out. I tried reimplementing the functionality with a QTableWidget, but it’s the exact same problem. 

I thought that the inserted rows didn’t have an accessible interface,   so I tried creating my own custom QTableWidgetItem that also implements the QAccessibleCellInterface. But even after inserting those into the QWidgetTable and implementing the QAccessibleTableCellInterface as best I can, the Screen Reader still thinks the table is empty even though there are 10 rows inserted into the QTableWidget.

Do I actually need to subclass QTableWidget and implement the QAccessibleTableInterface for this to work? I thought the documentation said that all Qt widgets were accessible out of the box?

What I’d like to achieve is to have a table that allows me to use a Screen Reader to navigate through the rows and read out the contents of that table row as it gets accessibility focused/selected. Similarly, using the arrow keys should change the current selection of the table and read out the current highlighted selected row. I appreciate any sample code or direction to make Qt tables accessible and perform the above functionality. I apologize if this is a noob or stupid question, but I’ve been going through as much documentation and code as I can, but no dice. 

Thanks all. 




More information about the Accessibility mailing list