[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
This commit is contained in:
parent
075fbab8fc
commit
d523cd1011
1 changed files with 13 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue