fix quit problems on Mac

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16153 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Peter Kümmel 2006-12-03 10:05:41 +00:00
parent 48fb157414
commit f6cf871deb
2 changed files with 23 additions and 0 deletions

View File

@ -214,8 +214,28 @@ void GuiView::init()
updateToolbars();
updateLayoutChoice();
updateMenubar();
#ifdef Q_WS_MACX
// Qt docs:
// "quit or exit Application Menu | Quit <application name>
// If this entry is not found a default Quit item will be created to call
// QApplication::quit()"
QMenu * lyxMenu = menuBar()->addMenu("&LyX");
QAction * quitAction = new QAction(tr("&Quit"), this);
lyxMenu->addAction(quitAction);
connect(quitAction, SIGNAL(triggered()),this, SLOT(macQuit()));
#endif
}
void GuiView::macQuit()
{
// this slot is only called on Mac
dispatch(FuncRequest(LFUN_LYX_QUIT));
}
void GuiView::closeEvent(QCloseEvent * close_event)
{
theApp()->gui().unregisterView(id());

View File

@ -103,6 +103,9 @@ public Q_SLOTS:
void normalSizedIcons();
void bigSizedIcons();
/// slot needed by the Mac
void macQuit();
protected:
/// make sure we quit cleanly
virtual void closeEvent(QCloseEvent * e);