Are you sending the events to the correct recipient?
Cheers,
_
Are you sending the events to the correct recipient?
Cheers,
_
If I give sub menu handle then it sends event correctly but then in case if i have more than one sub menu its very difficult to identify which sub menu is currently open because all sub menu returns true for isVisible.
Thanks
Have you checked hasFocus()?
Cheers,
_
You are correct, hasFocus returns false.
Sending return key press event to menu, if menu item is submenu it opens sub menu but doesn't set focus. below is the code i used to simulate return key press.
Qt Code:
To copy to clipboard, switch view to plain text mode
But one more important point is once the sub menu is open, after that sending key event programmatically is not working but at the same time pressing arrow keys on keyboard changes the selection on sub menu.
Thank you for your useful tips but can you suggest me something to set focus on sub menu.
Thanks.
Interesting.
Normal keyboard handling requires focus, so if navigating the sub menu with the keyboard works it should have focus.
Anyway, if the focus can not be used to determine the currently open sub menu, then you'll have to decide based on which key you have sent.
Alternatively you could try sending the events to the application object and see if its overall key handling code moves focus through the menu hierarchy.
Cheers,
_
Bookmarks