]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QCommandEdit.C
bdedfd34c3f884c8372ffae5df982e8f904a812c
[lyx.git] / src / frontends / qt2 / QCommandEdit.C
1 /**
2  * \file QCommandEdit.C
3  * Copyright 2002 the LyX Team
4  * Read the file COPYING
5  *
6  * \author John Levon <moz@compsoc.man.ac.uk>
7  */
8
9 #include "QCommandEdit.h"
10  
11 QCommandEdit::QCommandEdit(QWidget * parent)
12         : QLineEdit(parent)
13
14         setFocusPolicy(QWidget::ClickFocus); 
15 }
16
17
18 void QCommandEdit::keyPressEvent(QKeyEvent * e)
19 {
20         switch (e->key()) {
21                 case Key_Escape:
22                         emit escapePressed();
23                         break;
24  
25                 case Key_Up:
26                         emit upPressed();
27                         break;
28
29                 case Key_Down:
30                         emit downPressed();
31                         break;
32
33                 case Key_Right:
34                         if (cursorPosition() == text().length())
35                                 emit rightPressed();
36                         else
37                                 QLineEdit::keyPressEvent(e);
38                         break;
39
40                 default:
41                         QLineEdit::keyPressEvent(e);
42                         break;
43         }
44 }