23 #include "memorylineedit.h" 
   27 MemoryLineEdit::MemoryLineEdit(QWidget *parent) : QLineEdit(parent)
 
   29         connect(
this, SIGNAL(returnPressed()), 
this, SLOT(storeCommand()));
 
   32 void MemoryLineEdit::keyPressEvent(QKeyEvent *event)
 
   34         if (history.count() != 0)
 
   36                 if (event->key() == Qt::Key_Up)
 
   38                         if (position != history.begin())
 
   42                 else if (event->key() == Qt::Key_Down && position != history.end())
 
   45                         if (position != history.end())
 
   51         QLineEdit::keyPressEvent(event);
 
   54 void MemoryLineEdit::storeCommand()
 
   56         history.append(text());
 
   57         if (history.count() > 50)
 
   58                 history.removeFirst();
 
   59         position = history.end();