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. How is the Qt virtual keyboard initialized and how do I use it?

How is the Qt virtual keyboard initialized and how do I use it?

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 1.2k 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.
  • C Offline
    C Offline
    Circuits
    wrote on last edited by
    #1

    I am taking a look at the basic example for the Qt virtual keyboard. I can't seem to find any initialization for the keyboard or any place in the QML where it is being called. For instance, the only thing that happens in the QML when a user clicks the input box is that variable called focus is set too true:

    ... MouseArea  {
                id: content
                width: flickable.width
                height: textEditors.height + 24
    
                onClicked: focus = true
    
                Column {...
    

    does setting focus = true start up the keyboard and if so, how?

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      This is described in-depth in the documentation. In short & simplified: Qt has code which handles input (mouse, keyboard etc.) abstracted into platform plugin. QtVK plugs into that - so from the point of view of your application (and yourself) QtVK is treated 100% the same as if it was a real, physical keyboard.

      (Z(:^

      C 1 Reply Last reply
      1
      • sierdzioS sierdzio

        This is described in-depth in the documentation. In short & simplified: Qt has code which handles input (mouse, keyboard etc.) abstracted into platform plugin. QtVK plugs into that - so from the point of view of your application (and yourself) QtVK is treated 100% the same as if it was a real, physical keyboard.

        C Offline
        C Offline
        Circuits
        wrote on last edited by Circuits
        #3

        @sierdzio Perhaps I wasn't clear about what I am asking. In QMl events usually have some kind of trigger, right? For instance, a push button will have an onClicked function. What function, in the QML code I posted, is causing the keyboard to become visible to the user? I think perhaps you thought I was asking more broadly about how the keyboard works, in reality, I just want to know how to hook it up, say for instance, to a button press:

        PushButton
                 {
                    text: "hello world"
                    id: genericPushButton
                    enabled: true
                    onClicked: //What do I put here to enable the keyboard
                               //when a user clicks the push button?
                 }
        

        or perhaps a Text Field or something of that nature.

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          @Circuits said in How is the Qt virtual keyboard initialized and how do I use it?:

          onClicked: //What do I put here to enable the keyboard
          //when a user clicks the push button?

          Qt.inputMethod.show()
          

          (Z(:^

          C 1 Reply Last reply
          2
          • sierdzioS sierdzio

            @Circuits said in How is the Qt virtual keyboard initialized and how do I use it?:

            onClicked: //What do I put here to enable the keyboard
            //when a user clicks the push button?

            Qt.inputMethod.show()
            
            C Offline
            C Offline
            Circuits
            wrote on last edited by
            #5

            @sierdzio This works, however; now I am left wondering how I specify the input method? For instance, activating the keyboard on a button press brings up the keyboard but it reports that:

            input method is not set
            

            when I press the button. How might I set that input method? I realize one way of doing it is by using TextInput{} or something along those lines instead of using a button. However, could I for instance alter the text property of the button itself with the keyboard?

            1 Reply Last reply
            0
            • Aleksey_KA Offline
              Aleksey_KA Offline
              Aleksey_K
              wrote on last edited by
              #6

              @Circuits said in How is the Qt virtual keyboard initialized and how do I use it?:

              input method is not set

              Solution is here: https://forum.qt.io/post/594648

              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