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

QMenus cannot be directly clicked.



  • I'm writing a desktop app on Linux. The app has to have similar look and feel to an old BX Pro app written for IBM AIX. There is a menu at the top, with several menus at the top left, and the help menu is at the top right. I'm using menuBar()->addMenu(<File, Tools, View>); for each of the three left menus. I create a separate menuBar, set it as the corner widget (top right) and add the help menu to that bar. My problem is a sequence issue. I cannot click on the File menu directly. I have to click on the View menu, then slide across to the File menu. From there, I can select the item I want.

    I have methods for the creation of each QMenu and it's contents/submenus. Then I have a method to put each of the QMenus in the menubar. I cannot copy the code here, as it's on a classified system (DOD work). However, the text below should give you the idea (nothing classified):

    void <class>::createFileMenu() // others similar
    {
    fileMenu = new QMenu("&File");
    newCommMenu = fileMenu->addMenu("&New Comm");
    createNewCommMenu();
    loadAction = fileMenu->addAction("&Load");
    saveAction = fileMenu->addAction("&Save");
    exitAction = fileMenu->addAction("E&xit");
    }

    // Other menus created similarly

    void <class>::createMenuBars()
    {
    menuBar()->addMenu(fileMenu);
    menuBar()->addMenu(toolsMenu);
    menuBar()->addMenu(viewMenu);

     helpMenuBar = new QMenuBar(menuBar());
     helpMenuBar->addMenu(helpMenu);
     menuBar()->setCornerWidget(helpMenuBar);
    

    }

    The menu bar looks sort of like this, with F, T, V, and H being underscored:


    File Tools View Help


    I can successfully click on View or Help, but to get to Tool or File, I have to click on View and slide across to
    the menu I want. I can directly access File or Tools with <alt>F or <alt>T.

    I'm fairly new to QT, so any help appreciated. Thanks in advance.
    Eric



  • @Eric_Lund

    OK, the help menu should have been out to the far right. It was when I typed it. :-)


Log in to reply