×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    16

    Question How to get Repeat key events in Qt S60?

    Hi
    I need to implement seek forward and rewind functionality in my application whenever user long presses(Repeat key event) Left and right navigation keys. Please provide me some pointers to implement this functionality.
    I looked into QKeyEvent, but not able to find any property or method to implement it.

    Thanks in Advance
    Sumit

  2. #2
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Re: How to get Repeat key events in Qt S60?

    Hi,

    Where did you look in the QKeyEvent documentation?? Did you see the isAutoRepeat() method? Doesn't that help?

    Otherwise you can track the number of key presses you get before a release or use a timer to determine whether the time between press and release is long enough for your purpose.

    You would typically implement this in the keyPressEvent() and keyReleaseEvent() methods of your widget class (inherited from QWidget).

    Hope that helps,
    Mark

  3. #3
    Registered User
    Join Date
    Jan 2009
    Posts
    16

    Re: How to get Repeat key events in Qt S60?

    Hi Mark,
    isAutoRepeat() not working for repeat events, though it is meant for this purpose. I tried by implementing timer also, but the problem is timer doesnt get started until I release the key, but on releasing the timer's stop method gets called and there is no timeout signal emitted by timer.

    Here is the code snippet for your reference:

    void myClass::keyPressEvent ( QKeyEvent * event )
    {
    if(event->key() == Qt::Key_Right)
    {
    //seekTimer initialised in constructor.
    seekTimer->start(1000); //Starting timer, timeout value 1 sec.
    return;
    }
    }

    void myClass::keyReleaseEvent(QKeyEvent* event)
    {
    if(event->key() == Qt::Key_Right)
    {
    seekTimer->stop(); //Stopping timer
    return;
    }
    }

    Please correct my implementation or suggest some other way to implement it.

    Regards
    Sumit

  4. #4
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Re: How to get Repeat key events in Qt S60?

    Hi,

    The isAutoRepeat() method should work in future releases of Qt for S60. Please note that you are using a part-finished technology preview at the moment.

    I don't know exactly how the key event handling is working at the moment, but assuming you get repeated events while the key is held down, your implementation won't work because you keep re-starting the timer. You need a flag to let you know that the timer has been started and don't restart it if that has been set

    The other alternative, rather than use a timer is to simply count a certain number of repeated press events for the same key without a release event.

    Rather than try workaround's like this though, you should probably just wait for a newer release of Qt for S60 before you implement this feature and work on something else instead.

    Hope that helps,
    Mark

  5. #5
    Registered User
    Join Date
    Jan 2009
    Posts
    16

    Re: How to get Repeat key events in Qt S60?

    Thanks Marks...
    I think its better to wait for integration of this feature, as I have other things to try.
    Can you provide some links from where we can get latest information about Qt on S60?

    Regards
    Sumit

  6. #6
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Re: How to get Repeat key events in Qt S60?

    There isn't really a central place for information at the moment. Some comes from the Qt Software website, some on the QtS60-feedback mailing list, some from here and other information is only available be looking at the nightly snapshots to see where they're at with the code.

    When there is a new release available I'm sure it will be announced on this discussion board though.

    Mark

Similar Threads

  1. how to simulate the key press events in BREW??
    By rajesshwari in forum [Archived] Other Programming Discussion 关于其他编程技术的讨论
    Replies: 2
    Last Post: 2009-02-06, 14:34
  2. Replies: 3
    Last Post: 2007-11-01, 14:05
  3. key events in background app ?
    By jrp040379 in forum Symbian User Interface
    Replies: 0
    Last Post: 2004-02-02, 09:57
  4. 3410 losing key events
    By marcpalmer in forum Mobile Java General
    Replies: 4
    Last Post: 2003-09-30, 22:50
  5. Capture Key events away from the editor window
    By amirelattar in forum Symbian User Interface
    Replies: 1
    Last Post: 2002-12-17, 08:29

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×