Implement shortcut (M-x) to hide the minibuffer

* src/frontends/controllers/ControlCommandBuffer.{cpp,h}:
	- new member hide()
* src/frontends/qt4QCommandEdit.{cpp,h}:
	- new signal hidePressed(), emit it on M-x/Alt-x
* src/frontends/qt4/QCommandBuffer.{cpp,h}:
	- new slot hideParent(), connected to QCommandEdit::hidePressed()

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18081 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2007-04-29 08:58:09 +00:00
parent b3548c1f72
commit b0b7aa2bf5
6 changed files with 31 additions and 0 deletions

View File

@ -85,6 +85,12 @@ docstring const ControlCommandBuffer::getCurrentState() const
}
void ControlCommandBuffer::hide() const
{
lv_.getToolbars().display("minibuffer", false);
}
vector<string> const
ControlCommandBuffer::completions(string const & prefix, string & new_prefix)
{

View File

@ -44,6 +44,9 @@ public:
/// return the font and depth in the active BufferView as a message.
docstring const getCurrentState() const;
/// hide the command buffer.
void hide() const;
/// return the possible completions
std::vector<std::string> const completions(std::string const & prefix,
std::string & new_prefix);

View File

@ -101,6 +101,7 @@ QCommandBuffer::QCommandBuffer(GuiView * view, ControlCommandBuffer & control)
connect(edit_, SIGNAL(tabPressed()), this, SLOT(complete()));
connect(edit_, SIGNAL(upPressed()), this, SLOT(up()));
connect(edit_, SIGNAL(downPressed()), this, SLOT(down()));
connect(edit_, SIGNAL(hidePressed()), this, SLOT(hideParent()));
layout->addWidget(up, 0);
layout->addWidget(down, 0);
@ -214,6 +215,15 @@ void QCommandBuffer::down()
}
void QCommandBuffer::hideParent()
{
view_->setFocus();
edit_->setText(QString());
edit_->clearFocus();
controller_.hide();
}
#if 0
void XMiniBuffer::show_info_suffix(string const & suffix, string const & input)
{

View File

@ -43,6 +43,8 @@ public Q_SLOTS:
void up();
/// down
void down();
/// leave and hide the command buffer
void hideParent();
private:
/// owning view
GuiView * view_;

View File

@ -43,6 +43,14 @@ void QCommandEdit::keyPressEvent(QKeyEvent * e)
downPressed();
break;
case Qt::Key_X:
if (e->modifiers() == Qt::AltModifier
|| e->modifiers() == Qt::MetaModifier) {
// emit signal
hidePressed();
break;
}
default:
QLineEdit::keyPressEvent(e);
break;

View File

@ -32,6 +32,8 @@ Q_SIGNALS:
void downPressed();
/// complete
void tabPressed();
/// leave and hide command buffer
void hidePressed();
protected:
///