MenuBar Alt-key problem



  • Hey!

    I have a MenuBar containing some Menu Elements. In each Menu element you have some MenuItem elements.
    The weird thing is that when I am using my program, and press the Alt-key, I guess to focus is automatic set to the first Menu item in the menu bar, becuase if I use Key-up or Key-down the Menu item opens. But when it is open, you cant do anything more, the key-up and key-down are not doing anything more. Neither is the tab button. To continue using my program I need to use the mouse and click outside of the Menu.

    I want to disable the Alt-key so that it does not behave like this.

    Any tips?



  • Override the keyPressEvent and do not pass it through.



  • I cant get that to work? How would you do it? I tried

    @
    Keys.onPressed: {
    if(event.key === Qt.Key_Alt){
    console.log("Alt pressed");
    }
    }
    @

    but it still moves the focus to the menu bar..



  • in addition to printing out "Alt pressed", so it does both...


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.