From bf6a32bab45a2b9907ed06e79370b816753e9578 Mon Sep 17 00:00:00 2001 From: Tommaso Cucinotta Date: Sun, 10 Jan 2010 19:08:41 +0000 Subject: [PATCH] Fixed #6335. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32949 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiView.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index e39719f3f6..852aabe510 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -585,11 +585,20 @@ TocModels & GuiView::tocModels() void GuiView::setFocus() { LYXERR(Debug::DEBUG, "GuiView::setFocus()" << this); + QMainWindow::setFocus(); +} + + +void GuiView::focusInEvent(QFocusEvent * e) +{ + LYXERR(Debug::DEBUG, "GuiView::focusInEvent()" << this); + QMainWindow::focusInEvent(e); // Make sure LyXFunc points to the correct view. guiApp->setCurrentView(this); - QMainWindow::setFocus(); - if (d.current_work_area_) - d.current_work_area_->setFocus(); + if (currentMainWorkArea()) + currentMainWorkArea()->setFocus(); + else if (currentWorkArea()) + currentWorkArea()->setFocus(); else d.bg_widget_->setFocus(); }