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