From: Peter Kümmel Date: Sun, 3 Dec 2006 10:05:41 +0000 (+0000) Subject: fix quit problems on Mac X-Git-Tag: 1.6.10~11663 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=f6cf871deb0cb60f0e38f22efcaf26c1c6bf283d;p=lyx.git fix quit problems on Mac git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16153 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/qt4/GuiView.C b/src/frontends/qt4/GuiView.C index 63769e1f13..6157421f45 100644 --- a/src/frontends/qt4/GuiView.C +++ b/src/frontends/qt4/GuiView.C @@ -214,8 +214,28 @@ void GuiView::init() updateToolbars(); updateLayoutChoice(); updateMenubar(); + +#ifdef Q_WS_MACX + // Qt docs: + // "quit or exit Application Menu | Quit + // 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()); diff --git a/src/frontends/qt4/GuiView.h b/src/frontends/qt4/GuiView.h index 83c8f6ba17..778b5d5977 100644 --- a/src/frontends/qt4/GuiView.h +++ b/src/frontends/qt4/GuiView.h @@ -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);