Hi..
I would Like to use the keybord to generate events on my application ..but I still don't know how to use the QKeyEvent..
The idea is To zoom (translate ... ) on a View ( QGraphicsView) everytime we press on the Key (Up,Down,Right,Left) ..So I tried to create a methode for that Using QkeyEvent :
switch(e->key()){
case Qt::Key_Left :
graphicsView->scale(1.2,1.2);
break;
case Qt::Key_Down :
graphicsView->scale(1/1.2,1/1.2);
break;
}
}
void myview::keyPressEvent(QKeyEvent *e){
switch(e->key()){
case Qt::Key_Left :
graphicsView->scale(1.2,1.2);
break;
case Qt::Key_Down :
graphicsView->scale(1/1.2,1/1.2);
break;
}
}
To copy to clipboard, switch view to plain text mode
but it dosnt work ( nothing happens when I press left or right Key) ??
Should I connect that methode to a specific SIGNAL ? if it the case wht signal should I use ?!!
Please if someOne have a idea ..
thanks
Bookmarks