]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QCommandEdit.C
fix build.
[lyx.git] / src / frontends / qt2 / QCommandEdit.C
1 /**
2  * \file QCommandEdit.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author John Levon 
7  *
8  * Full author contact details are available in file CREDITS
9  */
10
11 #include "QCommandEdit.h"
12  
13 QCommandEdit::QCommandEdit(QWidget * parent)
14         : QLineEdit(parent)
15
16         setFocusPolicy(QWidget::ClickFocus); 
17 }
18
19
20 void QCommandEdit::keyPressEvent(QKeyEvent * e)
21 {
22         switch (e->key()) {
23                 case Key_Escape:
24                         emit escapePressed();
25                         break;
26  
27                 case Key_Up:
28                         emit upPressed();
29                         break;
30
31                 case Key_Down:
32                         emit downPressed();
33                         break;
34
35                 case Key_Right:
36                         if (cursorPosition() == text().length())
37                                 emit rightPressed();
38                         else
39                                 QLineEdit::keyPressEvent(e);
40                         break;
41
42                 default:
43                         QLineEdit::keyPressEvent(e);
44                         break;
45         }
46 }