From 09fe21bd11c418d0465ff519949b75d716586597 Mon Sep 17 00:00:00 2001 From: Stefan Schimanski Date: Fri, 14 Mar 2008 23:33:05 +0000 Subject: [PATCH] * QWidget::show is synchronous, hence we see the LyX logo for a moment, even if in the next moment the new buffer appears. So we first create the buffer and then show the view. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23742 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiApplication.cpp | 19 +++++++++++++------ src/frontends/qt4/GuiApplication.h | 3 ++- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp index eac82e4843..9b6e1f6e37 100644 --- a/src/frontends/qt4/GuiApplication.cpp +++ b/src/frontends/qt4/GuiApplication.cpp @@ -320,9 +320,13 @@ bool GuiApplication::dispatch(FuncRequest const & cmd) case LFUN_BUFFER_NEW: if (viewCount() == 0 - || (!lyxrc.open_buffers_in_tabs && current_view_->buffer() != 0)) - createView(); - current_view_->newDocument(to_utf8(cmd.argument()), false); + || (!lyxrc.open_buffers_in_tabs && current_view_->buffer() != 0)) { + createView(QString(), false); // keep hidden + current_view_->newDocument(to_utf8(cmd.argument()), false); + current_view_->show(); + setActiveWindow(current_view_); + } else + current_view_->newDocument(to_utf8(cmd.argument()), false); break; case LFUN_BUFFER_NEW_TEMPLATE: @@ -376,7 +380,7 @@ static void updateIds(map const & stdmap, vector & ids) } -void GuiApplication::createView(QString const & geometry_arg) +void GuiApplication::createView(QString const & geometry_arg, bool autoShow) { // release the keyboard which might have been grabed by the global // menubar on Mac to catch shortcuts even without any GuiView. @@ -398,7 +402,11 @@ void GuiApplication::createView(QString const & geometry_arg) views_[id] = view; updateIds(views_, view_ids_); - view->show(); + if (autoShow) { + view->show(); + setActiveWindow(view); + } + if (!geometry_arg.isEmpty()) { #ifdef Q_WS_WIN int x, y; @@ -413,7 +421,6 @@ void GuiApplication::createView(QString const & geometry_arg) #endif } view->setFocus(); - setActiveWindow(view); setCurrentView(*view); } diff --git a/src/frontends/qt4/GuiApplication.h b/src/frontends/qt4/GuiApplication.h index c6695cc131..436732856b 100644 --- a/src/frontends/qt4/GuiApplication.h +++ b/src/frontends/qt4/GuiApplication.h @@ -89,7 +89,8 @@ public: /// Create the main window with given geometry settings. /// \param geometry_arg: only for Windows platform. - void createView(QString const & geometry_arg = QString()); + void createView(QString const & geometry_arg = QString(), + bool autoShow = true); /// GuiView const * currentView() const { return current_view_; } ///