diff --git a/src/scriptengines/qml/plasmoid/containmentinterface.cpp b/src/scriptengines/qml/plasmoid/containmentinterface.cpp --- a/src/scriptengines/qml/plasmoid/containmentinterface.cpp +++ b/src/scriptengines/qml/plasmoid/containmentinterface.cpp @@ -1015,9 +1015,17 @@ desktopMenu->setAttribute(Qt::WA_TranslucentBackground); //end workaround - if (window() && window()->mouseGrabberItem()) { - window()->mouseGrabberItem()->ungrabMouse(); - } + auto ungrabMouseHack = [this]() { + if (window() && window()->mouseGrabberItem()) { + window()->mouseGrabberItem()->ungrabMouse(); + } + }; + +#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0) + QTimer::singleShot(0, this, ungrabMouseHack); +#else + ungrabMouseHack(); +#endif QPoint pos = event->globalPos(); if (window() && m_containment->containmentType() == Plasma::Types::PanelContainment) {