// 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);
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
#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<TabWorkArea *>(d.splitter_->widget(0));
if (twa && twa->count() == 0) {
// close the view, as no tab is open anymore