Tulip  5.1.0
Large graphs analysis and drawing
MouseShowElementInfo.h
1 /*
2  *
3  * This file is part of Tulip (http://tulip.labri.fr)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 ///@cond DOXYGEN_HIDDEN
20 
21 #ifndef _Tulip_MOUSESHOWELEMENTINFO_H
22 #define _Tulip_MOUSESHOWELEMENTINFO_H
23 
24 #include <tulip/InteractorComposite.h>
25 #include <tulip/Graph.h>
26 
27 namespace Ui {
28 class ElementInformationWidget;
29 }
30 
31 class QWidget;
32 class QGraphicsProxyWidget;
33 class QTableView;
34 class QAbstractItemModel;
35 class QObject;
36 
37 namespace tlp {
38 
39 class View;
40 class ViewWidget;
41 class GlMainWidget;
42 struct SelectedEntity;
43 
44 /**
45  * We define a specific interactor to show element graph information in eltProperties
46  */
47 class TLP_QT_SCOPE MouseShowElementInfo : public InteractorComponent {
48 
49  Ui::ElementInformationWidget* _ui;
50  Q_OBJECT
51 
52 public:
53  MouseShowElementInfo(const bool showVisualPropButton=true);
54  ~MouseShowElementInfo();
55  virtual bool eventFilter(QObject* widget, QEvent* e);
56 
57  void viewChanged(View *);
58 
59  void clear();
60 
61  virtual bool pick(int x, int y, SelectedEntity &selectedEntity);
62 
63 protected:
64 
65  ViewWidget *_view;
66  QWidget *_informationWidget;
67  QGraphicsProxyWidget *_informationWidgetItem;
68  GlMainWidget* glMainWidget;
69  bool _show;
70 
71  QTableView* tableView() const;
72 
73  /**
74  * @brief buildModel creates and returns the model to visualize edit element parameters.
75  * @param elementType the type of the element can be NODE or EDGE
76  * @param elementId elementId the id of the element
77  * @param parent the parent for the model creation.
78  * @return
79  */
80  virtual QAbstractItemModel* buildModel(ElementType elementType, unsigned int elementId, QObject *parent)const;
81  /**
82  * @brief elementName returns the title of the element.
83  * @param elementType the type of the element can be NODE or EDGE
84  * @param elementId the id of the element
85  * @return
86  */
87  virtual QString elementName(ElementType elementType, unsigned int elementId)const;
88 private slots:
89  void showVisualProp(int show);
90 };
91 
92 }
93 
94 
95 
96 #endif
97 ///@endcond