Added up/down key to zoom, plus ctrl accelerator

This commit is contained in:
Mark Watkins 2011-07-16 00:54:05 +10:00
parent e72980de11
commit 6d00f59ec2

View File

@ -365,11 +365,24 @@ void gGraphWindow::mouseReleaseEvent(QMouseEvent * event)
void gGraphWindow::keyPressEvent(QKeyEvent * event)
{
bool moved=false;
int accel=1;
if (event->key()==Qt::Key_Left) {
MoveX(40);
if (event->modifiers() & Qt::ControlModifier) accel=4;
MoveX(40*accel);
moved=true;
} else if (event->key()==Qt::Key_Right) {
MoveX(-40);
if (event->modifiers() & Qt::ControlModifier) accel=4;
MoveX(-40*accel);
moved=true;
} else if (event->key()==Qt::Key_Up) {
double zoom_fact=2;
if (event->modifiers() & Qt::ControlModifier) zoom_fact=5;
ZoomX(zoom_fact,0);
moved=true;
} else if (event->key()==Qt::Key_Down) {
double zoom_fact=.5;
if (event->modifiers() & Qt::ControlModifier) zoom_fact=.2;
ZoomX(zoom_fact,0);
moved=true;
}