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
This commit is contained in:
Abdelrazak Younes 2006-12-23 17:09:50 +00:00
parent 0d6a07b9c3
commit 42426e1423
5 changed files with 14 additions and 7 deletions

View 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);

View 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;
}

View File

@ -56,6 +56,7 @@ public:
virtual void init();
virtual void close();
virtual void setFocus();
virtual void setGeometry(
unsigned int width,
unsigned int height,

View 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();
}

View 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();