Results 1 to 3 of 3

Thread: Avoiding Keystroke repetition.

  1. #1
    Join Date
    Dec 2014
    Posts
    4
    Qt products
    Qt5
    Platforms
    Windows

    Default Avoiding Keystroke repetition.

    Hello,

    I'm working on Windows and I have the following problem :

    By pressing and maintainting a single key (for example the 'R' key), I want to catch the KeyPressEvent : No problem.
    Another fonction will be activated by KeyReleaseEvent...

    But, as the user press the key for a while, the system (Windows) do a key repetition aswell as it fires the keyReleasedEvent !

    Have you a solution ?

    Gilles

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Avoiding Keystroke repetition.


  3. #3
    Join Date
    Dec 2014
    Posts
    4
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Avoiding Keystroke repetition.

    Hello d_stranz,

    That's it !
    Thank you.

    Here is my function using it :


    void GLWidget::keyReleaseEvent(QKeyEvent *event){
    switch (event->key()){
    case Qt::Key_R :
    if(event->isAutoRepeat()) break;// if the event comes from autoRepeat from system, we stop.
    qApp->takeOfMode(KEY_R);
    qApp->takeOfMode(IN_COPY);
    this->listOfElement->takeOffModeAtAll(AUTO_INCLUDED);
    break;

    case Qt::Key_Shift :
    qApp->takeOfMode(KEY_SHIFT);
    break;
    }
    }

Similar Threads

  1. Avoiding Q_DECLARE_METATYPE
    By moijhd in forum Qt Programming
    Replies: 6
    Last Post: 11th July 2013, 10:09
  2. random questions w/o repetition
    By shinichi7 in forum Newbie
    Replies: 10
    Last Post: 10th January 2013, 14:21
  3. avoiding mainwindow from freezing
    By doniking in forum Newbie
    Replies: 9
    Last Post: 8th June 2012, 09:30
  4. avoiding zoom out
    By mastupristi in forum Qwt
    Replies: 1
    Last Post: 8th July 2009, 16:57
  5. how to detect a keystroke
    By irfanhab in forum Qt Programming
    Replies: 1
    Last Post: 16th July 2006, 08:05

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.