summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2013-10-29 16:42:08 (GMT)
committerMarius Kintel <marius@kintel.net>2013-10-29 16:42:08 (GMT)
commit8aa749f8b3bd0d6dd2cf4d2357a688319689432f (patch)
treefa9e662679ed8de4236c47c51c1ca75dc7b3d5b7 /src
parent9fe0beeddd08531ab2f664f2c02931fcb899ef0f (diff)
parent3e15f421136769c565a541c2af46c0f90c3e002e (diff)
Merge pull request #510 from hzeller/master
Make keyboard events working for GQLView
Diffstat (limited to 'src')
-rw-r--r--src/QGLView.cc16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/QGLView.cc b/src/QGLView.cc
index 8aaeaf2..5cb2e1b 100644
--- a/src/QGLView.cc
+++ b/src/QGLView.cc
@@ -167,15 +167,20 @@ void QGLView::paintGL()
void QGLView::keyPressEvent(QKeyEvent *event)
{
- if (event->key() == Qt::Key_Plus) {
+ switch (event->key()) {
+ case Qt::Key_Plus: // On many keyboards, this requires to press Shift-equals
+ case Qt::Key_Equal: // ...so simplify this a bit.
cam.viewer_distance *= 0.9;
updateGL();
- return;
- }
- if (event->key() == Qt::Key_Minus) {
+ break;
+ case Qt::Key_Minus:
cam.viewer_distance /= 0.9;
updateGL();
- return;
+ break;
+ case Qt::Key_C: // 'center'
+ cam.object_trans << 0, 0, 0;
+ updateGL();
+ break;
}
}
@@ -187,6 +192,7 @@ void QGLView::wheelEvent(QWheelEvent *event)
void QGLView::mousePressEvent(QMouseEvent *event)
{
+ setFocus();
mouse_drag_active = true;
last_mouse = event->globalPos();
}
contact: Jan Huwald // Impressum