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

Triggering a checkable Action through mnemonics (& before letter) do not toggle its checked state

    XMLWordPrintable

Details

    • Windows

    Description

      Using mnemonics, one can trigger an action, or a menu item by pressing Alt+shortcut letter
      However, in the case of a checkable Action, the onTriggered handler is called, but the checked state remains the same.

      import QtQuick 2.11
      import QtQuick.Window 2.11
      import QtQuick.Controls 2.4
      
      ApplicationWindow {
          visible: true
      
          menuBar: MenuBar {
              Menu {
                  title: "&File"
      
                  MenuItem {
                      text: "&Checkable"
                      checked: true
                      onCheckedChanged: {
                          console.log("Checked changed:", checked)
                      }
                      onTriggered: {
                          console.log("Triggered:", checked)
                      }
                  }
      
                  Action {
                      text: "Checkable &Action"
                      checked: true
                      checkable: true
                      onCheckedChanged: {
                          console.log("Checked changed:", checked)
                      }
                      onTriggered: {
                          console.log("Triggered:", checked)
                      }
                  }
              }
          }
      
      }

      Attachments

        Issue Links

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

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              yoann Yoann Quenach de Quivillic
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes