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

Clicking on the menu resets activeFocusItem on Windows

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4: Low P4: Low
    • None
    • 5.2.0, 5.3.0 RC1
    • Quick: Controls 1
    • None
    • - reproducible on Windows 7
      - not reproducible on OS X
    • macOS

      Clicking on the menu resets the activeFocusItem on Windows.

      In the example below it is possible to dispatch the menu command with the Return key, but impossible with the mouse. Alternatively, the Gallery example can be used to reproduce the issue by trying to copy/paste selected text via the menu.

      import QtQuick 2.2
      import QtQuick.Controls 1.1
      
      ApplicationWindow {
          id: window
          width: 200
          height: 200
      
          menuBar: MenuBar {
              Menu {
                  title: "Some menu"
      
                  MenuItem {
                      id: menuItem
      
                      text: "Some command"
                      shortcut: "Return"
                      enabled: window.activeFocusItem !== null
                      onTriggered: window.activeFocusItem.executeMenuCmd()
                  }
              }
          }
      
          Text {
              anchors.centerIn: parent
              focus: true
              text: "The menu item is " + (menuItem.enabled ? "enabled" : "disabled")
      
              function executeMenuCmd() { console.log("Menu command executed."); }
          }
      }
      

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

            srutledg Shawn Rutledge
            mlitauer Martin Litauer
            Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes