Go to the documentation of this file.
5 #ifndef GLVERTEX_QT_GLWINDOWUI_H
6 #define GLVERTEX_QT_GLWINDOWUI_H
10 #include <QApplication>
24 setlocale(LC_NUMERIC,
"C");
37 void keyPressEvent(QKeyEvent *event)
40 Qt::KeyboardModifier ctrl = Qt::ControlModifier;
42 Qt::KeyboardModifier ctrl = Qt::MetaModifier;
45 if (event->key() == Qt::Key_Escape)
47 else if (event->key()==Qt::Key_Space)
49 else if (event->modifiers() & ctrl)
50 if (event->key()==Qt::Key_R)
55 else if (event->key()==Qt::Key_Q)
58 lgl_Qt_GLWindow::keyPressEvent(event);
60 lgl_Qt_GLWindow::keyPressEvent(event);
65 void keyReleaseEvent(QKeyEvent *event)
67 if (event->key() == Qt::Key_Back)
70 lgl_Qt_GLWindow::keyReleaseEvent(event);
75 void mousePressEvent(QMouseEvent *event)
77 if (event->buttons() & Qt::LeftButton)
84 double x = (
event->x()+0.5)/width();
85 double y = (
event->y()+0.5)/height();
92 lastPos_ =
event->pos();
98 void mouseReleaseEvent(QMouseEvent *event)
100 if (!(event->buttons() & Qt::LeftButton))
105 if (spin_.
length() < 3.0/width()) spin_ =
vec2(0);
115 void mouseMoveEvent(QMouseEvent *event)
119 double dx = (double)(event->x()-lastPos_.x())/width();
120 double dy = (double)(event->y()-lastPos_.y())/height();
127 lastPos_ =
event->pos();
128 lastDelta_ =
vec2(dx, dy);
134 void mouseDoubleClickEvent(QMouseEvent *event)
136 if (event->buttons() & Qt::LeftButton)
138 double x = (
event->x()+0.5)/width();
139 double y = (
event->y()+0.5)/height();
148 void wheelEvent(QWheelEvent *event)
150 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
151 double numDegrees =
event->delta()/16.0;
153 if (event->orientation() == Qt::Vertical)
155 double numDegrees =
event->angleDelta().y()/16.0;
170 virtual void updateOpenGL(
double dt)
172 if (spin_.
norm() > 0)
182 return(spin_.
norm() > 0);
virtual void mouseClick(double x, double y)
reimplement to be called in case of a mouse click
Definition: glvertex_qt_glwindowui.h:190
double norm() const
get squared vector length
Definition: glslmath.h:136
void lglResetManip()
reset the manipulator matrix
Definition: glvertex_api.h:320
virtual void doubleClick(double x, double y)
reimplement to be called in case of a double click
Definition: glvertex_qt_glwindowui.h:194
virtual void mouseMoved(double dx, double dy)
reimplement to be called in case of a mouse move
Definition: glvertex_qt_glwindowui.h:186
void lglManip(bool on=true)
enable or disable the manipulator matrix
Definition: glvertex_api.h:300
2D double vector
Definition: glslmath.h:108
virtual void interaction()
reimplement to be called in case of a user interaction
Definition: glvertex_qt_glwindowui.h:200
lgl_Qt_GLWindow(bool core=true)
default ctor
Definition: glvertex_qt_glwindow.h:45
double length() const
get vector length
Definition: glslmath.h:133
void toggle_animation()
toggle animation
Definition: glvertex_qt_glwindow.h:177
void update()
update
Definition: glvertex_qt_glwindow.h:120
void toggle_wireframe()
toggle wireframe mode
Definition: glvertex_qt_glwindow.h:262
Qt OpenGL window class /w event handling.
Definition: glvertex_qt_glwindowui.h:15
virtual bool isSpinning()
check for manipulator spin
Definition: glvertex_qt_glwindowui.h:180
Qt OpenGL window base class.
Definition: glvertex_qt_glwindow.h:40