File: SpreadViewTableWidget.h

package info (click to toggle)
tulip 3.7.0dfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 39,428 kB
  • sloc: cpp: 231,403; php: 11,023; python: 1,128; sh: 671; yacc: 522; makefile: 315; xml: 63; lex: 55
file content (110 lines) | stat: -rwxr-xr-x 2,901 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#ifndef SPREADVIEWTABLEWIDGET_H
#define SPREADVIEWTABLEWIDGET_H

#include <QWidget>
#include <tulip/Graph.h>
#include <tulip/MutableContainer.h>
#include <tulip/ObservableProperty.h>

#include <QtCore/QModelIndex>
#include <QtGui/QMenu>


namespace Ui {
class SpreadViewTableWidget;
}
class TulipTableWidgetColumnSelectionWidget;
class GraphTableWidget;
class TulipTableWidgetColumnSelectionModel;

class SpreadViewTableWidget : public QWidget, public tlp::PropertyObserver, public tlp::Observable {
  Q_OBJECT

public:
  explicit SpreadViewTableWidget(QWidget *parent = 0);
  ~SpreadViewTableWidget();

  void setData(tlp::Graph* graph,const tlp::DataSet& data,tlp::ElementType type);
  tlp::DataSet getData()const;

  TulipTableWidgetColumnSelectionWidget* columnEditionWidget();

  GraphTableWidget* graphTableWidget();

  void update();

public slots:

  /**
    * @brief Delete the highligted elements from the graph.
    **/
  void deleteHighlightedElements();

private slots:

  //Menu slots
  /**
  * @brief Show property menu
  **/
  void showPropertiesContextMenu(const QPoint& position);
  /**
  * @brief Show the context menu when user click on the table view.
  **/
  void showTableContextMenu(const QPoint& position);
  /**
  * @brief Called when user request the context menu on the elements header view.
  */
  void showElementsContextMenu(const QPoint& position);

  void updateElementVisibility(int state);
  void showOnlySelectedElements(bool show);

  void filterColumnChanged(int index);

  void filterElements();

  //Columns operations
  void hideColumn();
  void createNewProperties();
  void copyColumnToOther();
  void setAllColumnValues();
  void resetColumn();
  void deleteColumn();

  //Rows operations
  void selectElements();
  void addToSelection();
  void removeFromSelection();
  void highlightElements();

  //Nodes operations
  void copyNodes();
  void group();
  void ungroup();

private:

  void showPropertiesContextMenu(GraphTableWidget* tableWidget,int clickedColumn,const QPoint& position);
  void fillPropertiesContextMenu(QMenu& menu,GraphTableWidget* tableWidget,int clickedColumn);
  /**
    * @brief Execute the context menu for the selected row.
    **/
  void showElementsContextMenu(GraphTableWidget* tableWidget,int clickedRowIndex,const QPoint& position);
  void fillElementsContextMenu(QMenu& menu,GraphTableWidget* tableWidget,int clickedRowIndex);

  void deleteHighlightedElements( const QModelIndexList& elements,GraphTableWidget *tableWidget ,bool delAll);

  bool displayOnlySelectedElements()const;
  QRegExp elementValuesFilter()const;

  void updateSelectionForHighlightedElements(GraphTableWidget* tableWidget,bool select,bool clearOldSelection=false);

  void refreshFilter();
  void invalidateFilter();

  Ui::SpreadViewTableWidget *ui;

  TulipTableWidgetColumnSelectionModel *_tableColumnModel;
};

#endif // SPREADVIEWTABLEWIDGET_H