From 16ec606ab40cd659dcb161cde5aa6a66076dbcfd Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Sun, 3 Jul 2016 22:58:25 +0200 Subject: [PATCH] Bring window to front after loading a document Fixes #7875. --- src/frontends/qt4/GuiApplication.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp index a8611f784d..9d2f3c318c 100644 --- a/src/frontends/qt4/GuiApplication.cpp +++ b/src/frontends/qt4/GuiApplication.cpp @@ -1678,14 +1678,21 @@ void GuiApplication::dispatch(FuncRequest const & cmd, DispatchResult & dr) // but let's make sure LASSERT(current_view_, break); current_view_->openDocument(fname); - // FIXME but then why check current_view_ here? - if (current_view_ && !current_view_->documentBufferView()) + if (!current_view_->documentBufferView()) current_view_->close(); + else { + current_view_->raise(); + current_view_->activateWindow(); + current_view_->showNormal(); + } } else { // we know !d->views.empty(), so this should be ok // but let's make sure LASSERT(current_view_, break); current_view_->openDocument(fname); + current_view_->raise(); + current_view_->activateWindow(); + current_view_->showNormal(); } break; } -- 2.39.2