anatomist 6.0.4
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>
40#ifdef ANA_USE_QOPENGLWIDGET
41#include <QOpenGLWidget>
42#include <QOpenGLFunctions>
43#else
45#endif
46
47
48#ifdef ANA_USE_QOPENGLWIDGET
49class QAGLWidget : public QOpenGLWidget,
51 protected QOpenGLFunctions
52#else
54#endif
55{
56 Q_OBJECT
57
58public:
59 QAGLWidget( anatomist::AWindow* win, QWidget* parent = 0,
60 const char* name = 0,
61#ifdef ANA_USE_QOPENGLWIDGET
62 const QOpenGLWidget * shareWidget = 0,
63 Qt::WindowFlags f=Qt::WindowFlags() );
64#else
65 const QGLWidget * shareWidget = 0,
66 Qt::WindowFlags f=Qt::WindowFlags() );
67#endif
68 virtual ~QAGLWidget();
69
70 virtual QSize sizeHint() const;
71 virtual QSize minimumSizeHint() const;
72 virtual std::string name() const;
73
74 int width()
75 {
76#ifdef ANA_USE_QOPENGLWIDGET
77 return QOpenGLWidget::width();
78#else
79 return carto::GLWidget::width();
80#endif
81 }
82
83 int height()
84 {
85#ifdef ANA_USE_QOPENGLWIDGET
86 return QOpenGLWidget::height();
87#else
88 return carto::GLWidget::height();
89#endif
90 }
91
92signals:
94
95public slots:
97 virtual void updateGL();
98 void debugPrint();
99
100protected:
101 virtual bool event( QEvent * );
102 virtual void initializeGL() Q_DECL_OVERRIDE;
103 virtual void resizeGL( int w, int h ) Q_DECL_OVERRIDE;
104 virtual void paintGL() Q_DECL_OVERRIDE;
105 virtual void mousePressEvent( QMouseEvent* me );
106 virtual void mouseReleaseEvent( QMouseEvent* me );
107 virtual void mouseMoveEvent( QMouseEvent* me );
108 virtual void mouseDoubleClickEvent( QMouseEvent * );
109 virtual void keyPressEvent( QKeyEvent* ev );
110 virtual void keyReleaseEvent( QKeyEvent* ev );
111 virtual void focusInEvent( QFocusEvent * );
112 virtual void focusOutEvent( QFocusEvent * );
113 virtual void wheelEvent( QWheelEvent * );
114
115private:
116 bool _paintDone;
117};
118
119
120#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:83
QAGLWidget(anatomist::AWindow *win, QWidget *parent=0, const char *name=0, const QGLWidget *shareWidget=0, Qt::WindowFlags f=Qt::WindowFlags())
virtual bool event(QEvent *)
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:74
Abstract base class Anatomist window.
Definition Window.h:59
Base class for OpenGL-rendering widget.