In the slot which you connect to shortcut in some way (QAction, QShortcut, etc.), do the following:
menuBar->setActiveAction(fileMenu->menuAction());
Note, however, that it may not always work as you expect. On some platforms (at least on Mac OS), native menu bar is being used by default, and your file menu won't pop up in the right place. You could disable the use of native menu bar, but then your app will (obviously) not look native anymore (on those systems):
menuBar->setNativeMenuBar(false);