Results 1 to 4 of 4

Thread: Accessible menus

  1. #1
    Join Date
    Aug 2009
    Posts
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Accessible menus

    Hi all,

    I'm struggling to make a menu accessible as the QMenu::addAction() generates a QAction object based on QObject that does not have the accessibility options.

    I understand that there is a QAccessibleObject, but I have no idea how to create a QAction based on it.

    Without using the setAccessibleName() function, there is no way for my Qt app to pass information to my screen reader; so my menu is completely silent.

    Does anyone know how to do this?

    Regards,

    NickPoole

  2. #2
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Accessible menus

    You can use:
    Qt Code:
    1. QMetaObject * QObject::metaObject ()
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Aug 2009
    Posts
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Accessible menus

    Thank for the pointer yogeshgokul, but I'm not quite sure how to use QMetaObject in this case.

    Here's a snippet that I'm trying to convert:

    Qt Code:
    1. MenuButton = new QPushButton(this);
    2. QMenu* MenuButtonPopup = new QMenu(MenuButton);
    3. MenuButton->setMenu(MenuButtonPopup);
    4. MenuButtonPopup->addAction( tr( "An item" ), this, SLOT(Clicked()))->setAccessibleName( tr( "An Item" ) );
    To copy to clipboard, switch view to plain text mode 

    Unsuprisingly this fails to compile with:
    'setAccessibleName' : is not a member of 'QAction'

    Is there a way to get QAction to inherit the setAccessibleName() function, or do I have to reimplement both QMenu and QAction?

  4. #4
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Accessible menus

    Quote Originally Posted by NickPoole View Post
    Unsuprisingly this fails to compile with:
    'setAccessibleName' : is not a member of 'QAction'
    Yes, this is clear, this is not a member. You can create a new property in designer and set it, access it in code.

Similar Threads

  1. Missing text in menus etc.
    By New2QT in forum Qt Tools
    Replies: 9
    Last Post: 18th December 2008, 00:51
  2. Replies: 2
    Last Post: 27th June 2008, 19:02
  3. Maya Style Right Click Menus in Qt
    By dvmorris in forum Qt Programming
    Replies: 1
    Last Post: 13th April 2007, 11:55
  4. transparent menus
    By nupul in forum Qt Programming
    Replies: 1
    Last Post: 17th April 2006, 16:05
  5. Why are actions limited to menus and toolbars?
    By Paul Drummond in forum Qt Programming
    Replies: 16
    Last Post: 3rd March 2006, 12:05

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.