Workaround that opens the popup menus at the expected place.

[GB.QT5]
* BUG: Workaround that opens the popup menus at the expected place.
This commit is contained in:
Benoît Minisini 2020-07-15 02:53:09 +02:00
parent 7d63a282f8
commit 5abdab140d

View file

@ -27,6 +27,7 @@
#include <QMenu>
#include <QKeyEvent>
#include <QActionGroup>
#include <QWindow>
#include "gambas.h"
#include "gb_common.h"
@ -1030,6 +1031,19 @@ void CMenu::slotShown(void)
GET_MENU_SENDER(menu);
HANDLE_PROXY(menu);
#ifdef QT5
if (menu->menu->windowHandle())
{
QWidget *parent = qApp->activePopupWidget();
if (!parent) parent = qApp->activeWindow();
if (parent)
{
//fprintf(stderr, "set menu transient to %p\n", parent->windowHandle());
menu->menu->windowHandle()->setTransientParent(parent->windowHandle());
}
}
#endif
GB.Ref(menu);
menu->opened = TRUE;