Results 1 to 2 of 2

Thread: QKeyEvent questions

  1. #1
    Join Date
    Oct 2006
    Posts
    1
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default QKeyEvent questions

    I have some questions related to key events in QT 3.3. I have a simple application which I am using to test out using and handling key events. It's not working as I expected it would. Here are the details.

    The app displays a small image. I have my function to capture key events (QKeyEvent()). As I press a key on the keyboard, the event handler just writes out "I got x" to cout (using myEvent->text()), just so I can see that the keystrokes are being captured. This part works perfectly.

    I have a small credit card reader which plugs into the keyboard port on the computer. You swipe the credit card and it sends the magnetic stripe data to the system as if it were typed on a keyboard. This device works fine. If I issue the command "cat >/dev/null" and swipe the card, it will work all day long.

    But, if I swipe the card using my test application, things go screwy. First of all, some of the events have more than one character in the text portion. How can a single key event have multiple characters? The other thing is that there are some characters missing from the input. So, with my test program, the data I get is garbled.

    Could it have anything to do with the speed of input? The characters from the credit card reader go in to the system at a much faster rate than a human can type. Is this possibly the reason why it doesn't work?

    Thanks for any insight.

    Bill

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QKeyEvent questions

    Quote Originally Posted by QKeyEvent
    QString QKeyEvent::text () const
    Returns the Unicode text that this key generated. The text returned migth be empty, which is the case when pressing or releasing modifying keys as Shift, Control, Alt and Meta. In these cases key() will contain a valid value.
    Maybe it would be better if you used key() or ascii() instead of text().

Similar Threads

  1. Image sequence Questions...
    By Deep Thought in forum Qt Programming
    Replies: 5
    Last Post: 12th February 2016, 10:23
  2. application design questions
    By nikita in forum Qt Programming
    Replies: 6
    Last Post: 28th August 2006, 00:35
  3. 2 Questions about layouts
    By SkripT in forum Qt Programming
    Replies: 1
    Last Post: 26th February 2006, 13:54
  4. 2 Questions about QPainter
    By SkripT in forum Qt Programming
    Replies: 12
    Last Post: 22nd February 2006, 15:08
  5. Qt related questions and thoughts about getting job
    By AlexKiriukha in forum General Discussion
    Replies: 4
    Last Post: 26th January 2006, 12:25

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.