* 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
This commit is contained in:
Benoît Minisini 2009-07-07 10:07:36 +00:00
parent 075fbab8fc
commit d523cd1011

View file

@ -26,6 +26,7 @@
#include <QMenuBar>
#include <QMenu>
#include <QKeyEvent>
#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