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-09-24 13:57:09 +00:00
|
|
|
* \author John Levon
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS
|
2002-07-19 23:05:24 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "QCommandEdit.h"
|
|
|
|
|
|
|
|
QCommandEdit::QCommandEdit(QWidget * parent)
|
|
|
|
: QLineEdit(parent)
|
|
|
|
{
|
2002-07-25 04:41:11 +00:00
|
|
|
setFocusPolicy(QWidget::ClickFocus);
|
2002-07-19 23:05:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QCommandEdit::keyPressEvent(QKeyEvent * e)
|
|
|
|
{
|
|
|
|
switch (e->key()) {
|
|
|
|
case Key_Escape:
|
|
|
|
emit escapePressed();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Key_Up:
|
|
|
|
emit upPressed();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Key_Down:
|
|
|
|
emit downPressed();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Key_Right:
|
2002-07-22 18:22:35 +00:00
|
|
|
if (cursorPosition() == text().length())
|
2002-07-19 23:05:24 +00:00
|
|
|
emit rightPressed();
|
|
|
|
else
|
|
|
|
QLineEdit::keyPressEvent(e);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
QLineEdit::keyPressEvent(e);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|