set transientparent for menus
Summary: set transient parent for popup menus created by appletinterface/ containmentinterface, it makes them appear at the proper coordinates Test Plan: containment menus appear where the mouse was pressed Reviewers: #plasma, davidedmundson Reviewed By: #plasma, davidedmundson Subscribers: davidedmundson, plasma-devel, #frameworks Tags: #plasma, #frameworks Differential Revision: https://phabricator.kde.org/D5918
This commit is contained in:
parent
f28ba7cba6
commit
5ba1bed582
@ -825,6 +825,9 @@ bool AppletInterface::eventFilter(QObject *watched, QEvent *event)
|
||||
}
|
||||
|
||||
QMenu *desktopMenu = new QMenu;
|
||||
if (desktopMenu->winId()) {
|
||||
desktopMenu->windowHandle()->setTransientParent(window());
|
||||
}
|
||||
emit applet()->contextualActionsAboutToShow();
|
||||
ci->addAppletActions(desktopMenu, applet(), event);
|
||||
|
||||
|
@ -481,6 +481,9 @@ void ContainmentInterface::processMimeData(QMimeData *mimeData, int x, int y, KI
|
||||
m_dropJobs[job] = dropJob;
|
||||
} else {
|
||||
QMenu *choices = new QMenu(i18n("Content dropped"));
|
||||
if (choices->winId()) {
|
||||
choices->windowHandle()->setTransientParent(window());
|
||||
}
|
||||
choices->addAction(QIcon::fromTheme(QStringLiteral("process-working")), i18n("Fetching file type..."));
|
||||
choices->popup(window() ? window()->mapToGlobal(QPoint(x, y)) : QPoint(x, y));
|
||||
|
||||
@ -521,6 +524,9 @@ void ContainmentInterface::processMimeData(QMimeData *mimeData, int x, int y, KI
|
||||
QMenu *choices = nullptr;
|
||||
if (!dropJob) {
|
||||
choices = new QMenu();
|
||||
if (choices->winId()) {
|
||||
choices->windowHandle()->setTransientParent(window());
|
||||
}
|
||||
}
|
||||
QList<QAction *> extraActions;
|
||||
QHash<QAction *, QString> actionsToPlugins;
|
||||
@ -999,6 +1005,9 @@ void ContainmentInterface::mousePressEvent(QMouseEvent *event)
|
||||
//qDebug() << "Invoking menu for applet" << applet;
|
||||
|
||||
QMenu *desktopMenu = new QMenu;
|
||||
if (desktopMenu->winId()) {
|
||||
desktopMenu->windowHandle()->setTransientParent(window());
|
||||
}
|
||||
desktopMenu->setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
m_contextMenu = desktopMenu;
|
||||
|
Loading…
Reference in New Issue
Block a user