Partial Fix for Tab key press bug. It is now properly processed but the focus is not returned to the WorkArea afterward.

* WorkArea.h: processKeySym() is now public

* GuiView:
  * event(): new method to intercept Tab key press.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16352 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2006-12-20 21:28:05 +00:00
parent 5df778c2f8
commit 8f90d0bb96
3 changed files with 45 additions and 2 deletions

View File

@ -88,9 +88,10 @@ public:
void stopBlinkingCursor();
void startBlinkingCursor();
protected:
///
/// Process Key pressed event.
/// This needs to be public because it is accessed externally by GuiView.
void processKeySym(LyXKeySymPtr key, key_modifier::state state);
protected:
/// cause the display of the given area of the work area
virtual void expose(int x, int y, int w, int h) = 0;
///

View File

@ -17,6 +17,7 @@
#include "GuiImplementation.h"
#include "GuiWorkArea.h"
#include "QLyXKeySym.h"
#include "QLMenubar.h"
#include "QLToolbar.h"
#include "QCommandBuffer.h"
@ -54,6 +55,7 @@
#include <QVBoxLayout>
#include <boost/bind.hpp>
#include <boost/shared_ptr.hpp>
using std::endl;
using std::string;
@ -608,6 +610,43 @@ void GuiView::moveEvent(QMoveEvent *)
}
bool GuiView::event(QEvent * e)
{
// Useful debug code:
/*
switch (e->type())
{
case QEvent::WindowActivate:
case QEvent::ActivationChange:
case QEvent::WindowDeactivate:
case QEvent::Paint:
case QEvent::Enter:
case QEvent::Leave:
case QEvent::HoverEnter:
case QEvent::HoverLeave:
case QEvent::HoverMove:
case QEvent::StatusTip:
break;
default:
*/
if (e->type() == QEvent::ShortcutOverride) {
QKeyEvent * ke = static_cast<QKeyEvent*>(e);
if (ke->key() == Qt::Key_Tab) {
boost::shared_ptr<QLyXKeySym> sym(new QLyXKeySym);
sym->set(ke);
work_area_->processKeySym(sym, key_modifier::none);
e->accept();
centralWidget()->setFocus();
return true;
}
}
//} for the debug switch above.
return QMainWindow::event(e);
}
void GuiView::show()
{
QMainWindow::setWindowTitle(qt_("LyX"));

View File

@ -124,6 +124,9 @@ private:
*/
virtual void setWindowTitle(lyx::docstring const & t, lyx::docstring const & it);
/// in order to catch Tab key press.
bool event(QEvent * e);
QTimer statusbar_timer_;
/// command buffer