Jean-Marc Lasgouttes wrote:
"Abdelrazak" == Abdelrazak Younes <[EMAIL PROTECTED]> writes:

Abdelrazak> So, AFAIS, this is exactly the same as Ctrl-Tab in a
Abdelrazak> multi-line equation. Splitting math cell to get a
Abdelrazak> multi-line equation is achieved by Ctrl+Enter not
Abdelrazak> Ctrl-Tab.

I think that Ctrl+Enter is different from cell splitting. I agree
though that cell-splitting could be moved to another binding.

This is a quite useful behaviour and it would be nice to restore it
(if qt is noce enough to let you do it :)

Abdelrazak> I'll try to look at that if we agree to change Ctrl-Tab in
Abdelrazak> math... Deal?

I think we can find such a deal indeed. We just have to find a key for
cell splitting.

I've done my part of the deal (well mostly), will you do yours? ;-)

Abdel.

URL: http://www.lyx.org/trac/changeset/16352
Log:
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.

Modified:
    lyx-devel/trunk/src/frontends/WorkArea.h
    lyx-devel/trunk/src/frontends/qt4/GuiView.C
    lyx-devel/trunk/src/frontends/qt4/GuiView.h

Modified: lyx-devel/trunk/src/frontends/WorkArea.h
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/frontends/WorkArea.h?rev=16352
==============================================================================
--- lyx-devel/trunk/src/frontends/WorkArea.h (original)
+++ lyx-devel/trunk/src/frontends/WorkArea.h Wed Dec 20 22:28:05 2006
@@ -88,9 +88,10 @@
        void stopBlinkingCursor();
        void startBlinkingCursor();

+       /// 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:
-       ///
-       void processKeySym(LyXKeySymPtr key, key_modifier::state state);
        /// cause the display of the given area of the work area
        virtual void expose(int x, int y, int w, int h) = 0;
        ///

Modified: lyx-devel/trunk/src/frontends/qt4/GuiView.C
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/frontends/qt4/GuiView.C?rev=16352
==============================================================================
--- lyx-devel/trunk/src/frontends/qt4/GuiView.C (original)
+++ lyx-devel/trunk/src/frontends/qt4/GuiView.C Wed Dec 20 22:28:05 2006
@@ -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 @@
 }


+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"));

Modified: lyx-devel/trunk/src/frontends/qt4/GuiView.h
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/frontends/qt4/GuiView.h?rev=16352
==============================================================================
--- lyx-devel/trunk/src/frontends/qt4/GuiView.h (original)
+++ lyx-devel/trunk/src/frontends/qt4/GuiView.h Wed Dec 20 22:28:05 2006
@@ -124,6 +124,9 @@
         */
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

Reply via email to