I need to know if there is a way to close an opened QMenuBarItem in Qt.
I mean, if I Open a Menu, I want a QTimer to be able to close the QMenuBar after some time.
I am starting a QTimer when I click a menu (like "File"), and in the QTimer's timeout() slot I am using the next code:
menubar->actions()[0]->menu()->close();
Where menubar->actions()[0] is the "File" menu.
I have been searching without success and I really need to close the menu automatically.
I really appreciate your help and your time. Thanks in advance.
*****EDIT
You must use menubar.setActiveAction(NULL);
Try
QWidget::hide()instead ofQWidget::close().