Results 1 to 5 of 5

Thread: accelerator key not working

  1. #1
    Join Date
    Sep 2009
    Posts
    9
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Question accelerator key not working

    First of all, let me list my configuration:

    Qt 4.4.0
    Qt Visual Studio Integration 1.4.0
    Visual Studio Standard 2005 sp1

    I have tried to add some accelerator key to the QAction of the main menu with the Qt VS Integration. The code generated as the following:
    Qt Code:
    1. class Ui_AClass
    2. {
    3. public:
    4. QAction *mpActionShowOutput;
    5. ...
    6. mpActionShowOutput = new QAction(iGS_LCClass);
    7. mpActionShowOutput->setObjectName(QString::fromUtf8("mpActionShowOutput"));
    8. ...
    9. mpActionShowOutput->setText(QApplication::translate("iGS_LCClass", "Show &Output", 0, QApplication::UnicodeUTF8));
    10. mpActionShowOutput->setIconText(QApplication::translate("iGS_LCClass", "Show &Output", 0, QApplication::UnicodeUTF8));
    11. ...
    12. };
    To copy to clipboard, switch view to plain text mode 

    Neither the "O" in "Show Output" menu item being underlined; nor the accelerator key works as expected. Could experts point out what did I go wrong?

    Thanks a ton!

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: accelerator key not working

    Quote Originally Posted by jan View Post
    Neither the "O" in "Show Output" menu item being underlined;
    Hold the alt key to have accelerators underlined.

    nor the accelerator key works as expected.
    Did you connect a slot to the action's triggered() signal? Is the action added to the current context (i.e. window)?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Sep 2009
    Posts
    9
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Lightbulb Re: accelerator key not working

    Quote Originally Posted by wysota View Post
    Hold the alt key to have accelerators underlined.



    Did you connect a slot to the action's triggered() signal? Is the action added to the current context (i.e. window)?

    Thanks for your reply! I have finally got it! Sorry for I have overlooked the problem!
    Coming from Windows environment, the underline is always shown on native widgets created by MFC/ALT/WinForm under menu no matter the menu shown is triggered by mouse-click or keyboard. Therefore I have never thought of the fact that the menu is rendered differently while triggered by keyboard.

    Thanks for your enlightenment!

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: accelerator key not working

    Quote Originally Posted by jan View Post
    Coming from Windows environment, the underline is always shown on native widgets created by MFC/ALT/WinForm under menu no matter the menu shown is triggered by mouse-click or keyboard.
    Actually Qt follows platform policies. And it is a platform policy (that can be changed in system settings) on modern Windows installations to show accelerators only when alt is pressed. Legacy apps such as ones from MFC simply do not follow that policy.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. The following user says thank you to wysota for this useful post:

    jan (2nd October 2009)

  6. #5
    Join Date
    Sep 2009
    Posts
    9
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Smile Re: accelerator key not working

    Quote Originally Posted by wysota View Post
    Actually Qt follows platform policies. And it is a platform policy (that can be changed in system settings) on modern Windows installations to show accelerators only when alt is pressed. Legacy apps such as ones from MFC simply do not follow that policy.
    Thanks for enlighten me. MS Visio 2007 shows underline. VS2005 shows no underline. The behavior of Microsoft products are pretty inconsistent. I had never noticed that before reading your reply.

Similar Threads

  1. Qt+QWebKit+Java+Flash not working
    By progDes in forum Qt Programming
    Replies: 2
    Last Post: 30th April 2009, 16:49
  2. QResource Stopped Working
    By JPNaude in forum Qt Programming
    Replies: 0
    Last Post: 22nd October 2008, 12:26
  3. QDevelop and CTags -> Not working
    By philwinder in forum Qt-based Software
    Replies: 13
    Last Post: 9th May 2008, 21:40
  4. Don't want QTextBrowser to look in working directory
    By magland in forum Qt Programming
    Replies: 1
    Last Post: 20th October 2007, 23:14
  5. GUI thread and Working thread comunication
    By FasTTo in forum Qt Programming
    Replies: 2
    Last Post: 13th September 2007, 15:31

Tags for this Thread

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.