From: Abdelrazak Younes Date: Sat, 23 Dec 2006 17:09:50 +0000 (+0000) Subject: Fix focus on WorkArea after mini-buffer command. X-Git-Tag: 1.6.10~11453 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=42426e1423fabb5ce5bc0af2de3562a9baec0e82;p=features.git Fix focus on WorkArea after mini-buffer command. * 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 --- diff --git a/src/frontends/LyXView.h b/src/frontends/LyXView.h index 28e75c9e16..b51aa65447 100644 --- a/src/frontends/LyXView.h +++ b/src/frontends/LyXView.h @@ -70,6 +70,8 @@ public: virtual void close() = 0; + virtual void setFocus() = 0; + std::vector const & workAreaIds() const { return work_area_ids_; } void setWorkArea(frontend::WorkArea * work_area); diff --git a/src/frontends/qt4/GuiView.C b/src/frontends/qt4/GuiView.C index d67e28baad..159388d462 100644 --- a/src/frontends/qt4/GuiView.C +++ b/src/frontends/qt4/GuiView.C @@ -195,6 +195,12 @@ void GuiView::close() } +void GuiView::setFocus() +{ + static_cast(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(work_area_)->setFocus(); + setFocus(); return true; } diff --git a/src/frontends/qt4/GuiView.h b/src/frontends/qt4/GuiView.h index c0e088b536..77ffcb0427 100644 --- a/src/frontends/qt4/GuiView.h +++ b/src/frontends/qt4/GuiView.h @@ -56,6 +56,7 @@ public: virtual void init(); virtual void close(); + virtual void setFocus(); virtual void setGeometry( unsigned int width, unsigned int height, diff --git a/src/frontends/qt4/QCommandBuffer.C b/src/frontends/qt4/QCommandBuffer.C index e915478369..e5af3e80f7 100644 --- a/src/frontends/qt4/QCommandBuffer.C +++ b/src/frontends/qt4/QCommandBuffer.C @@ -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(); } diff --git a/src/frontends/qt4/QCommandBuffer.h b/src/frontends/qt4/QCommandBuffer.h index e221383af7..bd1fafd66d 100644 --- a/src/frontends/qt4/QCommandBuffer.h +++ b/src/frontends/qt4/QCommandBuffer.h @@ -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();