mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-05 13:26:21 +00:00
* on Mac close GuiView when the last tab was closed
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23730 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
0ba2a1e6f8
commit
fda541d46a
@ -534,6 +534,22 @@ void GuiView::on_currentWorkAreaChanged(GuiWorkArea * wa)
|
||||
}
|
||||
|
||||
|
||||
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) {
|
||||
TabWorkArea * twa = qobject_cast<TabWorkArea *>(d.splitter_->widget(0));
|
||||
if (twa && twa->count() == 0) {
|
||||
// close the view, as no tab is open anymore
|
||||
QTimer::singleShot(0, this, SLOT(close()));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void GuiView::updateStatusBar()
|
||||
{
|
||||
// let the user see the explicit message
|
||||
@ -716,6 +732,9 @@ TabWorkArea * GuiView::addTabWorkArea()
|
||||
TabWorkArea * twa = new TabWorkArea;
|
||||
QObject::connect(twa, SIGNAL(currentWorkAreaChanged(GuiWorkArea *)),
|
||||
this, SLOT(on_currentWorkAreaChanged(GuiWorkArea *)));
|
||||
QObject::connect(twa, SIGNAL(lastWorkAreaRemoved()),
|
||||
this, SLOT(on_lastWorkAreaRemoved()));
|
||||
|
||||
d.splitter_->addWidget(twa);
|
||||
d.stack_widget_->setCurrentWidget(d.splitter_);
|
||||
return twa;
|
||||
@ -1108,7 +1127,7 @@ Buffer * GuiView::loadDocument(FileName const & filename, bool tolastfiles)
|
||||
setBusy(false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
setBuffer(newBuffer);
|
||||
|
||||
// scroll to the position when the file was last closed
|
||||
|
@ -151,6 +151,8 @@ private Q_SLOTS:
|
||||
|
||||
///
|
||||
void on_currentWorkAreaChanged(GuiWorkArea *);
|
||||
///
|
||||
void on_lastWorkAreaRemoved();
|
||||
|
||||
/// slots to change the icon size
|
||||
void smallSizedIcons();
|
||||
|
@ -1324,7 +1324,9 @@ bool TabWorkArea::removeWorkArea(GuiWorkArea * work_area)
|
||||
else
|
||||
// Hide tabbar if there's only one tab.
|
||||
showBar(count() > 1);
|
||||
}
|
||||
} else
|
||||
lastWorkAreaRemoved();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -258,6 +258,8 @@ public:
|
||||
Q_SIGNALS:
|
||||
///
|
||||
void currentWorkAreaChanged(GuiWorkArea *);
|
||||
///
|
||||
void lastWorkAreaRemoved();
|
||||
|
||||
public Q_SLOTS:
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user