Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-9202

QMenu: When showing a menu via the keyboard and the first selected action is a submenu then pressing the accel for the submenu should open it

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 4.7.0
    • 4.6.2
    • Widgets: Main Window
    • None

    Description

      QMenu: When showing a menu via the keyboard and the first selected action is a submenu then pressing the accel for the submenu should open it. However it does nothing. This is different to native behaviour on Windows at least.

      The following is a patch to the menus example that reproduces this problem when pressing ALT+E followed by F

      --- a/examples/mainwindows/menus/mainwindow.cpp
      +++ b/examples/mainwindows/menus/mainwindow.cpp
      @@ -342,6 +342,8 @@ void MainWindow::createMenus()
           fileMenu->addAction(exitAct);
      
           editMenu = menuBar()->addMenu(tr("&Edit"));
      +    formatMenu = editMenu->addMenu(tr("&Format"));
      +
           editMenu->addAction(undoAct);
           editMenu->addAction(redoAct);
           editMenu->addSeparator();
      @@ -356,7 +358,6 @@ void MainWindow::createMenus()
       //! [8]
      
       //! [12]
      -    formatMenu = editMenu->addMenu(tr("&Format"));
           formatMenu->addAction(boldAct);
           formatMenu->addAction(italicAct);
           formatMenu->addSeparator()->setText(tr("Alignment"));
      

      Attached is a patch that appears to solve the problem, but has not been fully tested

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            anshaw Andy Shaw (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes