Accessibility for QAction contained in QMenu

  • Hello everyone!

    Can anyone help me with the following problem?
    I'm trying to make the screen-reader tell also the shortcut assigned to a QAction object contained in a QMenu, not only it's name. For example: insted of "Open" i want the screen reader to say "Open Ctrl+O". As far as I can tell the screen-reader only sees QAction::text(), but I cannot add there the string for the shortcut.

    I have to mention: I'm using Qt 5.2.1 and the screen reader is NVDA.
    Thank you!
    Andrei Tuicu

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Maybe a silly question but did you use setText ?

  • Hello and thank you for your reply! :)

    Unfortunatelly, if things were that simple I wouldn't need to ask the question here. :( It's true that I can use the setText method, but then I would duplicate the text for shortcut, like this:

    The string for the shortcut from the right side of the menu is from adding it using the setShortcut method and this is the string that I would like the screen-reader to tell. The string from the left is from using the setText method and concatenating the name of the option with it's shortcut.

    I was asking if there is another property that I can set or a workaround in order to get the results that I want. For example I can do this easily for QMenu. I can use the setAccessibilityName method to add the text "File" and use the setAccessbilityDesc to add the text "Alt+F" and the screen-reader will tell me "File menu Alt+F".

    I found the property setWhatsThis, which will display a string I think in the statusBar, although I'm not sure if it is the statusBar or it just overlaps, but the screen reader dosen't see this string either.

    Thank you!

  • Lifetime Qt Champion

    I see what you mean and I'm wondering if it could be considered as a bug or missing feature for QAction.

    You should check the "bug report system": to see if it's something already mentioned.

    Asking on the interest mailing list about it could also be a good idea. You'll found there Qt's developers/maintainers (this forum is more user oriented)

  • I was beginning to wonder the same thing, since I'm working at this already for a week and I've tried setting every property of QAction in every combination that made sense. I thought that maybe it was something that I didn't know, because I'm quite new to Qt. I've seen this feature at VLC, but they might be using a custom plugin for accessibility.

    Thank you for your advice, I will post a bug report on the issue tracker and see what will developers tell me. :)

  • Lifetime Qt Champion

    Please, also post the link to the report here so other can find it :)

  • Sure, here it is. :)

    I also got the same answer on another forum, here is a link (I hope it's ok to post this here, if not please let me know and I will remove it):

  • Lifetime Qt Champion

    Thanks for sharing !

    No, nothing wrong with that, gathering information from other good places isn't a crime ;)

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.