0

I'm developing a gui application with Qt 4.6.3 on Windows platform.In the app, Qmenu has a submenu and after ı clicked this submenu's QAction the main menu is disappearing.For preventing this, ı used something like this.

connect(submenu,SIGNAL(triggered()),mainMenu,SLOT(show()));

But this time, main menu doesn't disappear if ı click desktop or anywhere outside the menu.

How can ı solve this problem?

ACrescendo
  • 46
  • 10
  • 1
    You have to explicitly call `hide()`. `QMenu` is typically opened by calling [`QMenu::exec()`](http://doc.qt.io/qt-4.8/qmenu.html#exec). Note that menus automatically close when an action in the menu or a submenu is clicked, so you're actually just re-opening the menu. There is no property or setting to prevent this, as Qt is simply following platform styles. – jonspaceharper Jun 22 '16 at 08:43
  • 1
    You may try to install an event filter on `QMenu` and it's children `QMenu`'s to prevent hiding. Better way how to do it - research current `QMenu` source code. – Dmitry Sazonov Jun 22 '16 at 08:43
  • still same issue... – ACrescendo Jun 22 '16 at 11:34

0 Answers0