* lyxfunc.C : rename unused LFUN_LYX_QUIT parameter
* frontends/qt4/GuiImplementation.C : call LFUN_LYX_QUIT when last window closed
* frontends/qt4/GuiWorkArea.C : check theApp, add debug case
* frontends/qt4/GuiApplication.C : remove quitLyX()
* frontends/qt4/GuiApplication.h : remove quitLyX()
* frontends/qt4/GuiView.C : hide() widow fore exiting to prevent crash
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16044
a592a061-630c-0410-9148-
cb99ea01b6c8
LoaderQueue::setPriority(10,100);
- /* Qt Docs:
- void QApplication::lastWindowClosed () [signal]
- This signal is emitted from QApplication::exec() when the last visible
- primary window ... is closed.
- This feature be turned off by setting quitOnLastWindowClosed to false.
- */
- setQuitOnLastWindowClosed(false);
- // this connect should not be necessary:
- // we rely on a Qt bug on Windows and maybe Linux
- QObject::connect(this, SIGNAL(lastWindowClosed()),
- this, SLOT(quitLyX()));
-
guiApp = this;
}
-
-void GuiApplication::quitLyX()
-{
- theLyXFunc().setLyXView(0);
-
- // trigger LFUN_LYX_QUIT instead of QApplication::quit() directly
- // since LFUN_LYX_QUIT may have more cleanup stuff
- dispatch(FuncRequest(LFUN_LYX_QUIT, "force"));
-}
-
-
Clipboard& GuiApplication::clipboard()
{
return clipboard_;
///
GuiFontLoader & guiFontLoader() { return font_loader_; }
-private Q_SLOTS:
- /// request an LFUN_LYX_QUIT
- void quitLyX();
-
private:
///
GuiImplementation gui_;
bool GuiImplementation::closeAll()
{
+ // ATM never used
if (!theBufferList().quitWriteAll())
return false;
if (views_.empty()) {
theLyXFunc().setLyXView(0);
-// dispatch(FuncRequest(LFUN_LYX_QUIT));
+ dispatch(FuncRequest(LFUN_LYX_QUIT));
return;
}
GuiView::GuiView(int id)
: QMainWindow(), LyXView(id), commandbuffer_(0), d(*new GuiViewPrivate)
{
- setAttribute(Qt::WA_DeleteOnClose, true);
- setAttribute(Qt::WA_QuitOnClose, true);
-
// setToolButtonStyle(Qt::ToolButtonIconOnly);
// setIconSize(QSize(12,12));
}
saveGeometry();
- gui.unregisterView(this);
+ hide(); // don't remove this hide, it prevents a crash on exit
+ gui.unregisterView(this);
}
void GuiWorkArea::focusInEvent(QFocusEvent * /*event*/)
{
// No need to do anything if we didn't change views...
- if (&lyx_view_ == &theApp->currentView())
+ if (theApp == 0 || &lyx_view_ == &theApp->currentView())
return;
theApp->setCurrentView(lyx_view_);
//if (!lyxrc.show_banner)
// return;
- lyxerr << "show banner: " << lyxrc.show_banner << endl;
+ lyxerr[Debug::GUI] << "show banner: " << lyxrc.show_banner << endl;
/// The text to be written on top of the pixmap
QString const text = lyx_version ? QString(lyx_version) : qt_("unknown version");
string const file = support::libFileSearch("images", "banner", "ppm");
QLPainter pain(&screen_);
if (greyed_out_) {
- lyxerr << "splash screen requested" << endl;
+ lyxerr[Debug::GUI] << "splash screen requested" << endl;
doGreyOut(pain);
verticalScrollBar()->hide();
update(0, 0, width(), height());
break;
case LFUN_LYX_QUIT:
- if (argument != "force") {
+ if (argument == "closeOnly") {
if (!theApp->gui().closeAll())
break;
lyx_view_ = 0;