Results 1 to 3 of 3

Thread: Keyboard stops responding

  1. #1
    Join Date
    Feb 2007
    Posts
    73
    Thanks
    11
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Keyboard stops responding

    I am running Qt embedded on an arm based linux distribution (common os). The device has keyboard input. When I first run the application, the keyboard works fine. But after 2 minutes or so, the keyboard stops sending events. If I restart the application, this scenario is repeated.

    The application calls grabKeyboard() on the main window to get keyboard input. I don't have QWS_KEYBOARD set to anything and I don't think that this is needed.

    Does anyone know how I can keep the keyboard alive, or, worst case, wake it up somehow?

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Keyboard stops responding

    Do you mean that QKeyEvents are not generated ? Install event filter on QApplication object to check if key events are generated.

  3. #3
    Join Date
    Feb 2007
    Posts
    73
    Thanks
    11
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Keyboard stops responding

    I mean I don't get events with the type KeyPress or KeyRelease, only ShortcutOverride. I tried an event filter and still no key press or key release events. I also tried implementing the protected virtual keyPressEvent and keyReleaseEvent methods in the QWidget child windows. They never get called. It's really weird. Only if I call grabKeyboard do I see these events.

    What I have is a QMainWindow derivation, who calls grabKeyboard(). It then gets all KeyPress and KeyRelease events for all windows in the system (in it's ::event method). We're using a panel stack pattern and the main window is the panel stack. It gets all events from the joystick and from the keyboard device and translates them to "meaningful" events which get signaled to child windows in the stack for handling.

    On X11 this works perfectly without the grabKeyboard() call.

    On the embedded device (QWS), without the grabKeyboard() call, only key events with a type of ShortcutOverride are sent. So I tried implementing an event filter in the main window to catch all events from the child windows. Still only ShortcutOverride key events come in. Then I tried implementing the keyPressEvent() and keyReleaseEvent() methods in the child windows; they never get called.

    If the main window (panel stack) calls grabKeyboard(), events with a type of KeyPress and KeyRelease are sent to the main window.

    But, when you boot the device, if you let it sit for about 2 minutes (with no activity), key events of any kind are no longer sent to the main window. As an interim solution (hack if you ask me), I implemented a timer which fires at a set interval. The slot connected to the timeout() signal accesses QWSServer::instance() and closes the keyboard, then re-opens the keyboard. This seems to keep the keyboard from shutting down and key events are delivered to the app as expected. But I don't like this solution at all. I want to understand why the keyboard stops sending events.

Similar Threads

  1. QProgressDialogButton is not responding
    By gowen in forum Qt Programming
    Replies: 1
    Last Post: 14th August 2011, 19:13
  2. USB Keyboard is not responding in qt-embedded-4.4.3
    By grsandeep85 in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 7th April 2011, 03:13
  3. Replies: 1
    Last Post: 6th December 2010, 15:18
  4. tab stops ?
    By ixM in forum Qt Programming
    Replies: 4
    Last Post: 28th May 2009, 13:11
  5. Window not responding
    By markcole in forum Qt Programming
    Replies: 10
    Last Post: 18th April 2007, 21:53

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
  •  
Qt is a trademark of The Qt Company.