From f6cf871deb0cb60f0e38f22efcaf26c1c6bf283d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Peter=20K=C3=BCmmel?= Date: Sun, 3 Dec 2006 10:05:41 +0000 Subject: [PATCH] fix quit problems on Mac git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16153 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiView.C | 20 ++++++++++++++++++++ src/frontends/qt4/GuiView.h | 3 +++ 2 files changed, 23 insertions(+) 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); -- 2.39.5