X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FGuiView.cpp;h=ba6b33dd0c7f6c7893996710ecffbc9c1e77f21f;hb=4e223167ff2872ee123c8354d486352c8a368102;hp=89fa9618ca0d6caaefc2e36f480e23e93aabd7b6;hpb=fda541d46aa9d076d1bb57e1ee3a868d94fa566b;p=lyx.git diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 89fa9618ca..ba6b33dd0c 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -277,6 +277,11 @@ GuiView::GuiView(int id) // GuiToolbars *must* be initialised before the menu bar. d.toolbars_ = new GuiToolbars(*this); + // set ourself as the current view. This is needed for the menu bar + // filling, at least for the static special menu item on Mac. Otherwise + // they are greyed out. + theLyXFunc().setLyXView(this); + // Fill up the menu bar. guiApp->menus().fillMenuBar(menuBar(), this); @@ -366,6 +371,10 @@ void GuiView::showEvent(QShowEvent * e) void GuiView::closeEvent(QCloseEvent * close_event) { + // it can happen that this event arrives without selecting the view, + // e.g. when clicking the close button on a background window. + theLyXFunc().setLyXView(this); + while (Buffer * b = buffer()) { if (b->parent()) { // This is a child document, just close the tab after saving @@ -539,7 +548,7 @@ void GuiView::on_lastWorkAreaRemoved() #ifdef Q_WS_MAC // On Mac close the view if there is no Tab open anymore, // but only if no splitter is visible - if (d.splitter_->count() == 1) { + if (!lyxrc.open_buffers_in_tabs && d.splitter_->count() == 1) { TabWorkArea * twa = qobject_cast(d.splitter_->widget(0)); if (twa && twa->count() == 0) { // close the view, as no tab is open anymore