]> git.lyx.org Git - features.git/commitdiff
Let the background widget also dispatch the keypresses to guiApp. Now, the Alt-?...
authorVincent van Ravesteijn <vfr@lyx.org>
Fri, 8 Jan 2010 20:08:48 +0000 (20:08 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Fri, 8 Jan 2010 20:08:48 +0000 (20:08 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32898 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiView.cpp

index c6b8474b9966fd650c31d1e5e79786b494e56f02..186c95111c9d26797ee8318c311d9fdec9a1b672 100644 (file)
@@ -154,6 +154,7 @@ public:
                font.setPointSize(int(toqstr(lyxrc.font_sizes[FONT_SIZE_LARGE]).toDouble()));
                pain.setFont(font);
                pain.drawText(260, 15, text);
+               setFocusPolicy(Qt::StrongFocus);
        }
 
        void paintEvent(QPaintEvent *)
@@ -164,6 +165,18 @@ public:
                pain.drawPixmap(x, y, splash_);
        }
 
+       void keyPressEvent(QKeyEvent * ev)
+       {
+               KeySymbol sym;
+               setKeySymbol(&sym, ev);
+               if (sym.isOK()) {
+                       guiApp->processKeySym(sym, q_key_state(ev->modifiers()));
+                       ev->accept();
+               } else {
+                       ev->ignore();
+               }
+       }
+
 private:
        QPixmap splash_;
 };
@@ -248,6 +261,7 @@ struct GuiView::GuiViewPrivate
        {
                stack_widget_->setCurrentWidget(bg_widget_);
                bg_widget_->setUpdatesEnabled(true);
+               bg_widget_->setFocus();
        }
 
        TabWorkArea * tabWorkArea(int i)
@@ -576,6 +590,8 @@ void GuiView::setFocus()
        QMainWindow::setFocus();
        if (d.current_work_area_)
                d.current_work_area_->setFocus();
+       else
+               d.bg_widget_->setFocus();
 }
 
 
@@ -913,25 +929,7 @@ bool GuiView::event(QEvent * e)
                        }
                }
 #endif
-
-               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 
-                       || ke->key() == Qt::Key_Backtab)
-                       return QMainWindow::event(e);
-
-               // Allow processing of shortcuts that are allowed even when no Buffer
-               // is viewed.
-               KeySymbol sym;
-               setKeySymbol(&sym, ke);
-               guiApp->processKeySym(sym, q_key_state(ke->modifiers()));
-               e->accept();
-               return true;
+               return QMainWindow::event(e);
        }
 
        default: