Don't hide Dialog when opening QMenu from it

When plasmoid in a popup (applet opened from panel) is opening a QMenu,
the popup itself hides because it looses focus. There's currently no way
to obtain the Dialog the applet popup is in and pass it to the QMenu
window as a parent, so we have to go this way.

REVIEW: 118361
BUG: 335422
This commit is contained in:
Martin Klapetek 2014-05-28 12:04:21 +02:00
parent aca024c2e0
commit ce166ca451

View File

@ -797,7 +797,7 @@ void Dialog::focusOutEvent(QFocusEvent *ev)
}
const QWindow *focusWindow = QGuiApplication::focusWindow();
bool childHasFocus = (focusWindow && focusWindow->isActive() && isAncestorOf(focusWindow));
bool childHasFocus = focusWindow && ((focusWindow->isActive() && isAncestorOf(focusWindow)) || focusWindow->objectName() == QLatin1String("QMenuClassWindow"));
if (qobject_cast<const View *>(focusWindow) || (!parentHasFocus && !childHasFocus)) {
qDebug() << "DIALOG: hiding dialog.";