PDA

View Full Version : Fast Keyboard, help !



Alex63
27th June 2006, 17:01
Hello,

I'm new to Qt and i'm making a game using opengl.
Also I'm French so sorry if my english is not perfect...

The game is working, but I have a little problem : the keyboard.:(

I would like to make smaller the time before a key begin to be autorepeated.
I 'v seen "keyboardInputInterval" but I don't manage to use it.

Maybe there is an other solution, my problem is that when I press a key, I would like the autofire to start directly...

Thank you a lot for helping me...:crying:

This is my code for the keyboard :

void Ecran::keyPressEvent(QKeyEvent *event)
{
int k;
switch (event->key()) {
case Qt::Key_Left:
bougerg();
break;
case Qt::Key_Right:
bougerd();
break;
case Qt::Key_P:
pause = !pause;
break;
(..............)

default:
QWidget::keyPressEvent(event);
}
}

jacek
27th June 2006, 17:30
I would like to make smaller the time before a key begin to be autorepeated. I 'v seen "keyboardInputInterval" but I don't manage to use it. [...] I would like the autofire to start directly...
If changing keyboardInputInterval didn't help, you could use keyPressEvent() to start autofire and keyReleaseEvent() to stop it.

Alex63
27th June 2006, 19:18
It works !

Thank you for this idea !

Alex