GraphTool  1.0
Tool for analyzing and graphically visualizing code dependencies for Ericsson.
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
treeview.h
1 #ifndef GUI_TREEVIEW
2 #define GUI_TREEVIEW
3 
4 
5 // Necessary Qt-imports
6 #include <QWidget>
7 #include <QObject>
8 #include <QTreeView>
9 #include <QTabWidget>
10 #include <QAction>
11 #include <QMenu>
12 #include <QKeyEvent>
13 #include <QStandardItem>
14 #include <QSortFilterProxyModel>
15 
16 // The UI-component itself
17 #include "ui_treeview.h"
18 
19 // The graph model used for the tree view
20 #include "graph_model.h"
21 
26 class TreeView : public QWidget, private Ui::TreeView {
27  Q_OBJECT
28 
29  public:
30 
35  TreeView(QWidget* parent = 0);
36 
37  ~TreeView();
38 
49  void setModel(
50  QSortFilterProxyModel* new_model_dependents,
51  QSortFilterProxyModel* new_model_depenencies,
52  QSortFilterProxyModel* new_model_both,
53  std::string root_name);
54 
59  QSortFilterProxyModel* model_dependencies();
60 
65  QSortFilterProxyModel* model_dependents();
66 
71  QSortFilterProxyModel* model_both();
72 
79  void select_row_in_treeview(std::string item, bool last);
80 
85 
89  std::vector<QTreeView*> tree_views();
90 
96  int column_index(QString str);
97 
101  void resize_columns_to_fit();
102 
103  private:
104 
106  std::vector<QTreeView*> treeViews;
107 
109  QAbstractItemView::SelectionMode selection_mode_;
110 
112  QList<QModelIndex> expanded_items_;
113 
114 
115  public slots:
116 
121  void expand_row(QModelIndex item);
122 
127  void treeview_column_action(QAction* action);
128 
133  void onCustomContextMenu(const QPoint &point);
134 
139  void item_action(QAction* action);
140 
145  void keyPressEvent(QKeyEvent* event);
146 
151  void keyReleaseEvent(QKeyEvent* event);
152 
157  void mouseEvent(QModelIndex item);
158 
159 
160  signals:
161 
167  void expand_item_in_graph(std::string item_name, bool last);
168 
174  void contract_item_in_graph(std::string item_name, bool last);
175 
176 
182  void item_selected_in_treeview(std::string item_name, bool first, bool multiple);
183 
188  void focus_item_in_graph(std::string item_name);
189 
195  void exclude_item_in_graph(std::string item_name, bool last);
196 
197 };
198 
199 #endif
void onCustomContextMenu(const QPoint &point)
Definition: treeview.cc:163
int column_index(QString str)
Definition: treeview.cc:91
void select_row_in_treeview(std::string item, bool last)
Definition: treeview.cc:272
TreeView(QWidget *parent=0)
Definition: treeview.cc:5
QSortFilterProxyModel * model_dependents()
Definition: treeview.cc:67
QSortFilterProxyModel * model_both()
Definition: treeview.cc:59
Definition: ui_treeview.h:202
void keyPressEvent(QKeyEvent *event)
Definition: treeview.cc:112
void item_action(QAction *action)
Definition: treeview.cc:214
QSortFilterProxyModel * model_dependencies()
Definition: treeview.cc:63
void mouseEvent(QModelIndex item)
Definition: treeview.cc:132
void expand_item_in_graph(std::string item_name, bool last)
void item_selected_in_treeview(std::string item_name, bool first, bool multiple)
void expand_row(QModelIndex item)
Definition: treeview.cc:75
void treeview_column_action(QAction *action)
Definition: treeview.cc:80
Definition: treeview.h:26
void deselect_all_rows_in_treeview()
Definition: treeview.cc:315
void exclude_item_in_graph(std::string item_name, bool last)
std::vector< QTreeView * > tree_views()
Definition: treeview.cc:71
void resize_columns_to_fit()
Definition: treeview.cc:102
void setModel(QSortFilterProxyModel *new_model_dependents, QSortFilterProxyModel *new_model_depenencies, QSortFilterProxyModel *new_model_both, std::string root_name)
Definition: treeview.cc:36
void keyReleaseEvent(QKeyEvent *event)
Definition: treeview.cc:125
void focus_item_in_graph(std::string item_name)
void contract_item_in_graph(std::string item_name, bool last)