GraphTool  1.0
Tool for analyzing and graphically visualizing code dependencies for Ericsson.
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
search_box.h
1 #ifndef GUI_SEARCH_BOX
2 #define GUI_SEARCH_BOX
3 
4 #include <QWidget>
5 #include <QObject>
6 #include <QString>
7 #include <QStringList>
8 #include <QCompleter>
9 #include <string>
10 #include <QStringListModel>
11 #include "ui_searchbox.h"
12 #include "graph_model.h"
13 #include "filter_menu.h"
14 
18 class SearchBox : public QWidget, private Ui::SearchBox {
19  Q_OBJECT
20 
21  public:
29  SearchBox(QWidget* parent = 0);
30  ~SearchBox();
31 
36  std::string search_term();
37  std::string search_type();
38 
44  void setAutocompletionModel(GraphModel* new_model);
45 
50  void setAutocompletionList(QStringList wordList);
51 
52  signals:
58  void search(std::string searchTerm, std::string searchType);
59 
64  void searchTypeChanged(std::string new_type);
65 
66  protected slots:
71  void on_searchButton_clicked(bool checked = false);
72 
77 
82  void on_searchType_currentIndexChanged(QString new_type);
83 
84  private:
85  // The auto complete / search suggestion widget needed to display the suggestions beneath the search field
86  QCompleter* autocompleter_;
87  // The previous search - used to not perform a new search if the string hasn't changed since last
88  std::string prev_search;
89  // Model used for autocompletion
90  QAbstractItemModel* model_;
91 
92 };
93 
94 #endif
SearchBox(QWidget *parent=0)
Definition: search_box.cc:4
Definition: graph_model.h:36
Definition: search_box.h:18
Definition: ui_searchbox.h:97
void setAutocompletionList(QStringList wordList)
Definition: search_box.cc:42
void search(std::string searchTerm, std::string searchType)
std::string search_term()
Definition: search_box.cc:26
void searchTypeChanged(std::string new_type)
void setAutocompletionModel(GraphModel *new_model)
Definition: search_box.cc:34
void on_searchType_currentIndexChanged(QString new_type)
Definition: search_box.cc:49
void on_searchText_returnPressed()
Definition: search_box.cc:62
void on_searchButton_clicked(bool checked=false)
Definition: search_box.cc:54