X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FGuiToc.cpp;h=787bbb7058b458efddfa609794727b95ecb02925;hb=425d092204118ea6c24c28e85fdf03fcf2bb51a4;hp=9b632748d2802794d4ac984297c5021827c5578e;hpb=81bc06db34a9847faa4890dec33c40f8ad75fefa;p=lyx.git diff --git a/src/frontends/qt4/GuiToc.cpp b/src/frontends/qt4/GuiToc.cpp index 9b632748d2..787bbb7058 100644 --- a/src/frontends/qt4/GuiToc.cpp +++ b/src/frontends/qt4/GuiToc.cpp @@ -33,7 +33,7 @@ namespace lyx { namespace frontend { GuiToc::GuiToc(GuiView & parent, Qt::DockWidgetArea area, Qt::WindowFlags flags) - : DockView(parent, "toc", qt_("Outline"), area, flags) + : DockView(parent, "toc", qt_("Outline"), area, flags), is_closing_(false) { widget_ = new TocWidget(parent, this); setWidget(widget_); @@ -49,18 +49,21 @@ GuiToc::~GuiToc() void GuiToc::updateView() { #ifndef Q_WS_MACX - widget_->updateView(); - return; + widget_->updateView(); + return; #endif widget_->updateView(); - // Special code for Mac drawer. - if (windowFlags() & Qt::Drawer && lyxview().isFullScreen()) { + + // For Mac: switch to a docked TOC in fullscreen mode. + // We use the features() here instead of WindowFlags because + // the latter are not reliable (always returns Qt::Drawer). + if (!(features() & DockWidgetClosable) && lyxview().isFullScreen()) { setWindowFlags(Qt::Widget); setFeatures(DockWidgetClosable); // Setting features hides the dialog, see Qt's doc. show(); - } else if (!(windowFlags() & Qt::Drawer)) { + } else if ((features() & DockWidgetClosable) && !lyxview().isFullScreen()) { setWindowFlags(Qt::Drawer); setFeatures(NoDockWidgetFeatures); // Setting features hides the dialog, see Qt's doc. @@ -89,6 +92,27 @@ void GuiToc::enableView(bool enable) } +void GuiToc::closeEvent(QCloseEvent * /*event*/) +{ + is_closing_ = true; + ((GuiView *)parent())->updateToolbars(); + is_closing_ = false; +} + + +void GuiToc::doDispatch(Cursor & cur, FuncRequest const & cmd) +{ + widget_->doDispatch(cur, cmd); +} + + +bool GuiToc::getStatus(Cursor & cur, FuncRequest const & cmd, + FuncStatus & status) const +{ + return widget_->getStatus(cur, cmd, status); +} + + Dialog * createGuiToc(GuiView & lv) { GuiView & guiview = static_cast(lv); @@ -104,4 +128,4 @@ Dialog * createGuiToc(GuiView & lv) } // namespace frontend } // namespace lyx -#include "GuiToc_moc.cpp" +#include "moc_GuiToc.cpp"