mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-15 23:49:37 +00:00
7ac700920f
Now the minibuffer toolbar is "auto" by default. It is opened by command-execute (M-x) and closed when the command is executed without error. * make lyx::dispatch return a DispatchResult struct * there is a new MINIBUFFER type of toolbar, that can be used for this use. * remove special handling of M-x in minnibuffer; Escape can be used instead. Fix focus in this case. * when minibuffer toolbar is "auto", make the toolbar close itself after - a command has been executed without error - an empty command has been executed - the Escape key has been used [this is actually commitfdcff02a
, which was later reverted atdd61d8cf
]
74 lines
1.1 KiB
C++
74 lines
1.1 KiB
C++
/**
|
|
* \file GuiCommandEdit.cpp
|
|
* This file is part of LyX, the document processor.
|
|
* Licence details can be found in the file COPYING.
|
|
*
|
|
* \author John Levon
|
|
*
|
|
* Full author contact details are available in file CREDITS.
|
|
*/
|
|
|
|
#include <config.h>
|
|
|
|
#include "GuiCommandEdit.h"
|
|
|
|
#include <QKeyEvent>
|
|
#include <QEvent>
|
|
|
|
#undef KeyPress
|
|
|
|
namespace lyx {
|
|
namespace frontend {
|
|
|
|
GuiCommandEdit::GuiCommandEdit(QWidget * parent)
|
|
: QLineEdit(parent)
|
|
{
|
|
setFocusPolicy(Qt::ClickFocus);
|
|
}
|
|
|
|
|
|
void GuiCommandEdit::keyPressEvent(QKeyEvent * e)
|
|
{
|
|
switch (e->key()) {
|
|
case Qt::Key_Escape:
|
|
// emit signal
|
|
escapePressed();
|
|
break;
|
|
|
|
case Qt::Key_Up:
|
|
// emit signal
|
|
upPressed();
|
|
break;
|
|
|
|
case Qt::Key_Down:
|
|
// emit signal
|
|
downPressed();
|
|
break;
|
|
|
|
default:
|
|
QLineEdit::keyPressEvent(e);
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
bool GuiCommandEdit::event(QEvent * e)
|
|
{
|
|
if (e->type() != QEvent::KeyPress)
|
|
return QLineEdit::event(e);
|
|
|
|
QKeyEvent * ev = (QKeyEvent *)e;
|
|
|
|
if (ev->key() != Qt::Key_Tab)
|
|
return QLineEdit::event(e);
|
|
|
|
// emit signal
|
|
tabPressed();
|
|
return true;
|
|
}
|
|
|
|
} // namespace frontend
|
|
} // namespace lyx
|
|
|
|
#include "moc_GuiCommandEdit.cpp"
|