2002-07-19 23:05:24 +00:00
|
|
|
/**
|
|
|
|
* \file QCommandEdit.C
|
2002-09-24 13:57:09 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-07-19 23:05:24 +00:00
|
|
|
*
|
2002-10-20 01:48:28 +00:00
|
|
|
* \author John Levon
|
2002-09-24 13:57:09 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS
|
2002-07-19 23:05:24 +00:00
|
|
|
*/
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2002-07-19 23:05:24 +00:00
|
|
|
#include "QCommandEdit.h"
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2002-07-19 23:05:24 +00:00
|
|
|
QCommandEdit::QCommandEdit(QWidget * parent)
|
|
|
|
: QLineEdit(parent)
|
2002-10-20 01:48:28 +00:00
|
|
|
{
|
|
|
|
setFocusPolicy(QWidget::ClickFocus);
|
2002-07-19 23:05:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QCommandEdit::keyPressEvent(QKeyEvent * e)
|
|
|
|
{
|
|
|
|
switch (e->key()) {
|
2002-10-20 01:48:28 +00:00
|
|
|
case Key_Escape:
|
|
|
|
emit escapePressed();
|
|
|
|
break;
|
2002-07-19 23:05:24 +00:00
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
case Key_Up:
|
|
|
|
emit upPressed();
|
2003-04-05 21:10:34 +00:00
|
|
|
break;
|
2002-07-19 23:05:24 +00:00
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
case Key_Down:
|
|
|
|
emit downPressed();
|
|
|
|
break;
|
2002-07-19 23:05:24 +00:00
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
default:
|
|
|
|
QLineEdit::keyPressEvent(e);
|
|
|
|
break;
|
2002-07-19 23:05:24 +00:00
|
|
|
}
|
|
|
|
}
|
2003-04-05 21:10:34 +00:00
|
|
|
|
|
|
|
|
2003-04-05 21:59:40 +00:00
|
|
|
bool QCommandEdit::event(QEvent * e)
|
2003-04-05 21:10:34 +00:00
|
|
|
{
|
2003-04-05 21:59:40 +00:00
|
|
|
if (e->type() != QEvent::KeyPress)
|
|
|
|
return QLineEdit::event(e);
|
|
|
|
|
|
|
|
QKeyEvent * ev = (QKeyEvent *)e;
|
|
|
|
|
|
|
|
if (ev->key() != Key_Tab)
|
|
|
|
return QLineEdit::event(e);
|
2003-04-05 21:10:34 +00:00
|
|
|
|
2003-04-05 21:59:40 +00:00
|
|
|
emit tabPressed();
|
|
|
|
return true;
|
2003-04-05 21:10:34 +00:00
|
|
|
}
|