]> git.lyx.org Git - features.git/commitdiff
Fix focus on WorkArea after mini-buffer command.
authorAbdelrazak Younes <younes@lyx.org>
Sat, 23 Dec 2006 17:09:50 +0000 (17:09 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Sat, 23 Dec 2006 17:09:50 +0000 (17:09 +0000)
* LyXView:
  - setFocus(): new pure virtual method.

* QCommandBuffer:
  - simplify Ctor
  - call GuiView::setFocus() instead of centralWidget()->setFocus()

* GuiView:
  - implement setFocus():
  - focusNextPrevChild(): use setFocus().

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16386 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/LyXView.h
src/frontends/qt4/GuiView.C
src/frontends/qt4/GuiView.h
src/frontends/qt4/QCommandBuffer.C
src/frontends/qt4/QCommandBuffer.h

index 28e75c9e1630037e45dffcd932f8fa796ceccd29..b51aa65447b6c39a31f80c82cc6d7f72a230ed3b 100644 (file)
@@ -70,6 +70,8 @@ public:
 
        virtual void close() = 0;
 
+       virtual void setFocus() = 0;
+
        std::vector<int> const & workAreaIds() const { return work_area_ids_; }
 
        void setWorkArea(frontend::WorkArea * work_area);
index d67e28baadc21108cc81b280258820bc5cdeda4d..159388d462e4444b4ebc2e169e2e7b339c86e9f8 100644 (file)
@@ -195,6 +195,12 @@ void GuiView::close()
 }
 
 
+void GuiView::setFocus()
+{
+       static_cast<GuiWorkArea *>(work_area_)->setFocus();
+}
+
+
 QMenu* GuiView::createPopupMenu()
 {
        return d.toolBarPopup(this);
@@ -648,7 +654,7 @@ bool GuiView::event(QEvent * e)
 
 bool GuiView::focusNextPrevChild(bool /*next*/)
 {
-       static_cast<GuiWorkArea *>(work_area_)->setFocus();
+       setFocus();
        return true;
 }
 
index c0e088b536795a1305469fcaad3f61c660bb157d..77ffcb04276b8b78d9b188c18a25a2b2335e4eb0 100644 (file)
@@ -56,6 +56,7 @@ public:
 
        virtual void init();
        virtual void close();
+       virtual void setFocus();
        virtual void setGeometry(
                unsigned int width,
                unsigned int height,
index e915478369a393b1f0db0ceba0971f20712d2377..e5af3e80f793cc0b0898b642c39fa77300d8294a 100644 (file)
@@ -74,9 +74,8 @@ protected:
 } // end of anon
 
 
-QCommandBuffer::QCommandBuffer(GuiView * view, ControlCommandBuffer & control,
-                       QWidget * parent)
-       : QWidget(parent), view_(view), controller_(control)
+QCommandBuffer::QCommandBuffer(GuiView * view, ControlCommandBuffer & control)
+       : QWidget(view), view_(view), controller_(control)
 {
        QPixmap qpup(toqstr(libFileSearch("images", "up", "xpm").absFilename()));
        QPixmap qpdown(toqstr(libFileSearch("images", "down", "xpm").absFilename()));
@@ -127,7 +126,7 @@ void QCommandBuffer::cancel()
 void QCommandBuffer::dispatch()
 {
        controller_.dispatch(fromqstr(edit_->text()));
-       view_->centralWidget()->setFocus();
+       view_->setFocus();
        edit_->setText(QString());
        edit_->clearFocus();
 }
index e221383af70e8ac65c1a876040505695da6b24e9..bd1fafd66da8759e5893e6011972bde392c65833 100644 (file)
@@ -26,8 +26,7 @@ class ControlCommandBuffer;
 class QCommandBuffer : public QWidget {
        Q_OBJECT
 public:
-       QCommandBuffer(GuiView * view, ControlCommandBuffer & control,
-               QWidget * parent=NULL);
+       QCommandBuffer(GuiView * view, ControlCommandBuffer & control);
 
        /// focus the edit widget
        void focus_command();