]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/DockView.h
On Linux show in crash message box the backtrace
[lyx.git] / src / frontends / qt4 / DockView.h
index f79803463d54d37153447e121efe4a8359a8b08b..d71b75b0fcb488643b93bc9165ebba477f1c9b8b 100644 (file)
@@ -16,6 +16,7 @@
 #include "GuiView.h"
 
 #include <QDockWidget>
+#include <QKeyEvent>
 
 namespace lyx {
 namespace frontend {
@@ -39,9 +40,8 @@ public:
                : QDockWidget(&parent, flags), Dialog(parent, name, title)
        {
                setObjectName(name);
-               if (flags & Qt::Drawer)
-                       setFeatures(QDockWidget::NoDockWidgetFeatures);
                parent.addDockWidget(area, this);
+               hide();
        }
 
        virtual ~DockView() {}
@@ -49,10 +49,29 @@ public:
        virtual QWidget * asQWidget() { return this; }
        virtual QWidget const * asQWidget() const { return this; }
 
+       /// We don't want to restore geometry session for dock widgets.
+       void restoreSession() {}
+
+       void keyPressEvent(QKeyEvent * ev)
+       {
+               if (ev->key() == Qt::Key_Escape) {
+                       QMainWindow * mw = static_cast<QMainWindow *>(parent());
+                       if (!mw) {
+                               ev->ignore();
+                               return;
+                       }
+                       mw->activateWindow();
+                       mw->setFocus();
+                       if (isFloating())
+                               hide();
+                       ev->accept();
+               }
+       }
        /// Dialog inherited methods
        //@{
        void applyView() {}
        bool isClosing() const { return false; }
+       bool needBufferOpen() const { return false; }
        //@}
 };