From 995db9d284a40d695271302a0fa812d9353b9faa Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Wed, 17 Jul 2013 11:29:17 +1000 Subject: [PATCH] Make sure MainWindow has focus when we returned from a child QWidget On a mac, if you simply delete the child QWidget, the focus isn't returned, making all keyboard presses simply doing "beep". Earlier fix done in b2dcd7ba68ae0b3e5b59d8c55cf49603ca1aa7fd didn't help under all circumstances. Fixes #10587 --- mythtv/libs/libmythui/mythmainwindow.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/mythtv/libs/libmythui/mythmainwindow.cpp b/mythtv/libs/libmythui/mythmainwindow.cpp index 9923c8c0402..f66d679e35b 100644 --- a/mythtv/libs/libmythui/mythmainwindow.cpp +++ b/mythtv/libs/libmythui/mythmainwindow.cpp @@ -1326,14 +1326,13 @@ void MythMainWindow::attach(QWidget *child) currentWidget()->setEnabled(false); d->widgetList.push_back(child); -#ifndef Q_OS_MAC child->winId(); -#endif child->raise(); child->setFocus(); child->setMouseTracking(true); } + void MythMainWindow::detach(QWidget *child) { std::vector::iterator it = @@ -1347,13 +1346,12 @@ void MythMainWindow::detach(QWidget *child) d->widgetList.erase(it); QWidget *current = currentWidget(); + if (!current) + current = this; - if (current) - { - current->setEnabled(true); - current->setFocus(); - current->setMouseTracking(true); - } + current->setEnabled(true); + current->setFocus(); + current->setMouseTracking(true); if (d->exitingtomain) {