]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QCommandEdit.C
Lots and lots of little trivial bits.
[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 #ifdef __GNUG__
14 #pragma implementation
15 #endif
16
17 QCommandEdit::QCommandEdit(QWidget * parent)
18         : QLineEdit(parent)
19
20         setFocusPolicy(QWidget::ClickFocus); 
21 }
22
23
24 void QCommandEdit::keyPressEvent(QKeyEvent * e)
25 {
26         switch (e->key()) {
27                 case Key_Escape:
28                         emit escapePressed();
29                         break;
30  
31                 case Key_Up:
32                         emit upPressed();
33                         break;
34
35                 case Key_Down:
36                         emit downPressed();
37                         break;
38
39                 case Key_Right:
40                         if (cursorPosition() == text().length())
41                                 emit rightPressed();
42                         else
43                                 QLineEdit::keyPressEvent(e);
44                         break;
45
46                 default:
47                         QLineEdit::keyPressEvent(e);
48                         break;
49         }
50 }