Results 1 to 3 of 3

Thread: Fast Keyboard, help !

  1. #1
    Join Date
    Jun 2006
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Fast Keyboard, help !

    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...

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

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Fast Keyboard, help !

    Quote Originally Posted by Alex63
    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.

  3. #3
    Join Date
    Jun 2006
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Fast Keyboard, help !

    It works !

    Thank you for this idea !

    Alex

Similar Threads

  1. Fast image drawing/scaling in Qt 3.3
    By eriwik in forum Qt Programming
    Replies: 1
    Last Post: 21st June 2006, 10:45
  2. Keyboard shortcuts problem.
    By Lemming in forum Qt Programming
    Replies: 4
    Last Post: 5th April 2006, 16:12
  3. Capture a keyboard event
    By mahe2310 in forum Qt Programming
    Replies: 8
    Last Post: 16th February 2006, 11:19
  4. Query keyboard state in Qt 3
    By Pieter from Belgium in forum Qt Programming
    Replies: 2
    Last Post: 9th February 2006, 17:20

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.