anatomist  5.1.2
3D neuroimaging data viewer
glwidget.h
Go to the documentation of this file.
1 /* This software and supporting documentation are distributed by
2  * Institut Federatif de Recherche 49
3  * CEA/NeuroSpin, Batiment 145,
4  * 91191 Gif-sur-Yvette cedex
5  * France
6  *
7  * This software is governed by the CeCILL-B license under
8  * French law and abiding by the rules of distribution of free software.
9  * You can use, modify and/or redistribute the software under the
10  * terms of the CeCILL-B license as circulated by CEA, CNRS
11  * and INRIA at the following URL "http://www.cecill.info".
12  *
13  * As a counterpart to the access to the source code and rights to copy,
14  * modify and redistribute granted by the license, users are provided only
15  * with a limited warranty and the software's author, the holder of the
16  * economic rights, and the successive licensors have only limited
17  * liability.
18  *
19  * In this respect, the user's attention is drawn to the risks associated
20  * with loading, using, modifying and/or developing or reproducing the
21  * software by the user in light of its specific status of free software,
22  * that may mean that it is complicated to manipulate, and that also
23  * therefore means that it is reserved for developers and experienced
24  * professionals having in-depth computer knowledge. Users are therefore
25  * encouraged to load and test the software's suitability as regards their
26  * requirements in conditions enabling the security of their systems and/or
27  * data to be ensured and, more generally, to use and operate it in the
28  * same conditions as regards security.
29  *
30  * The fact that you are presently reading this means that you have had
31  * knowledge of the CeCILL-B license and that you accept its terms.
32  */
33 
34 
35 #ifndef ANATOMIST_WINDOW_GLWIDGET_H
36 #define ANATOMIST_WINDOW_GLWIDGET_H
37 
38 #include <qglobal.h>
39 #if QT_VERSION >= 0x060000
40 #define ANA_USE_QOPENGLWIDGET 1
41 #include <QOpenGLWidget>
42 #include <QOpenGLFunctions>
43 #else
45 #endif
47 
48 
49 #ifdef ANA_USE_QOPENGLWIDGET
50 class QAGLWidget : public QOpenGLWidget,
52  protected QOpenGLFunctions
53 #else
55 #endif
56 {
57  Q_OBJECT
58 
59 public:
60  QAGLWidget( anatomist::AWindow* win, QWidget* parent = 0,
61  const char* name = 0,
62 #ifdef ANA_USE_QOPENGLWIDGET
63  const QOpenGLWidget * shareWidget = 0,
64  Qt::WindowFlags f=Qt::WindowFlags() );
65 #else
66  const QGLWidget * shareWidget = 0,
67  Qt::WindowFlags f=Qt::WindowFlags() );
68 #endif
69  virtual ~QAGLWidget();
70 
71  virtual QSize sizeHint() const;
72  virtual QSize minimumSizeHint() const;
73  virtual std::string name() const;
74 
75  int width()
76  {
77 #ifdef ANA_USE_QOPENGLWIDGET
78  return QOpenGLWidget::width();
79 #else
80  return carto::GLWidget::width();
81 #endif
82  }
83 
84  int height()
85  {
86 #ifdef ANA_USE_QOPENGLWIDGET
87  return QOpenGLWidget::height();
88 #else
89  return carto::GLWidget::height();
90 #endif
91  }
92 
93 signals:
94  void viewRendered();
95 
96 public slots:
98  virtual void updateGL();
99  void debugPrint();
100 
101 protected:
102 #if QT_VERSION >= 0x040600
103  virtual bool event( QEvent * );
104 #endif
105  virtual void initializeGL() Q_DECL_OVERRIDE;
106  virtual void resizeGL( int w, int h ) Q_DECL_OVERRIDE;
107  virtual void paintGL() Q_DECL_OVERRIDE;
108  virtual void mousePressEvent( QMouseEvent* me );
109  virtual void mouseReleaseEvent( QMouseEvent* me );
110  virtual void mouseMoveEvent( QMouseEvent* me );
111  virtual void mouseDoubleClickEvent( QMouseEvent * );
112  virtual void keyPressEvent( QKeyEvent* ev );
113  virtual void keyReleaseEvent( QKeyEvent* ev );
114  virtual void focusInEvent( QFocusEvent * );
115  virtual void focusOutEvent( QFocusEvent * );
116  virtual void wheelEvent( QWheelEvent * );
117 
118 private:
119  bool _paintDone;
120 };
121 
122 
123 #endif
#define slots
void debugPrint()
virtual void resizeGL(int w, int h) Q_DECL_OVERRIDE
virtual void focusInEvent(QFocusEvent *)
virtual void mouseReleaseEvent(QMouseEvent *me)
virtual void keyReleaseEvent(QKeyEvent *ev)
int height()
Definition: glwidget.h:84
QAGLWidget(anatomist::AWindow *win, QWidget *parent=0, const char *name=0, const QGLWidget *shareWidget=0, Qt::WindowFlags f=Qt::WindowFlags())
virtual void mousePressEvent(QMouseEvent *me)
virtual void focusOutEvent(QFocusEvent *)
virtual void mouseDoubleClickEvent(QMouseEvent *)
virtual void mouseMoveEvent(QMouseEvent *me)
virtual QSize sizeHint() const
virtual std::string name() const
virtual QSize minimumSizeHint() const
virtual void updateGL()
to be reimplemented in "public slots"
virtual void wheelEvent(QWheelEvent *)
virtual ~QAGLWidget()
virtual void initializeGL() Q_DECL_OVERRIDE
void viewRendered()
virtual void paintGL() Q_DECL_OVERRIDE
virtual void keyPressEvent(QKeyEvent *ev)
int width()
Definition: glwidget.h:75
Abstract base class Anatomist window.
Definition: Window.h:58
Base class for OpenGL-rendering widget.