QTfrontend/ui/widget/HistoryLineEdit.cpp
changeset 6616 f77bb02b669f
parent 6205 7764cbe4ddd7
child 6700 e04da46ee43c
equal deleted inserted replaced
6615:65602f1ef0f8 6616:f77bb02b669f
    25 #include <QStringList>
    25 #include <QStringList>
    26 
    26 
    27 #include "HistoryLineEdit.h"
    27 #include "HistoryLineEdit.h"
    28 
    28 
    29 HistoryLineEdit::HistoryLineEdit(QWidget * parent, int maxHistorySize)
    29 HistoryLineEdit::HistoryLineEdit(QWidget * parent, int maxHistorySize)
    30 : QLineEdit(parent)
    30     : QLineEdit(parent)
    31 {
    31 {
    32     m_curHistEntryIdx = 0;
    32     m_curHistEntryIdx = 0;
    33     m_maxHistorySize = maxHistorySize;
    33     m_maxHistorySize = maxHistorySize;
    34     m_history = new QStringList();
    34     m_history = new QStringList();
    35 }
    35 }
    78 
    78 
    79 void HistoryLineEdit::navigateHistory(bool isGoingUp)
    79 void HistoryLineEdit::navigateHistory(bool isGoingUp)
    80 {
    80 {
    81     // save possible changes to new entry
    81     // save possible changes to new entry
    82     if ((m_curHistEntryIdx >= m_history->size() ||
    82     if ((m_curHistEntryIdx >= m_history->size() ||
    83         (text() != m_history->at(m_curHistEntryIdx))))
    83             (text() != m_history->at(m_curHistEntryIdx))))
    84         {
    84     {
    85             rememberCurrentText();
    85         rememberCurrentText();
    86         }
    86     }
    87 
    87 
    88     if (isGoingUp)
    88     if (isGoingUp)
    89         m_curHistEntryIdx--;
    89         m_curHistEntryIdx--;
    90     else
    90     else
    91         m_curHistEntryIdx++;
    91         m_curHistEntryIdx++;