Tulip  4.8.0
Better Visualization Through Research
 All Classes Files Functions Variables Enumerations Enumerator Properties Groups Pages
GlMainWidgetGraphicsItem.h
1 /*
2  *
3  * This file is part of Tulip (www.tulip-software.org)
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 GLMAINWIDGETGRAPHICSITEM_H
22 #define GLMAINWIDGETGRAPHICSITEM_H
23 
24 #include <QGraphicsObject>
25 
26 
27 #include <tulip/tulipconf.h>
28 
29 namespace tlp {
30 class GlMainWidget;
31 
32 class TLP_QT_SCOPE GlMainWidgetGraphicsItem : public QGraphicsObject {
33  Q_OBJECT
34 public:
35  GlMainWidgetGraphicsItem(tlp::GlMainWidget *glMainWidget, int width, int height);
36  virtual ~GlMainWidgetGraphicsItem();
37 
38  void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
39 
40  QRectF boundingRect() const;
41 
42  void resize(int width, int height);
43 
44  void setRedrawNeeded(bool redrawNeeded) {
45  this->_redrawNeeded=redrawNeeded;
46  }
47 
48  tlp::GlMainWidget *getGlMainWidget() {
49  return glMainWidget;
50  }
51 
52  bool eventFilter(QObject *, QEvent *evt);
53 
54 signals:
55 
56  void widgetPainted(bool redraw);
57 
58 protected :
59  void keyPressEvent(QKeyEvent *event);
60  void keyReleaseEvent(QKeyEvent *event);
61  void wheelEvent(QGraphicsSceneWheelEvent *event);
62  void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
63  void mousePressEvent(QGraphicsSceneMouseEvent *event);
64  void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
65  void hoverMoveEvent(QGraphicsSceneHoverEvent * event);
66  void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
67  void contextMenuEvent(QGraphicsSceneContextMenuEvent * event);
68  void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
69  void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
70  void dragMoveEvent(QGraphicsSceneDragDropEvent *event);
71  void dropEvent(QGraphicsSceneDragDropEvent *event);
72 
73 protected slots:
74  void glMainWidgetDraw(GlMainWidget *,bool);
75  void glMainWidgetRedraw(GlMainWidget *);
76 
77 private :
78  tlp::GlMainWidget *glMainWidget;
79  bool _redrawNeeded;
80  bool _graphChanged;
81  int width, height;
82 };
83 
84 }
85 
86 #endif // GLMAINWIDGETGRAPHICSITEM_H
87 ///@endcond
This widget provide a simple system to visualize data/graph with OpenGL 3D engine.
Definition: GlMainWidget.h:67