diff --git a/frame/item/dockitem.cpp b/frame/item/dockitem.cpp index ca7894b80..358f5e398 100644 --- a/frame/item/dockitem.cpp +++ b/frame/item/dockitem.cpp @@ -249,6 +249,9 @@ void DockItem::showContextMenu() hidePopup(); emit requestWindowAutoHide(false); + if (!m_contextMenu.parentWidget()) + m_contextMenu.setParent(topLevelWidget(), Qt::Popup); + m_contextMenu.exec(QCursor::pos()); onContextMenuAccepted(); diff --git a/plugins/tray/snitraywidget.cpp b/plugins/tray/snitraywidget.cpp index 8d0ded231..581df6488 100644 --- a/plugins/tray/snitraywidget.cpp +++ b/plugins/tray/snitraywidget.cpp @@ -284,6 +284,8 @@ void SNITrayWidget::initMenu() qDebug() << "generate the sni menu object"; m_menu = m_dbusMenuImporter->menu(); + if (m_menu && !m_menu->parentWidget()) + m_menu->setParent(topLevelWidget(), Qt::Popup); qDebug() << "the sni menu obect is:" << m_menu; } diff --git a/plugins/tray/system-trays/systemtrayitem.cpp b/plugins/tray/system-trays/systemtrayitem.cpp index 6dc8ff29b..e9eb0902a 100644 --- a/plugins/tray/system-trays/systemtrayitem.cpp +++ b/plugins/tray/system-trays/systemtrayitem.cpp @@ -451,6 +451,9 @@ void SystemTrayItem::showContextMenu() hidePopup(); emit requestWindowAutoHide(false); + if (!m_contextMenu.parentWidget()) + m_contextMenu.setParent(topLevelWidget(), Qt::Popup); + m_contextMenu.exec(QCursor::pos()); onContextMenuAccepted();