From d523cd1011973ed780dd4c57433b2a18d0ec57bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Tue, 7 Jul 2009 10:07:36 +0000 Subject: [PATCH] [GB.QT4] * BUG: Workaround a little Qt bug in menu bars when one of its menus has been used as a popup. git-svn-id: svn://localhost/gambas/trunk@2085 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- gb.qt4/src/CMenu.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gb.qt4/src/CMenu.cpp b/gb.qt4/src/CMenu.cpp index d18845ab3..2bbf79df6 100644 --- a/gb.qt4/src/CMenu.cpp +++ b/gb.qt4/src/CMenu.cpp @@ -26,6 +26,7 @@ #include #include +#include #include "gambas.h" #include "gb_common.h" @@ -563,6 +564,8 @@ END_METHOD BEGIN_METHOD(CMENU_popup, GB_INTEGER x; GB_INTEGER y) bool disabled; + MyMainWindow *toplevel; + CWINDOW *window; if (THIS->menu && !THIS->exec) { @@ -583,7 +586,16 @@ BEGIN_METHOD(CMENU_popup, GB_INTEGER x; GB_INTEGER y) THIS->exec = false; update_accel_recursive(THIS); - //MAIN_process_events(); + + // Fix a QT little bug + toplevel = (MyMainWindow *)(THIS->toplevel); + window = ((CWINDOW *)CWidget::get(toplevel)); + if (window && window->menuBar) + { + window->menuBar->setFocus(); + QKeyEvent e(QEvent::KeyPress, Qt::Key_Escape, Qt::NoModifier); + qApp->sendEvent(window->menuBar, &e); + } } END_METHOD