Abdelrazak Younes wrote:
Jean-Marc Lasgouttes wrote:
http://bugzilla.lyx.org/show_bug.cgi?id=2423

This patch should finally fix bug 2423. What it does is add a new
signal focusChange to WorkArea and emit it from
QContentPane::focusIn/Out.

The action on focus change is to update the toolbars.
This seems to work well for me. Of course, the way icons get
enabled/disabled may seem arbitrary, but at least the annoying bug is
gone.

I guess this will need adaptations for the new world of 1.5, but the
idea is simple.

Yes this will be implemented entirely within the qt4 frontend. No BufferView interaction at all and probably using a Qt signal instead of a boost one.

This patch does it for qt4 without any signal. Comments?

Abdel.
Index: frontends/qt4/GuiWorkArea.C
===================================================================
--- frontends/qt4/GuiWorkArea.C (revision 14803)
+++ frontends/qt4/GuiWorkArea.C (working copy)
@@ -19,6 +19,8 @@
 #include "QLyXKeySym.h"
 #include "qt_helpers.h"
 
+#include "LyXView.h"
+
 #include "BufferView.h"
 #include "debug.h"
 #include "funcrequest.h"
@@ -580,6 +582,20 @@
        e->accept();
 }
 
+
+void GuiWorkArea::focusInEvent(QFocusEvent * ev)
+{
+       QAbstractScrollArea::focusInEvent(ev);
+       lyx_view_.updateToolbars();
+}
+
+
+void GuiWorkArea::focusOutEvent(QFocusEvent * ev)
+{
+       QAbstractScrollArea::focusOutEvent(ev);
+       lyx_view_.updateToolbars();
+}
+
 } // namespace frontend
 } // namespace lyx
 
Index: frontends/qt4/GuiWorkArea.h
===================================================================
--- frontends/qt4/GuiWorkArea.h (revision 14787)
+++ frontends/qt4/GuiWorkArea.h (working copy)
@@ -160,6 +160,10 @@
        void keyPressEvent(QKeyEvent * e);
        /// IM events
        void inputMethodEvent(QInputMethodEvent * e);
+       /// focus in
+       void focusInEvent(QFocusEvent * ev);
+       /// focus out
+       void focusOutEvent(QFocusEvent * ev);
 
 public Q_SLOTS:
 

Reply via email to