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

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

      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

        1. patch.diff
          0.5 kB
          Andy Shaw (closed Nokia identity)
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes