o Key-press event in the QGLView were ignored, as it never got the

focus. Fix: Gain focus on mouse-click inside that view.
o QGLView: make zoom-in as well possible on '=' key. On American
  keyboards, the '=' key is right next to the '-' (Minus) key, while
  '+' (plus) requires Shift-equals.
o Provide a useful 'c' key-binding for 'center'. Very useful after
  getting lost in panning.
brodykenrick-master
Henner Zeller 2013-10-24 22:56:55 -07:00
parent 54595cc9bf
commit 3e15f42113
1 changed files with 11 additions and 5 deletions

View File

@ -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();
}