ContainmentInterface: Set transient parent of submenues
The actions added by plugins or applets can contain actions that are menues. This causes a problem for the panel because it doesn't take focus when right clicked. Since the menues had no transientParent, they were created as new toplevels. BUG:417378
This commit is contained in:
parent
2d5a492df6
commit
27299d1405
@ -992,6 +992,17 @@ void ContainmentInterface::mousePressEvent(QMouseEvent *event)
|
||||
|
||||
KAcceleratorManager::manage(desktopMenu);
|
||||
|
||||
for (auto action : desktopMenu->actions()) {
|
||||
if (action->menu()) {
|
||||
connect(action->menu(), &QMenu::aboutToShow, desktopMenu, [action, desktopMenu] {
|
||||
if (action->menu()->windowHandle()) {
|
||||
// Need to add the transient parent otherwise Qt will create a new toplevel
|
||||
action->menu()->windowHandle()->setTransientParent(desktopMenu->windowHandle());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
desktopMenu->popup(pos);
|
||||
event->setAccepted(true);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user