Tulip  5.4.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 <string>
25 #include <vector>
26 
27 #include <tulip/InteractorComposite.h>
28 #include <tulip/Graph.h>
29 
30 namespace Ui {
31 class ElementInformationWidget;
32 }
33 
34 class QWidget;
35 class QGraphicsProxyWidget;
36 class QTableView;
37 class QAbstractItemModel;
38 class QObject;
39 class QSortFilterProxyModel;
40 
41 namespace tlp {
42 
43 class View;
44 class ViewWidget;
45 class GlMainWidget;
46 struct SelectedEntity;
47 
48 /**
49  * We define a specific interactor to show element graph information in eltProperties
50  */
51 class TLP_QT_SCOPE MouseShowElementInfo : public InteractorComponent {
52 
53  Ui::ElementInformationWidget *_ui;
54  Q_OBJECT
55 
56 public:
57  MouseShowElementInfo(const bool showVisualPropButton = true);
58  ~MouseShowElementInfo() override;
59  bool eventFilter(QObject *widget, QEvent *e) override;
60 
61  void viewChanged(View *) override;
62 
63  void clear() override;
64 
65  virtual bool pick(int x, int y, SelectedEntity &selectedEntity);
66 
67  void setVisibleProperties(const std::vector<std::string> &props);
68 
69 protected:
70  ViewWidget *_view;
71  QWidget *_informationWidget;
72  QGraphicsProxyWidget *_informationWidgetItem;
73  GlMainWidget *glMainWidget;
74  bool _show;
75  QSortFilterProxyModel *_model;
76 
77  QTableView *tableView() const;
78  std::vector<std::string> _visibleProps;
79 
80  /**
81  * @brief buildModel creates and returns the model to visualize edit element parameters.
82  * @param elementType the type of the element can be NODE or EDGE
83  * @param elementId elementId the id of the element
84  * @param parent the parent for the model creation.
85  * @return
86  */
87  virtual QAbstractItemModel *buildModel(ElementType elementType, unsigned int elementId,
88  QObject *parent) const;
89  /**
90  * @brief elementName returns the title of the element.
91  * @param elementType the type of the element can be NODE or EDGE
92  * @param elementId the id of the element
93  * @return
94  */
95  virtual QString elementName(ElementType elementType, unsigned int elementId) const;
96 
97 private slots:
98 
99  void showVisualProp(bool show);
100  void hideInfos();
101 };
102 } // namespace tlp
103 
104 #endif
105 ///@endcond