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. Qml Image key events
Forum Update on Monday, May 27th 2025

Qml Image key events

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
6 Posts 2 Posters 673 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.
  • mrdebugM Offline
    mrdebugM Offline
    mrdebug
    wrote on last edited by
    #1

    Hi, I have a Image object where I show images.
    I need to detect PageDown and PageUp key press to change image. How can I detect the key press event inside an Image object?
    It seems that key events can detect only in a text object.

    Need programmers to hire?
    www.labcsp.com
    www.denisgottardello.it
    GMT+1
    Skype: mrdebug

    ODБOïO 1 Reply Last reply
    0
    • mrdebugM mrdebug

      Hi, I have a Image object where I show images.
      I need to detect PageDown and PageUp key press to change image. How can I detect the key press event inside an Image object?
      It seems that key events can detect only in a text object.

      ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by ODБOï
      #2

      @mrdebug hi
      make sure focus property of you image is set to true

      1 Reply Last reply
      0
      • mrdebugM Offline
        mrdebugM Offline
        mrdebug
        wrote on last edited by
        #3

        Already tried but does not work.
        Have you got an example?

        Need programmers to hire?
        www.labcsp.com
        www.denisgottardello.it
        GMT+1
        Skype: mrdebug

        ODБOïO 1 Reply Last reply
        0
        • mrdebugM mrdebug

          Already tried but does not work.
          Have you got an example?

          ODБOïO Offline
          ODБOïO Offline
          ODБOï
          wrote on last edited by
          #4

          @mrdebug
          qt5.13.0 mingw64

          //QtQuick 2.12
             Image{
                  source: ""
                  anchors.fill: parent
                  focus: true //<
                  Keys.onPressed:{
                      if(event.key === Qt.Key_PageUp){
                          console.log("up")
                      }
                      else if(event.key === Qt.Key_PageDown){
                          console.log("down")
                      }
                  }
              }
          
          1 Reply Last reply
          2
          • mrdebugM Offline
            mrdebugM Offline
            mrdebug
            wrote on last edited by
            #5

            It works in a TextEdit object but not in the Image object.
            This is not a problem.
            Do you know how to resolve

            console.log(event.key, Qt.Key_KeyUp)
            qml: 32 undefined

            Need programmers to hire?
            www.labcsp.com
            www.denisgottardello.it
            GMT+1
            Skype: mrdebug

            ODБOïO 1 Reply Last reply
            0
            • mrdebugM mrdebug

              It works in a TextEdit object but not in the Image object.
              This is not a problem.
              Do you know how to resolve

              console.log(event.key, Qt.Key_KeyUp)
              qml: 32 undefined

              ODБOïO Offline
              ODБOïO Offline
              ODБOï
              wrote on last edited by
              #6

              @mrdebug said in Qml Image key events:

              Do you know how to resolve
              console.log(event.key, Qt.Key_KeyUp)

              its Qt.Key_Up instead of Qt.Key_KeyUp

              1 Reply Last reply
              1

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved