Tulip  5.0.0
Large graphs analysis and drawing
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  void setGlMainWidget(tlp::GlMainWidget *);
53 
54  bool eventFilter(QObject *, QEvent *evt);
55 
56 signals:
57 
58  void widgetPainted(bool redraw);
59 
60 protected :
61  void keyPressEvent(QKeyEvent *event);
62  void keyReleaseEvent(QKeyEvent *event);
63  void wheelEvent(QGraphicsSceneWheelEvent *event);
64  void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
65  void mousePressEvent(QGraphicsSceneMouseEvent *event);
66  void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
67  void hoverMoveEvent(QGraphicsSceneHoverEvent * event);
68  void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
69  void contextMenuEvent(QGraphicsSceneContextMenuEvent * event);
70  void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
71  void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
72  void dragMoveEvent(QGraphicsSceneDragDropEvent *event);
73  void dropEvent(QGraphicsSceneDragDropEvent *event);
74 
75 protected slots:
76  void glMainWidgetDraw(GlMainWidget *,bool);
77  void glMainWidgetRedraw(GlMainWidget *);
78 
79 private :
80  tlp::GlMainWidget *glMainWidget;
81  bool _redrawNeeded;
82  bool _graphChanged;
83  int width, height;
84 };
85 
86 }
87 
88 #endif // GLMAINWIDGETGRAPHICSITEM_H
89 ///@endcond
This widget provide a simple system to visualize data/graph with OpenGL 3D engine.
Definition: GlMainWidget.h:67