Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [SOLVED] keyPressEvent accepts no letters

[SOLVED] keyPressEvent accepts no letters

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 3 Posters 1.8k 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.
  • D Offline
    D Offline
    david.luggen
    wrote on last edited by
    #1

    Hi there

    I'm using the keyPressEvent in my QMainWindow class like this:

    @
    void MyMainWindow::keyPressEvent(QKeyEvent *keyEvent)
    {
    qDebug() << keyEvent->key();
    }
    @

    But it only detects special keys like enter, ctrl, alt etc. but no letters or numbers. Did I oversee something?

    Edit:

    Found it. Because my QMainWindow class only posseses QSpinBox items the focus is always on them. Somehow the QMainWindow class catches special keys but letters or numbers go to the QSpinBox.

    1 Reply Last reply
    0
    • F Offline
      F Offline
      francomartins
      wrote on last edited by
      #2

      try it :
      @
      installEventFilter(this);
      @

      for enable the keypress event filter ;

      1 Reply Last reply
      0
      • R Offline
        R Offline
        raaghuu
        wrote on last edited by
        #3

        @mods - This is not a Qt Quick problem... Please move it to General and Desktop

        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