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:
  1. QKeyEvent event(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier);
  2. QApplication::sendEvent(m_pSceneMenu, &event);
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.