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. Using Qt Virtual Keyboard

Using Qt Virtual Keyboard

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 2 Posters 551 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.
  • S Offline
    S Offline
    swurl
    wrote on last edited by
    #1

    I stumbled upon the docs for Qt Virtual Keyboard sometime recently, but am rather confused on how to use it with C++ and for it to have its expected behavior: scroll the app up if it'll cover something, changing to the numbers-only input, etc.

    Are there any additional docs for this?

    1 Reply Last reply
    1
    • A Offline
      A Offline
      Asperamanca
      wrote on last edited by
      #4

      That's the harder version. Of course you have to add the necessary Qt module. Then you have two options:

      1. You just enable it via
        qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
        This option does not give you any control about where and how it appears. It just appears when your cursor is in a context where text input is possible
      2. If you want to control where it appears and how big it is, you need the InputPanel QML component. AFAIK there is no direct QWidget equivalent, so you will have to wrap it inside a QQuickWidget (I haven't tried that, and I hope that works)

      In general, the documentation is very confusing, because there is tons of stuff about customizing the keyboard, adding new input methods, etc. In all that fog, it's hard to find the basic things like "how do I display it?"

      S 1 Reply Last reply
      2
      • A Offline
        A Offline
        Asperamanca
        wrote on last edited by
        #2

        What kind of app do you have? Widget-based or QML-Based?

        1 Reply Last reply
        0
        • S Offline
          S Offline
          swurl
          wrote on last edited by
          #3

          C++, Widget-based.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Asperamanca
            wrote on last edited by
            #4

            That's the harder version. Of course you have to add the necessary Qt module. Then you have two options:

            1. You just enable it via
              qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
              This option does not give you any control about where and how it appears. It just appears when your cursor is in a context where text input is possible
            2. If you want to control where it appears and how big it is, you need the InputPanel QML component. AFAIK there is no direct QWidget equivalent, so you will have to wrap it inside a QQuickWidget (I haven't tried that, and I hope that works)

            In general, the documentation is very confusing, because there is tons of stuff about customizing the keyboard, adding new input methods, etc. In all that fog, it's hard to find the basic things like "how do I display it?"

            S 1 Reply Last reply
            2
            • A Asperamanca

              That's the harder version. Of course you have to add the necessary Qt module. Then you have two options:

              1. You just enable it via
                qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
                This option does not give you any control about where and how it appears. It just appears when your cursor is in a context where text input is possible
              2. If you want to control where it appears and how big it is, you need the InputPanel QML component. AFAIK there is no direct QWidget equivalent, so you will have to wrap it inside a QQuickWidget (I haven't tried that, and I hope that works)

              In general, the documentation is very confusing, because there is tons of stuff about customizing the keyboard, adding new input methods, etc. In all that fog, it's hard to find the basic things like "how do I display it?"

              S Offline
              S Offline
              swurl
              wrote on last edited by swurl
              #5

              @Asperamanca Alright thanks, will try it soon.

              In the meantime I may end up porting my app to QML, in which case I also can't find great docs. Do I need the same qputenv thing?

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

                I think the qputenv thing is always needed, but I have not deep-dived into virtual keyboard (yet).

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  swurl
                  wrote on last edited by
                  #7

                  This did seem to work.

                  1 Reply Last reply
                  0
                  • S swurl has marked this topic as solved on

                  • Login

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