Skip to content

Commit

Permalink
Make sure MainWindow has focus when we returned from a child QWidget
Browse files Browse the repository at this point in the history
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 b2dcd7b didn't help under all circumstances.

Fixes #10587
  • Loading branch information
jyavenard committed Jul 17, 2013
1 parent 26e59c9 commit 995db9d
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions mythtv/libs/libmythui/mythmainwindow.cpp
Expand Up @@ -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<QWidget*>::iterator it =
Expand All @@ -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)
{
Expand Down

0 comments on commit 995db9d

Please sign in to comment.