0

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);

Angie Quijano
  • 4,167
  • 3
  • 25
  • 30
Hermandroid
  • 2,120
  • 4
  • 29
  • 35

1 Answers1

5

Try QWidget::hide() instead of QWidget::close().

Anthony
  • 8,570
  • 3
  • 38
  • 46