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. KeyPress not firing on Android tablet
Forum Update on Monday, May 27th 2025

KeyPress not firing on Android tablet

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 143 Views
  • 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.
  • M Offline
    M Offline
    MiklYarochkin
    wrote on last edited by
    #1

    (repost from Stackoverflow)

    I am trying to adapt this solution for Android tablet

    The problem is QEvent::KeyPress is not fired on a tablet when using a virtual keyboard.

    After some trial and error, I found what QEvent::InputMethod fired instead.

    Code is working on tablet with 2 modifications:

    • if ( event->type() == QEvent::KeyPress || event->type() == QEvent::InputMethod)

    • QKeyEvent* pEvent = (QKeyEvent*)( event );

    I don't get why I don't have runtime exception, because InputMethod simply have no member key()

    Even if it is working it is not safe.

    How i should handle input in the correct way?

    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