1 #ifndef SEARCHLINEEDIT_H
2 #define SEARCHLINEEDIT_H
3 
4 #include <QtWidgets>
5 
6 #include "searchwidget.h"
7 
8 class SearchLineEdit : public QLineEdit, public SearchWidget {
9     Q_OBJECT
10 
11 public:
12     explicit SearchLineEdit(QWidget *parent = nullptr);
13 
14     // SearchWidget interface
15     QMenu *menu() const;
16     void setMenu(QMenu *menu);
17     void enableSuggest();
18     void preventSuggest();
19     void setSuggester(Suggester *suggester);
20     AutoComplete *getAutoComplete();
21     void emitTextChanged(const QString &text);
22     QLineEdit *getLineEdit();
23     QWidget *toWidget();
24 
setPlaceholderText(const QString & text)25     void setPlaceholderText(const QString &text) { QLineEdit::setPlaceholderText(text); }
selectAll()26     void selectAll() { QLineEdit::selectAll(); }
setText(const QString & text)27     void setText(const QString &text) { QLineEdit::setText(text); }
text()28     QString text() { return QLineEdit::text(); }
29 
30 public slots:
31     void returnPressed();
32 
33 signals:
34     void search(const QString &text);
35     void suggestionAccepted(Suggestion *suggestion);
36 
37 private:
38     AutoComplete *autoComplete;
39 };
40 
41 #endif // SEARCHLINEEDIT_H
42