Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. not working keyPressEvent
Forum Updated to NodeBB v4.3 + New Features

not working keyPressEvent

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
7 Posts 4 Posters 1.1k Views 3 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
    Nishihashi
    wrote on last edited by
    #1

    Hi.

    My fullscreen widget application is working at TI EVM board with touchscreen.
    I want to grab key press event from GPIO signal.

    keyPressEvent() is not called even when GPIO signal is activated.
    But, once tapped touchscreen, keyPressEvent is called.
    I don't know how to set QWidget.

    I tried QWidget setting as below:

    • setFocus
    • setFocusPolicy(Qt::StrongFocus)

    Please give me some advices to solve this issue.

    Thanks in advance.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      You should check with the board documentation what exactly happens with that touchscreen.
      You can also install an event filter to see what does on before and after touching the screen.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • N Offline
        N Offline
        Nishihashi
        wrote on last edited by
        #3

        Hi.

        Both The touch screen driver and the gpio-key driver have been able to get events.
        It is confirmed by evtest.
        However, it seems that the event of gpio-key is not transmitted to Qt application before Qt application get touchscreen event (mousePressEvent).

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Sounds strange... Did you try to manually send a QMouseEvent to your application before touching the screen ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • N Offline
            N Offline
            Nishihashi
            wrote on last edited by
            #5

            @SGaist said in not working keyPressEvent:

            Did you try to manually send a QMouseEvent to your application before touching the screen ?

            No. I don't know how to do it...

            1 Reply Last reply
            0
            • mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Hi
              Something like

                 QWidget *w = ?? what widget you want to send it to
                 {
                 QMouseEvent qm2(QEvent::MouseButtonPress, pos, Qt::LeftButton , Qt::LeftButton,    Qt::NoModifier);
                 QApplication::sendEvent(w, &qm2);
                 }
                 {
                 QMouseEvent qm2(QEvent::MouseButtonRelease, pos, Qt::LeftButton , Qt::LeftButton,    Qt::NoModifier);
                 QApplication::sendEvent(w, &qm2);
                 }
              
              1 Reply Last reply
              4
              • J Offline
                J Offline
                Jesse2
                Banned
                wrote on last edited by Jesse2
                #7
                This post is deleted!
                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