Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to make menu shortcuts to be visible all the time?



  • Hello.
    Menu shortcuts are hidden until I press 'alt' key. I want them to be visible before I press 'alt' key too.

    Simple sample code (I run it in Windows 8.1 with Qt 5.4.1):

    #include <QApplication>
    #include <QMainWindow>
    #include <QMenuBar>
    #include <QMenu>
    
    int main(int argc, char *argv[])
    {
        QApplication a(argc, argv);
    
        QMenu m1("File(&F)");
        QMenu m2("Edit(&E)");
        QMenu m3("Help(&H)");
    
        m1.addAction("close");
        m2.addAction("copy" );
        m3.addAction("about");
    
        QMainWindow mw;
        mw.menuBar()->addMenu(&m1);
        mw.menuBar()->addMenu(&m2);
        mw.menuBar()->addMenu(&m3);
    
        mw.setMinimumWidth(400);
        mw.show();
    
        return a.exec();
    }


  • Hi,

    this is a Windows policy not related to Qt.
    But IIRC there is a settings in Windows that make shortcuts always visible (sorry now I'm on a Mac and I cannot check).



  • FOUND

    Control Panel -> Ease of Access Center -> Make the keyboard easier to use -> Underline keyboard shortcuts and access keys



  • @mcosta
    Thanks, this works.
    But I still think this is related to Qt too. I tried the same code with earlier version of Qt (5.2.1). This time the program works as I expect (always shows menu shortcuts).



  • Hi,

    at the moment I can't try because I have no Windows machine available.

    I have only doubts that is related to Qt.
    Have rebuilt the same code with a different version of Qt?

    Running both versions of the application on the same machine shows you different results??



  • @mcosta

    "Have rebuilt the same code with a different version of Qt?" - yes, I did it
    "Running both versions of the application on the same machine shows you different results??" - yes
    I guess something has changed in Qt sources since version 5.3 or 5.4.

    I hope this thing (to show menu shortcuts) is tweakable via Qt API.


Log in to reply