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. Get Keyboard height in android

Get Keyboard height in android

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
6 Posts 4 Posters 2.7k 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.
  • SheepS Offline
    SheepS Offline
    Sheep
    wrote on last edited by
    #1

    Greetings

    Am trying to get the height of the virtual keyboard in android using Qt.inputMethod::keyboardRectangle but i keep getting unexpected results (the Qt.inputMethod::keyboardRectangle.height is larger(almost 2 times) than the virtual keyboad height).

    i have noticed in the Qt documentation

    Qt.InputMethod::keyboardRectangle
    " Virtual keyboard's geometry in window coordinates."

    Then if the geometry is in window coodinates..then how can i convert them to qml units...
    Thanks
    Screenshot_20230518-135631.jpg

    JoeCFDJ 1 Reply Last reply
    0
    • SheepS Sheep

      Greetings

      Am trying to get the height of the virtual keyboard in android using Qt.inputMethod::keyboardRectangle but i keep getting unexpected results (the Qt.inputMethod::keyboardRectangle.height is larger(almost 2 times) than the virtual keyboad height).

      i have noticed in the Qt documentation

      Qt.InputMethod::keyboardRectangle
      " Virtual keyboard's geometry in window coordinates."

      Then if the geometry is in window coodinates..then how can i convert them to qml units...
      Thanks
      Screenshot_20230518-135631.jpg

      JoeCFDJ Offline
      JoeCFDJ Offline
      JoeCFD
      wrote on last edited by JoeCFD
      #2

      @Sheep if you can get the top left corner position of keyboard, you can calculate: screen height - top left corner y = keyboard height. That is pixel numbers and they can be used in qml.

      SheepS 1 Reply Last reply
      0
      • JoeCFDJ JoeCFD

        @Sheep if you can get the top left corner position of keyboard, you can calculate: screen height - top left corner y = keyboard height. That is pixel numbers and they can be used in qml.

        SheepS Offline
        SheepS Offline
        Sheep
        wrote on last edited by
        #3

        @JoeCFD Sorry for the late response, are you trying to mean I use the qt inputmethod. keyboard rectangle.y to get the top left

        JoeCFDJ 1 Reply Last reply
        0
        • SheepS Sheep

          @JoeCFD Sorry for the late response, are you trying to mean I use the qt inputmethod. keyboard rectangle.y to get the top left

          JoeCFDJ Offline
          JoeCFDJ Offline
          JoeCFD
          wrote on last edited by JoeCFD
          #4

          @Sheep That is what I meant. The unit of geometry data is pixel int and you can use the data in qml directly.
          I could be wrong. The coordinate y could be incorrect as well if the height is wrong. It is likely that your call to the func is too early.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            Simon E.
            wrote on last edited by
            #5

            Hello @Sheep we are having the same problem as you described. Did you manage to find a solution? Best Regards

            1 Reply Last reply
            0
            • A Offline
              A Offline
              AshkanV
              wrote on last edited by
              #6

              The height is in native scale. It is required to devide it by devicePixelRatio:

              Qt.inputMethod.keyboardRectangle.height / Screen.devicePixelRatio
              
              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