]> git.lyx.org Git - features.git/commitdiff
menubar autoshowing: go back to r24786
authorAbdelrazak Younes <younes@lyx.org>
Thu, 15 May 2008 23:26:31 +0000 (23:26 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Thu, 15 May 2008 23:26:31 +0000 (23:26 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24794 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiView.cpp

index 6a682cfc660608b22ad962a7b6b9242f88b6b0f4..eae6bf135768e69ddff38d02166c55121e9c33db 100644 (file)
@@ -276,17 +276,6 @@ public:
        TocModels toc_models_;
 };
 
-namespace {
-
-class MenuBar : public QMenuBar
-{
-public:
-       ///
-       MenuBar() : QMenuBar(0) {}
-       void keyPressEvent(QKeyEvent * e) { QMenuBar::keyPressEvent(e); }
-};
-
-} // anon
 
 GuiView::GuiView(int id)
        : d(*new GuiViewPrivate), id_(id)
@@ -299,10 +288,6 @@ GuiView::GuiView(int id)
        // they are greyed out.
        theLyXFunc().setLyXView(this);
        
-#ifndef Q_WS_MACX
-       setMenuBar(new MenuBar());
-#endif
-
        // Fill up the menu bar.
        guiApp->menus().fillMenuBar(menuBar(), this, true);
 
@@ -657,31 +642,20 @@ bool GuiView::event(QEvent * e)
 
        case QEvent::ShortcutOverride: {
 
-#ifndef Q_WS_MACX
                if (isFullScreen() && menuBar()->isHidden()) {
                        QKeyEvent * ke = static_cast<QKeyEvent*>(e);
-                       if (!(ke->modifiers() & Qt::AltModifier)
-                               || ke->key() == Qt::Key_Alt)
-                               return QMainWindow::event(e);                   
-                       MenuBar * menu_bar = static_cast<MenuBar *>(menuBar());
-                       menu_bar->keyPressEvent(ke);
-                       menu_bar->show();                       
-                       if (ke->isAccepted())
-                               return true;
-                       // Showing and hiding the menubar has the potential to create a bad
-                       // flickering due to the window resizing. On Windows Vista, this flicker
-                       // is not visible at all.
-                       menu_bar->hide();                       
-                       // Otherwise continue with even.
+                       // FIXME: we should also try to detect special LyX shortcut such as
+                       // Alt-P and Alt-M
+                       if (ke->modifiers() & Qt::AltModifier || ke->key() == Qt::Key_Alt)
+                               menuBar()->show();
                        return QMainWindow::event(e);
                }
-#endif
 
-               QKeyEvent * ke = static_cast<QKeyEvent*>(e);
                if (d.current_work_area_)
                        // Nothing special to do.
                        return QMainWindow::event(e);
 
+               QKeyEvent * ke = static_cast<QKeyEvent*>(e);
                // Let Qt handle menu access and the Tab keys to navigate keys to navigate
                // between controls.
                if (ke->modifiers() & Qt::AltModifier || ke->key() == Qt::Key_Tab