File indexing completed on 2024-06-23 05:20:50

0001 /****************************************************************************
0002 **
0003 ** Copyright (c) 2007 Trolltech ASA <info@trolltech.com>
0004 ** Modified (c) 2009, 2011, 2013 by Glad Deschrijver <glad.deschrijver@gmail.com>
0005 **
0006 ** Use, modification and distribution is allowed without limitation,
0007 ** warranty, liability or support of any kind.
0008 **
0009 ****************************************************************************/
0010 
0011 #ifndef LINEEDIT_H
0012 #define LINEEDIT_H
0013 
0014 #include <QLineEdit>
0015 
0016 class QToolButton;
0017 
0018 class LineEdit : public QLineEdit
0019 {
0020     Q_OBJECT
0021 
0022 public:
0023     explicit LineEdit(const QString &text, QWidget *parent = 0);
0024     explicit LineEdit(QWidget *parent = 0);
0025     bool isHistoryEnabled();
0026     void setHistoryEnabled(bool enabled = true);
0027 
0028 signals:
0029     void textEditingFinished(const QString &text);
0030     void escapePressed();
0031 
0032 protected:
0033     bool eventFilter(QObject *o, QEvent *e);
0034     void keyReleaseEvent(QKeyEvent *ke);
0035 
0036 private Q_SLOTS:
0037     void learnEntry();
0038     void restoreInlineCompletion();
0039 
0040 private:
0041     bool m_historyEnabled;
0042     int m_historyPosition;
0043     QString m_currentText;
0044 };
0045 
0046 #endif // LINEEDIT_H