Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt keyPress/keyRelease notify work differently on Vista and Linux
Forum Updated to NodeBB v4.3 + New Features

Qt keyPress/keyRelease notify work differently on Vista and Linux

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 998 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nogains.nopains
    wrote on last edited by
    #1

    I found that the keyPress event is never fired until the key is actually released on Linux . This behavior is different on vista.

    The difference happens when I do the following sequence: 1) CTRL key down, 2) hold it for a while 3) release it.

    On Linux, nothing is printed out till the release.i.e. you'll not see anything till 3), then you'see "notify::KeyPressed" and "notify::KeyReleased".

    On Vista, after 1), you'll see "notify::KeyPressed", then in 2), you can detect that the CTRL is down with QApplication::keyboardModifier().testFlag(Qt::ControlModifier). then after 3), you'll see "notify::KeyReleased".

    I think what happens on vista is what I expected. How can I fix the problem on Linux and why it happens this way?

    Thanks for your help!

    Here is a piece of code from my application:

    @MyApplication::QApplication
    {
    bool notify(Object * receiver, QEvent * event) {
    try{
    if (event->type() == QEvent::KeyPress) {
    std::cout<<"notify::KeyPressed"<<endl;
    }

           if (event->type() == QEvent::KeyRelease) {
               std::cout<<"notify::KeyReleased"<<endl;
           }
    
    
            return QApplication::notify( receiver, event );
       }
       catch ( ... ) {
          std::cerr << "Unknown Exception caught: " << ends;
    
       }
       return false;
    
    }
    

    }@

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved